Deploy a workspace with PowerShell

This article explains how to create an Azure Databricks workspace using Powershell.

If you choose to use PowerShell locally, this article requires that you install the Az PowerShell module and connect to your Azure account using the Connect-AzAccount -Environment AzureChinaCloud cmdlet. For more information about installing the Az PowerShell module, see Install Azure PowerShell.

To connect to your Azure account as a user, see PowerShell login with an Azure Databricks user account. To connect to your Azure account as a service principal, see PowerShell login with a Microsoft Entra ID service principal.

Note

If you want to create an Azure Databricks workspace in the Azure Commercial Cloud that holds US Government compliance certifications like FedRAMP High, please reach out to your Azure or Azure Databricks account team to gain access to this experience.

If this is your first time using Azure Databricks, you must register the Microsoft.Databricks resource provider.

Register-AzResourceProvider -ProviderNamespace Microsoft.Databricks

If you have multiple Azure subscriptions, choose the appropriate subscription in which the resources should be billed. Select a specific subscription ID using the Set-AzContext cmdlet.

Set-AzContext -SubscriptionId 00000000-0000-0000-0000-000000000000

Create a resource group

Create an Azure resource group using the New-AzResourceGroup cmdlet. A resource group is a logical container in which Azure resources are deployed and managed as a group.

The following example creates a resource group named myresourcegroup in the China East 2 region.

New-AzResourceGroup -Name myresourcegroup -Location chinaeast2

Create an Azure Databricks workspace

In this section, you create an Azure Databricks workspace using PowerShell.

New-AzDatabricksWorkspace -Name mydatabricksws -ResourceGroupName myresourcegroup -Location chinaeast2 -ManagedResourceGroupName databricks-group -Sku standard

Provide the following values:

Property Description
Name Provide a name for your Databricks workspace
ResourceGroupName Specify an existing resource group name
Location Select China East 2. For other available regions, see Azure services available by region
ManagedResourceGroupName Specify whether you want to create a new managed resource group or use an existing one.
Sku Choose between Standard, Premium, or Trial. For more information on these tiers, see Databricks pricing

The workspace creation takes a few minutes. Once this process is finished, your user account is automatically added as an admin user in the workspace.

Note

When a workspace deployment fails, the workspace is still created in a failed state. Delete the failed workspace and create a new workspace that resolves the deployment errors. When you delete the failed workspace, the managed resource group and any successfully deployed resources are also deleted.

Determine the provisioning state of a Databricks workspace

To determine if a Databricks workspace was provisioned successfully, you can use the Get-AzDatabricksWorkspace cmdlet.

Get-AzDatabricksWorkspace -Name mydatabricksws -ResourceGroupName myresourcegroup |
  Select-Object -Property Name, SkuName, Location, ProvisioningState
Name            SkuName   Location  ProvisioningState
----            -------   --------  -----------------
mydatabricksws  standard  chinaeast2   Succeeded