快速入门:使用 ARM 模板创建 Azure Databricks 工作区Quickstart: Create an Azure Databricks workspace by using an ARM template

在本快速入门中,你将使用 Azure 资源管理器模板(ARM 模板)创建 Azure Databricks 工作区。In this quickstart, you use an Azure Resource Manager template (ARM template) to create an Azure Databricks workspace. 创建工作区后,将验证部署。Once the workspace is created, you validate the deployment.

ARM 模板是定义项目基础结构和配置的 JavaScript 对象表示法 (JSON) 文件。An ARM template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. 该模板使用声明性语法,使你可以声明要部署的内容,而不需要编写一系列编程命令来进行创建。The template uses declarative syntax, which lets you state what you intend to deploy without having to write the sequence of programming commands to create it.

如果你的环境满足先决条件,并且你熟悉如何使用 ARM 模板,请选择“部署到 Azure”按钮。If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button. Azure 门户中会打开模板。The template will open in the Azure portal.

部署到 AzureDeploy to Azure

先决条件Prerequisites

若要完成本文,需要做好以下准备:To complete this article, you need to:

备注

如果要在持有美国政府合规性认证(如 FedRAMP High)的 Azure 商业云中创建 Azure Databricks 工作区,请联系你的 Microsoft 代表或 Databricks 代表以获得这种体验的访问权限。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 Microsoft or Databricks representative to gain access to this experience.

查看模板Review the template

本快速入门中使用的模板来自 Azure 快速启动模板The template used in this quickstart is from Azure Quickstart Templates.

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "disablePublicIp": {
      "type": "bool",
      "defaultValue": false,
      "metadata": {
        "description": "Specifies whether to deploy Azure Databricks workspace with Secure Cluster Connectivity (No Public IP) enabled or not"
      }
    },
    "workspaceName": {
      "type": "string",
      "metadata": {
        "description": "The name of the Azure Databricks workspace to create."
      }
    },
    "pricingTier": {
      "type": "string",
      "defaultValue": "premium",
      "allowedValues": [
        "standard",
        "premium"
      ],
      "metadata": {
        "description": "The pricing tier of workspace."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    }    
  },
  "variables": {
    "managedResourceGroupName": "[concat('databricks-rg-', parameters('workspaceName'), '-', uniqueString(parameters('workspaceName'), resourceGroup().id))]"
  },
  "resources": [
    {
      "type": "Microsoft.Databricks/workspaces",
      "apiVersion": "2018-04-01",
      "name": "[parameters('workspaceName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "[parameters('pricingTier')]"
      },
      "properties": {
        "managedResourceGroupId": "[subscriptionResourceId('Microsoft.Resources/resourceGroups', variables('managedResourceGroupName'))]",
        "parameters": {
          "enableNoPublicIp": {
            "value": "[parameters('disablePublicIp')]"

模板中定义的 Azure 资源是 Microsoft.Databricks/workspaces:创建 Azure Databricks 工作区。The Azure resource defined in the template is Microsoft.Databricks/workspaces: create an Azure Databricks workspace.

部署模板Deploy the template

在本部分,你将使用 ARM 模板创建 Azure Databricks 工作区。In this section, you create an Azure Databricks workspace using an ARM template.

  1. 选择下图登录到 Azure 并打开一个模板。Select the following image to sign in to Azure and open a template. 模板将创建 Azure Databricks 工作区。The template creates an Azure Databricks workspace.

    部署到 AzureDeploy to Azure

  2. <span data-ttu-id="a484b-123">提供所需的值以创建 Azure Databricks 工作区Provide the required values to create your Azure Databricks workspace

    ![使用 Azure 资源管理器模板创建 Azure Databricks 工作区](./media/quickstart-create-databricks-workspace-resource-manager-template/create-databricks-workspace-using-resource-manager-template.png "使用 Azure 资源管理器模板创建 Azure Databricks 工作区")Create Azure Databricks workspace using an Azure Resource Manager template

    提供以下值:Provide the following values:

    属性Property 描述Description
    订阅Subscription 从下拉列表中选择自己的 Azure 订阅。From the drop-down, select your Azure subscription.
    资源组Resource group 指定是要创建新的资源组还是使用现有的资源组。Specify whether you want to create a new resource group or use an existing one. 资源组是用于保存 Azure 解决方案相关资源的容器。A resource group is a container that holds related resources for an Azure solution. 有关详细信息,请参阅 Azure 资源组概述For more information, see Azure Resource Group overview.
    位置Location 选择“美国东部 2”。 Select East US 2. 有关其他可用区域,请参阅各区域推出的 Azure 服务For other available regions, see Azure services available by region.
    工作区名称Workspace name 提供 Databricks 工作区的名称Provide a name for your Databricks workspace
    定价层Pricing Tier 选择“标准”或“高级”。 Choose between Standard or Premium. 有关这些层的详细信息,请参阅 Databricks 价格页For more information on these tiers, see Databricks pricing page.
  3. 选择“查看 + 创建”,然后选择“创建” 。Select Review + Create, then Create.

  4. 创建工作区需要几分钟时间。The workspace creation takes a few minutes. 当工作区部署失败时,仍然会在失败状态下创建工作区。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.

查看已部署的资源Review deployed resources

可以使用 Azure 门户检查 Azure Databricks 工作区,或者使用以下 Azure CLI 或 Azure PowerShell 脚本来列出资源。You can either use the Azure portal to check the Azure Databricks workspace or use the following Azure CLI or Azure PowerShell script to list the resource.

Azure CLIAzure CLI

echo "Enter your Azure Databricks workspace name:" &&
read databricksWorkspaceName &&
echo "Enter the resource group where the Azure Databricks workspace exists:" &&
read resourcegroupName &&
az databricks workspace show -g $resourcegroupName -n $databricksWorkspaceName

Azure PowerShellAzure PowerShell

$resourceGroupName = Read-Host -Prompt "Enter the resource group name where your Azure Databricks workspace exists"
(Get-AzResource -ResourceType "Microsoft.Databricks/workspaces" -ResourceGroupName $resourceGroupName).Name
 Write-Host "Press [ENTER] to continue..."

清理资源Clean up resources

如果打算继续学习后续教程,可能需要保留这些资源。If you plan to continue on to subsequent tutorials, you may wish to leave these resources in place. 如果不再需要资源组,可以将其删除,这将删除 Azure Databricks 工作区和相关的受管理资源。When no longer needed, delete the resource group, which deletes the Azure Databricks workspace and the related managed resources. 使用 Azure CLI 或 Azure PowerShell 删除资源组:To delete the resource group by using Azure CLI or Azure PowerShell:

Azure CLIAzure CLI

echo "Enter the Resource Group name:" &&
read resourceGroupName &&
az group delete --name $resourceGroupName &&
echo "Press [ENTER] to continue ..."

Azure PowerShellAzure PowerShell

$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
Remove-AzResourceGroup -Name $resourceGroupName
Write-Host "Press [ENTER] to continue..."

后续步骤Next steps

在本快速入门中,你使用 ARM 模板创建了 Azure Databricks 工作区,并验证了部署。In this quickstart, you created an Azure Databricks workspace by using an ARM template and validated the deployment. 请继续学习下一篇文章,了解如何使用 Azure Databricks 执行 ETL(提取、转换和加载数据)操作。Advance to the next article to learn how to perform an ETL operation (extract, transform, and load data) using Azure Databricks.