Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    asp asp
    @lmazuel for both cases activity log and creating a vault recovery backup for an azure vm, I am looking for python sdk to do the job instead of doing it via portal. Is that possible to create a use case and it test from Azure team please. I know documentation mentioned help to certain part, but it will be really good if git hub for python sdk have usecase template examples for these two activities ? . It would really help us to do some automation
    link given for vault backup initiation via python sdk, i dont find it relevant.. hmm.
    asp asp
    However thanks for help :) learning a bit towards automation :)
    Laurent Mazuel
    Happy to help :). Please follow-up on your Github issues, and don't hesitate to open issues as necessary, that's why the Github tracker is here ;)
    asp asp
    @lmazuel I am still waiting for some solution. we badly need some examples so that we can utilize. Hope github provides me some workable example. Especially now to automate backup and fetching backup related information like backupvault name, vault resource group name and policy name for a given VM. Created a new issue for this on github.
    Laurent Mazuel
    I can't do more myself unfortunately since I don't handle this service :(. If you don't get answer in a timely manner, you can always do a support ticket on the Azure Portal as well.
    asp asp
    @lmazuel Its Ok. hmm. I understand there are poweshell way of doing things, but some how in our case instruction was to do in pythonic(more adoption due to integration reasons) way more and more activities..Hence the ask :), Shall wait for reply on Github..
    running this as per example:
            # check if name is available
            availability = storage_client.storage_accounts.check_name_availability("storage_account_name")
    msrest.exceptions.SerializationError: Unable to build a model: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get', DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'
    Laurent Mazuel

    Hi @tomarv2 , I'm not directly working on Mgmt anymore, but I looked at the SDK and indeed you need now to wrap the string with the type StorageAccountCheckNameAvailabilityParameters:

    availability = storage_client.storage_accounts.check_name_availability(StorageAccountCheckNameAvailabilityParameters("storage_account_name"))

    If you found an incorrect sample, please create an issue on Github so I can tag the right team on it to fix it. https://github.com/Azure/azure-sdk-for-python/issues

    Hi, I was wondering whether azure has python SDK for API management or not. If there are some SDKs or APIs then please help me in providing some references. Thanks
    Laurent Mazuel
    If you don't find what you are looking for, please open an issue on the issue tracker on Github, so I can tag the APIMgmt team on it. Thanks!
    @lmazuel Thank you so much, It helped me.
    does any of you know if it is possible to make a docker image immutable via python on ACR? Which class and method do i need to use? Currently i am at ContainerRegistryManagementClient but is this the right direction?
    Hi, I am trying to use azure-mgmt-apimanagement SDK , specifically the api-operations class. When I am using the create_or_update function then the SDK gives an error of Api not found. Instead of creating a new API instance, the function is trying to update the value. Can anyone help me with this? sdk link: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-mgmt-apimanagement/0.1.0/azure.mgmt.apimanagement.operations.html#azure.mgmt.apimanagement.operations.ApiOperations
    Hi! I am trying to use azure-servicebus-management-client to create a subscription with the parameter 'forward_to' and I keep getting "Missing Token" error. Can anyone help me?
    the print is from the erro I mentioned
    I already tried to create the client from connection_string and using credential+fully_qualified_namespace, and I get the same error in both ways
    oh, btw, I using the version 7.0.0 of the package azure-servicebus and python3.9
    Adam Ling (MSFT)
    Hey @ianrocha , we confirmed it's a bug in the ServiceBusAdministrationClient that forward_to requires additional bearer token headers to be provided. We have fixed the bug in the PR:Azure/azure-sdk-for-python#15610. The fix will be carried in our next release.
    thanks very much @yunhaoling!!!

    I am using azure-storage-file-datalake package to connect with ADLS gen2

    from azure.identity import ClientSecretCredential
    # service principal credential
    tenant_id = 'xxxxxxx'
    client_id = 'xxxxxxxxx'
    client_secret = 'xxxxxxxx'
    storage_account_name = 'xxxxxxxx'
    credential = ClientSecretCredential(tenant_id, client_id, client_secret)
    service_client = DataLakeServiceClient(account_url="{}://{}.dfs.core.windows.net".format(
            "https", storage_account_name), credential=credential) # I have also tried blob instead of dfs in account_url

    Folder structure in ADLS gen2 from where I have to read parquet file look like this. Inside container of ADLS gen2 we folder_a which contain folder_b in which there is parquet file.


    from gen1 storage we used to read parquet file like this.

    from azure.datalake.store import lib
    from azure.datalake.store.core import AzureDLFileSystem
    import pyarrow.parquet as pq
    adls = lib.auth(tenant_id=directory_id,
    adl = AzureDLFileSystem(adls, store_name=adls_name) 
    f = adl.open(file, 'rb') # 'file is parquet file with path of parquet file folder_a/folder_b/parquet_file1'
    table = pq.read_table(f)

    How do we proceed with gen2 storage, we are stuck at this point

    http://peter-hoffmann.com/2020/azure-data-lake-storage-gen-2-with-python.html is the link that we have followed.

    Note - We are not using databrick to do this

    Any help will be appreciated
    Laurent Mazuel

    Hi @qaiser21 , did you check the samples folder on the repo?

    I don't have Storage representative that I can easily talk to Gitter, if we are missing a sample, could you create a bug on Github? https://github.com/Azure/azure-sdk-for-python/issues

    Dear ALL;
    when azure SDK for python update
    how to we can fixed the old API and example
    we found our old productuon code can't work when SDK
    update ?
    appreciate Thanks
    where we can find the latest sample ?
    5 replies

    Hi !

    I would like to produce custom metric from python code

    I dont find example or documentation for AZURE ( it's very easy for aws -> https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html )

    Could you help me find an exemple ?

    thank you !!!!

    Ivan Trusov


    I'm trying to use AzureDatabricksLinkedService from azure-mgmt-datafactory==1.0.0 package.

    I've met two problems:

    1. No MSI authentication supported.
    2. When I'm trying to create a new linked service, I receive the following error:
      azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'
      It's hard to understand the exact problem via this error message.

    Any advisory on these issues would be really appreciated.

    Juan Ramos
    Hi there, do you guys know if this command: az storage queue create, creates an queue if doesn't exist or recreates it
    Kannadasan S
    Hi, I am trying to use apim python module to automate api creation in apim, but i am getting an error, Could any one help on this?
       self._token = self._credential.get_token(*self._scopes)
    AttributeError: 'AzureSasCredential' object has no attribute 'get_token'
    credentials = AzureSasCredential(sas)
    apim_client = ApiManagementClient(credential=credentials, subscription_id=subscription_id, base_url=base_url)
    api_operation_operations = apim_client.api_operation.create_or_update(resource_group_name=resource_group_name, service_name=service_name,
                                                api_id=api_id, operation_id=operation_id, parameters=operation_contract)
    Laurent Mazuel
    Hi @Kannadasan89 , can you tell us where you get AzureSasCredential from? You must use credentials from azure-identity: https://pypi.org/project/azure-identity/
    Ashok Rawat

    Hi Everyone,
    I seems to be facing an issue with creating a managed_disk or snapshot from scratch disk of a VM, using begin_create_or_update function and am getting the following error:

    Error message was: Unable to build a model: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get', DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'

    I have seen a similar error to this earlier last year on this forum. Are they related or is this specific to each entity on Azure?


    Can't get the subnet id of azure using python
    HttpResponseError: (InvalidApiVersionParameter) The api-version '2021-02-01' is invalid
    try other versions as well
    Hi, anyone know where I can find the list of models ( NN) use it for azure.cognitiveservices.vision.customvision.training.models ? I 'm looking for into the file "azure.cognitiveservices.vision.customvision.training.models"
    Michael Butak
    Hi all, I used the azure sdk for python in the past, but never for creating subscriptions. Is that a supported function of the sdk? I have been searching for docs or examples and most of the links on the topic are broken. Any pointers? Thanks!
    Yizhak Orfanian
    I use the azure python SDK to automate deployment, I use the blobserviceclient start_copy_from_url, the issue is that he request put the destination file in pending. is there a way to check if the blob was copied and ready?
    Yiming Lei
    @mikebutak As the basic credentials for azure SDK, you may prefer to create subscriptions manually on azure-portal
    Hi @jk35:matrix.org , can you describe in more detail the package name and version you use?

    Hey guys, I'm trying to start using the Entity Tag feature to ensure our transactions are properly isolated. I've been trying to use the documentation at https://azuresdkdocs.blob.core.windows.net/$web/python/azure-cosmos/4.0.0/azure.cosmos.html#azure.cosmos.container.ContainerProxy.replace_item and it defines an etag keyword argument and a match_condition argument. The match_condition argument must apparently be present when the etag argument is present, and takes an azure.core.MatchConditions enum (an int from 1-5...).

    Unfortunately, I can't find any documentation on what the various MatchConditions options actually do...

    There is a page that describes the enum (https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/1.1.1/azure.core.html#azure.core.MatchConditions) but it doesn't elaborate on what IfMissing, IfModified etc. actually mean.

    To make matters murkier, I tried simply using the IfPresent value just to see what would happen, and got a completely unexpected exception: TypeError("request() got an unexpected keyword argument 'etag'"), which doesn't make any sense: why would the etag be unexpected in this case?

    Can anyone shed some light on this?

    Michael Butak


    I'm trying to get started with the azure.mgmt.logic library. When I run the script I get ValueError: Invalid tenant id provided. You can locate your tenant id by following the instructions here: https://docs.microsoft.com/partner-center/find-ids-and-domain-names. However, I am quite confident my tenant id is correct. I'm using it elsewhere and I've doublechecked no trailing spaces, etc. in the env var it's stored in. Any pointers?