Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Hypernx
    @Hypernx1_twitter
    i need an azure function to my cosmos db but apparently you can only do that with c# or js not python
    Hypernx
    @Hypernx1_twitter
    so is it possible to do it in python
    Laurent Mazuel
    @lmazuel

    Hello! I've recently faced with deadlock in azure-core aio library. It seems, that here https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/azure/core/pipeline/policies/_authentication_async.py#L24 must be asyncio.Lock. Why is threading.Lock used there?

    I see you opened an issue Azure/azure-sdk-for-python#11543, thanks for that :). We confirm it and Charles is working on it. Should be released part of azure-core 1.6.0 next week

    @Hypernx1_twitter I'm not sure I understand what you meahn, if you mean using CosmosDB Python SDK from Function, that should work
    Hypernx
    @Hypernx1_twitter
    ok thanks
    Hermes Lapa
    @hlapa
    Hello, I'm trying to control the throughput of an cosmosDB container, I'm using the azure python sdk for cosmos. And after following the steps listed in https://github.com/Azure/azure-cosmos-python, the funtion QuerryOffers is not found in the installed package, there's a problem in a the package ?
    annatisch
    @annatisch
    Hi @hlapa - it looks like you're seeing the samples from the previous SDK, as that repo URL is now deprecated. You can find the latest Cosmos Python SDK being developed here:
    https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/cosmos/azure-cosmos
    In addition, you can find a sample in that repo demonstrating creating a container with the offer_throughput parameter here:
    https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/cosmos/azure-cosmos/samples/container_management.py#L114
    Michael Butak
    @mikebutak
    Hello, looking for docs/examples on how to provision a databricks service. I can only find sparse info here: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-mgmt-databricks/0.1.0/azure.mgmt.databricks.html. Any pointers or examples you know of? I can create the client just fine, not sure how to create the service. @lmazuel
    Michael Butak
    @mikebutak

    @lmazuel I noticed on S.O. you mentioned that one can use the client to provide the serializer and deserializer arguments for instantiating in the python sdk. Do you have any guidance or references on how to do that?

    code:
    databricks_operations = WorkspacesOperations(client_obj.client)
    Output:
    TypeError: __init__() missing 3 required positional arguments: 'config', 'serializer', and 'deserializer'

    Laurent Mazuel
    @lmazuel
    Hi @mikebutak , yes you need to create a databrick client, and workspaces will be attached to it
    client = DatabricksClient(credentials, subscription_id)
    workspace = client.workspaces.get(resource_group_name, workspace_name)
    workspaces is an instance of WorkspacesOperations attached to the client
    Laurent Mazuel
    @lmazuel
    I saw your stack overflow question, I don't think creating a service without a workspace is even possible, trying to create databricks service on the portal, you will see workspace name is required as well
    so using the SDK I would look at the doc for client.workspaces.create_or_update
    Michael Butak
    @mikebutak
    Thank you @lmazuel !!
    Michael Butak
    @mikebutak
    If I may, @lmazuel : I assume that since workspaces is an instance of WorkspacesOperations that client.workspaces.create_or_update (not found in online searches) is the same as azure.mgmt.databricks.operations.WorkspacesOperations.create_or_update (found here: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-mgmt-databricks/0.1.0/azure.mgmt.databricks.operations.html#azure.mgmt.databricks.operations.WorkspacesOperations). If so, these docs indicate that the first argument required for create_or_update is parameters. This parameters argument is not clear to me. It appears to be an instance of azure.mgmt.databricks.models.workspace. But that can't be since this method is actually where I create a workspace, no? Do you have any input on what to provide for parameters? Thank you very much!
    Laurent Mazuel
    @lmazuel
    @mikebutak you need to create a Workspace instance, and provide it as parameter. https://azuresdkdocs.blob.core.windows.net/$web/python/azure-mgmt-databricks/0.1.0/azure.mgmt.databricks.models.html#azure.mgmt.databricks.models.Workspace
    Indeed, this doens't yet exist, and the best name would probably have been WorkspaceParameters. The two required parameters are location and managed_resource_group_id. For instance Workspace(location='westus', managed_resource_group_id='put your id')
    I'm unfortunately not an expert in this particular service, for more specific details I would suggest you open a Github issue on our tracker, so I can tag explicitly the databricks team on it for insights
    Michael Butak
    @mikebutak
    @lmazuel Thank you for your helpful input! I'll open an issue if I can't sort it out.
    Michael Butak
    @mikebutak

    @lmazuel I received an answer from Microsoft engineers, in case you're interested:

    "...neither the Python SDK nor the REST API support the creation of Azure Databricks services / workspaces at this time.

    You can create an Azure Databricks workspace by using an ARM template. This is a JSON file that defines the infrastructure and configuration for your project.

    https://docs.microsoft.com/en-us/azure/databricks/scenarios/quickstart-create-databricks-workspace-resource-manager-template

    You can deploy resources with ARM templates and Resource Manager REST API https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-rest

    You can also deploy an ARM template is by using one of the following options

    o Install Azure PowerShell
    o Install Azure CLI on Windows / Linux or macOS.

    Documentation on these two options can be found here https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-create-first-template?tabs=azure-powershell#command-line-deployment"

    I'm going to pursue using the Resource manager REST API.
    Laurent Mazuel
    @lmazuel
    I believe this engineer is wrong :(. ARM template are just aliases to RestAPI. We can easily translate the ARM template he gave you (which is very helpful!) into SDK calls:
    client.workspaces.create_or_update(
        {
            "managed_resource_group_id":  "<subscritpion_id_to_replace>/resourceGroups/"+managedResourceGroupName,
            "sku": {"name":"premium"},
            "location":"westus"
        },
        resource_group_name,
        workspace_name
    ).wait() # wait for completion
    That being said, since ARM template and SDK can express the same thing, indeed sing ARM template and Resource manager package would work. https://github.com/Azure-Samples/resource-manager-python-template-deployment
    Michael Butak
    @mikebutak
    THANKS @lmazuel ! I'm attempting the translated SDK call you provided above.
    Michael Butak
    @mikebutak
    @lmazuel one small tweak to your code, and it works!
    Michael Butak
    @mikebutak

    Change "managed_resource_group_id": "<subscritpion_id_to_replace>/resourceGroups/"+managedResourceGroupName

    to

    "managedResourceGroupId": "/subscriptions/{subscription_id_to_replace}/resourceGroups/{managedResourceGroupName}"

    Note the changes both before and after the colon
    Laurent Mazuel
    @lmazuel
    Nice :)
    asp asp
    @onenessboy_gitlab
    is there any way to configure azure backup via python sdk ? need some example pls
    asp asp
    @onenessboy_gitlab
    and also needed a way to fetch logs/events details of azure vm via python sdk ? any references will be helpful thanks
    asp asp
    @onenessboy_gitlab
    I mean to say activity log information
    Laurent Mazuel
    @lmazuel
    For backup, I saw you created a Github issue, please monitor there since I tagged the team responsible for that
    asp asp
    @onenessboy_gitlab
    @lmazuel Thank your for links and Github issue attention. Activity log shall give a try and shall wait for python sdk for taking azure backup :)
    at matter of suggestion, really would be happy to see more examples on related to python sdk, I see there are lot of REST API to get information what I need, but would like to see pythonic way :) This is just a suggestion, would love to use more python sdk for information analytics for our various reports
    asp asp
    @onenessboy_gitlab
    @lmazuel while i do python sdk for activity log its keep saying this error though i am giving range in correct time format explained in documentation $filter=eventTimestamp is not supported.
    need some guidance on this error..
    Laurent Mazuel
    @lmazuel
    I tagged the service team on your issue for ActivityLog :)
    asp asp
    @onenessboy_gitlab
    thank you @lmazuel
    asp asp
    @onenessboy_gitlab
    @lmazuel i have updated my sample code which i tried, now i am able to get logs, the issue is filter is not working and also the json output from that REST API is not parsable. Hope i will get some solution for this
    asp asp
    @onenessboy_gitlab
    @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
    @onenessboy_gitlab
    However thanks for help :) learning a bit towards automation :)
    Laurent Mazuel
    @lmazuel
    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
    @onenessboy_gitlab
    @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
    @lmazuel
    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
    @onenessboy_gitlab
    @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..
    tomarv2
    @tomarv2
    running this as per example:
            # check if name is available
            availability = storage_client.storage_accounts.check_name_availability("storage_account_name")