Share via


Een werkruimte implementeren met Bicep

In dit artikel wordt uitgelegd hoe u een Azure Databricks-werkruimte maakt met Bicep.

Bicep is een domeinspecifieke taal (DSL) die declaratieve syntaxis gebruikt om Azure-resources te implementeren. Deze taal voorziet in een beknopte syntaxis, betrouwbare typeveiligheid en ondersteuning voor hergebruik van code. Bicep biedt de beste ontwerpervaring voor uw infrastructuur als code-oplossingen in Azure.

Het Bicep-bestand controleren

Het Bicep-bestand dat in deze quickstart wordt gebruikt, is afkomstig van Azure-quickstartsjablonen.

@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

De Azure-resource die in het Bicep-bestand is gedefinieerd, is Microsoft.Databricks/workspaces: maak een Azure Databricks-werkruimte.

Het Bicep-bestand implementeren

  • Sla het Bicep-bestand op als main.bicep op uw lokale computer.
  • Implementeer het Bicep-bestand met behulp van Azure CLI of 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>"

Notitie

Vervang <workspace-name> door de naam van de Azure Databricks-werkruimte die u wilt maken.

Wanneer de implementatie is voltooid, ziet u een bericht waarin wordt aangegeven dat de implementatie is voltooid.

Geïmplementeerde resources bekijken

Gebruik Azure Portal, Azure CLI of Azure PowerShell om de geïmplementeerde resources in de resourcegroep weer te geven.

CLI

az resource list --resource-group exampleRG

PowerShell

Get-AzResource -ResourceGroupName exampleRG