gbowerman / azurerm Goto Github PK
View Code? Open in Web Editor NEWEasy to use Python library for the Azure Resource Manager REST API
License: MIT License
Easy to use Python library for the Azure Resource Manager REST API
License: MIT License
Hi @gbowerman
Just to confirm what we discussed, could you customize the UserAgent? So the usage of your library can be monitored? Since you receive PRs, people are using it and it's important for the ARM metrics dashboard to identify the source of Python calls.
Thank you,
Hi @gbowerman,
First of all, thank you for a very nice module.
I looked at the code and it does not seem that there is a way to pass more arguments to requests, I specifically need to use proxy and I can't find a way to do it.
I can see that the last commit was a while ago and wanted to ask if this module is still maintained? If I will create a PR to pass more parameters to requests will you consider merging it?
I have a setup where azure-cli
logs in as a service principal and would like to use the get_access_token_from_cli
functionality.
The cached tokens file looks like this:
~/.azure/accessToken.json
[{ "servicePrincipalId": "xxxxxxxxxxxxxxxxxxxxxxxx", "servicePrincipalTenant": "xxxxxxxxxxxxxxxxxxxxx", "accessToken": "xxxxxxxxxxxxxxxxxxxxx" }]
Resulting in this error:
File "site-packages/azurerm/adalfns.py", line 64, in get_access_token_from_cli
if key['userId'] == sub_username:
KeyError: 'userId'
I've also seen setups where the cached tokens are both user and service principal ones.
Should be easy to be able to retrieve both kinds of tokens from the cache file.
PS: This is something I'll probably work on anyway. Opening this issue mostly to judge interest for a PR.
I'm trying to remove a few selected vms from a scale set and if I try to pass a string I get the following error from Azure:
"message": "Error converting value 16 to type 'System.Collections.Generic.List`1[System.String]'. Path 'instanceIds', line 1, position 19."
If I try to pass an array(Like I do when I run the corresponding PowerShell command(Remove-azurermvmss), I get the following error from the lib:
File "C:\Python27\lib\site-packages\azurerm\computerp.py", line 183, in delete_vmss_vms
body = '{"instanceIds" : ' + vm_ids + '}'
TypeError: cannot concatenate 'str' and 'list' objects
It might be expecting a list.
Thanks!
CLI in Azure Cloud Shell gets its Azure access token from an instance metadata endpoint. Therefore ideally get_access_token_from_cli() should also query the endpoint if it detects it is running on cloud shell.
Currently investigating how feasible that is.
The list_vms_sub
function returns a maximum of 50 results. To return more than 50 results using the azurerm module, the resource groups must be enumerated, and list_vms
must be called for each returned resource group. (list_vms_sub
does not itself have this issue; it will happily return 51+ VMs from a single resource group.)
For short scripts, it would be nice to see list_vms
return all results, or at least a configurable maximum.
In the stop vm function the uri should be like "powerOff" but not "stop" in computerp.py file.
i tried to overwrite but failed, any ideas?
azurerm.adalfns.authentication_endpoint='https://login.chinacloudapi.cn/'
azurerm.adalfns.resource='https://management.chinacloudapi.cn/'
When trying to get vm nics(get_vmss_vms_nics) I get the following error:
"No registered resource provider found for location 'westeurope' and API version '2017-03-30' for type 'virtualMachineScaleSets/virtualMachines/netw
orkInterfaces'. The supported api-versions are '2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-04-30-preview, 2016-06-01, 2016-07-01, 2016-08-01, 2016-09-01'
Maybe make API version override-able?
Hi ,
We are using azurerm module to get vm list from Azure. But we are getting SSL error some time. After that some getting the vm list. Kindly provide the solution for this.
Error Log : "requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)"
Thanks,
Gopal.
@gboweman If you provide to get azure vm metric values data function, then it will be great helpfull to me.
Hi
I need to clear a resource group from all the components (resources) but I must leave the resource group untouched, (I gave rights to the service principle on the resource group)
do you have a way to do that?
Thank you for great scripts
Izia
Hi,
I am trying to create a container instance group with a single container definition with an environment variable defined.
My container definition is of the form:
container_def = create_container_definition(container_name='my_name', image='my_image', port=8000, cpu=1.0, memgb=1.0, environment=[{'name': 'my_name', 'value': 'my_value'}])
and a group instance created via:
create_contained_instance_group(access_token=my_token, subscription_id=my_id, resource_group=rg,
container_group_name=group_name, container_list=[container_def], location='westeurope', ostype='Linux', port=8000, iptype='public')
Which fails and produces the following error:
The request content was invalid and could not be deserialized: 'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'Microsoft.Azure.CloudConsole.Providers.Data.Definition.ContainerEnvironmentVariable[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'properties.containers[0].properties.environmentVariables.name:', line 1, position 278.'.
No error is produced when passing None into the container definition.
Any ideas what the problem is here?
JP
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.