How to use the Azure Python SDK to provision a Databricks service?

后端 未结 2 471
臣服心动
臣服心动 2021-01-26 17:39

[Previously in this post I asked how to provision a databricks services without any workspace. Now I\'m asking how to provision a service with a workspace as the first scenario

相关标签:
2条回答
  • 2021-01-26 18:08

    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)
    

    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

    (I work at MS in the SDK team)

    0 讨论(0)
  • 2021-01-26 18:10

    with help from @Laurent Mazuel and support engineers at Microsoft, I have a solution:

    managed_resource_group_ID = ("/subscriptions/"+sub_id+"/resourceGroups/"+managed_rg_name)
    client = DatabricksClient(credentials, subscription_id)
    workspace_obj = client.workspaces.get(rg_name, databricks_workspace_name)
    client.workspaces.create_or_update(
        {
            "managedResourceGroupId": managed_resource_group_ID,
            "sku": {"name":"premium"},
            "location":location
        },
        rg_name,
        databricks_workspace_name
    ).wait()
    
    0 讨论(0)
提交回复
热议问题