Deploy a workspace with Bicep

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

Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.

Review the Bicep file

The Bicep file used in this quickstart is from Azure Quickstart Templates.

@description('Specifies whether to deploy Azure Databricks workspace with Secure Cluster Connectivity (No Public IP) enabled or not')
param disablePublicIp bool = false

@description('The name of the Azure Databricks workspace to create.')
param workspaceName string

@description('The pricing tier of workspace.')
@allowed([
  'standard'
  'premium'
])
param pricingTier string = 'premium'

@description('Location for all resources.')
param location string = resourceGroup().location

var managedResourceGroupName = 'databricks-rg-${workspaceName}-${uniqueString(workspaceName, resourceGroup().id)}'

resource ws 'Microsoft.Databricks/workspaces@2018-04-01' = {
  name: workspaceName
  location: location
  sku: {
    name: pricingTier
  }
  properties: {
    managedResourceGroupId: managedResourceGroup.id
    parameters: {
      enableNoPublicIp: {
        value: disablePublicIp
      }
    }
  }
}

resource managedResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
  scope: subscription()
  name: managedResourceGroupName
}

output workspace object = ws.properties

The Azure resource defined in the Bicep file is Microsoft.Databricks/workspaces: create an Azure Databricks workspace.

Deploy the Bicep file

  • Save the Bicep file as main.bicep to your local computer.
  • Deploy the Bicep file using either Azure CLI or Azure PowerShell.

CLI

az group create --name exampleRG --location chinaeast2
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters workspaceName=<workspace-name>

PowerShell

New-AzResourceGroup -Name exampleRG -Location chinaeast2
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -workspaceName "<workspace-name>"

Note

Replace <workspace-name> with the name of the Azure Databricks workspace you want to create.

When the deployment finishes, you should see a message indicating the deployment succeeded.

Review deployed resources

Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.

CLI

az resource list --resource-group exampleRG

PowerShell

Get-AzResource -ResourceGroupName exampleRG