Menyebarkan ruang kerja dengan Bicep
Artikel ini menjelaskan cara membuat ruang kerja Azure Databricks menggunakan Bicep.
Bicep adalah bahasa pemrogram khusus domain (DSL) yang menggunakan sintaks deklaratif untuk menyebarkan sumber daya Azure. Bicep menyediakan sintaks ringkas, keamanan jenis yang andal, dan dukungan untuk penggunaan kembali kode. Bicep menawarkan pengalaman penulisan terbaik untuk solusi infrastructure-as-code di Azure.
Tinjau file Bicep
File Bicep yang digunakan dalam mulai cepat berasal dari Templat Mulai Cepat Azure.
@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
Sumber daya Azure yang ditentukan dalam file Bicep adalah Microsoft.Databricks/workspaces: membuat ruang kerja Azure Databricks.
Menerapkan file Bicep
- Simpan file Bicep sebagai main.bicep ke penyimpanan lokal komputer Anda.
- Sebarkan file Bicep menggunakan Azure CLI atau 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>"
Catatan
Ganti <workspace-name>
dengan nama ruang kerja Azure Databricks yang ingin Anda buat.
Setelah penyebaran selesai, Anda akan melihat pesan yang menunjukkan penyebaran berhasil.
Meninjau sumber daya yang disebarkan
Gunakan portal Microsoft Azure, Azure CLI, atau Azure PowerShell untuk mencantumkan sumber daya yang disebarkan di grup sumber daya.
CLI
az resource list --resource-group exampleRG
PowerShell
Get-AzResource -ResourceGroupName exampleRG