Share via


Distribuera en arbetsyta med Bicep

Den här artikeln beskriver hur du skapar en Azure Databricks-arbetsyta med Bicep.

Bicep är ett domänspecifikt språk (DSL) som använder deklarativ syntax för att distribuera Azure-resurser. Det ger koncis syntax, tillförlitlig typsäkerhet och stöd för återanvändning av kod. Bicep erbjuder den bästa redigeringsupplevelsen för dina infrastruktur-som-kod-lösningar i Azure.

Granska Bicep-filen

Bicep-filen som används i den här snabbstarten kommer från Azure-snabbstartsmallar.

@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

Azure-resursen som definieras i Bicep-filen är Microsoft.Databricks/workspaces: skapa en Azure Databricks-arbetsyta.

Distribuera Bicep-filen

  • Spara Bicep-filen som main.bicep på den lokala datorn.
  • Distribuera Bicep-filen med antingen Azure CLI eller Azure PowerShell.

CLI

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

PowerShell

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

Kommentar

Ersätt <workspace-name> med namnet på den Azure Databricks-arbetsyta som du vill skapa.

När distributionen är klar bör du se ett meddelande som anger att distributionen lyckades.

Granska distribuerade resurser

Använd Azure-portalen, Azure CLI eller Azure PowerShell för att lista de distribuerade resurserna i resursgruppen.

CLI

az resource list --resource-group exampleRG

PowerShell

Get-AzResource -ResourceGroupName exampleRG