你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

快速入门:使用 ARM 模板创建 Azure Synapse Analytics 专用 SQL 池(之前称为 SQL DW)

使用此 Azure 资源管理器模板(ARM 模板)创建专用 SQL 池(之前称为 SQL DW),并启用透明数据加密。 专用 SQL 池(之前称为 SQL DW)是指 Azure Synapse 中正式发布的企业数据仓库功能。

Azure 资源管理器模板是定义项目基础结构和配置的 JavaScript 对象表示法 (JSON) 文件。 模板使用声明性语法。 你可以在不编写用于创建部署的编程命令序列的情况下,描述预期部署。

如果你的环境满足先决条件,并且你熟悉如何使用 ARM 模板,请选择“部署到 Azure”按钮。 Azure 门户中会打开模板。

Button to deploy the Resource Manager template to Azure.

先决条件

如果没有 Azure 订阅,请在开始之前创建一个免费帐户

查看模板

本快速入门中使用的模板来自 Azure 快速启动模板

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.26.54.24096",
      "templateHash": "15855786620646717380"
    }
  },
  "parameters": {
    "sqlServerName": {
      "type": "string",
      "defaultValue": "[format('sql{0}', uniqueString(resourceGroup().id))]",
      "metadata": {
        "description": "The SQL Logical Server name."
      }
    },
    "sqlAdministratorLogin": {
      "type": "string",
      "metadata": {
        "description": "The administrator username of the SQL Server."
      }
    },
    "sqlAdministratorPassword": {
      "type": "securestring",
      "metadata": {
        "description": "The administrator password of the SQL Server."
      }
    },
    "databasesName": {
      "type": "string",
      "metadata": {
        "description": "The name of the Database."
      }
    },
    "transparentDataEncryption": {
      "type": "string",
      "defaultValue": "Enabled",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ],
      "metadata": {
        "description": "Enable/Disable Transparent Data Encryption"
      }
    },
    "capacity": {
      "type": "int",
      "minValue": 900,
      "maxValue": 54000,
      "metadata": {
        "description": "DW Performance Level expressed in DTU (i.e. 900 DTU = DW100c)"
      }
    },
    "databaseCollation": {
      "type": "string",
      "defaultValue": "SQL_Latin1_General_CP1_CI_AS",
      "metadata": {
        "description": "The SQL Database collation."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Resource location"
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Sql/servers",
      "apiVersion": "2023-08-01-preview",
      "name": "[parameters('sqlServerName')]",
      "location": "[parameters('location')]",
      "properties": {
        "administratorLogin": "[parameters('sqlAdministratorLogin')]",
        "administratorLoginPassword": "[parameters('sqlAdministratorPassword')]",
        "version": "12.0",
        "publicNetworkAccess": "Enabled",
        "minimalTlsVersion": "1.2",
        "restrictOutboundNetworkAccess": "Disabled"
      }
    },
    {
      "type": "Microsoft.Sql/servers/databases",
      "apiVersion": "2023-08-01-preview",
      "name": "[format('{0}/{1}', parameters('sqlServerName'), parameters('databasesName'))]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "DataWarehouse",
        "tier": "DataWarehouse",
        "capacity": "[parameters('capacity')]"
      },
      "properties": {
        "collation": "[parameters('databaseCollation')]",
        "catalogCollation": "[parameters('databaseCollation')]",
        "readScale": "Disabled",
        "requestedBackupStorageRedundancy": "Geo",
        "isLedgerOn": false
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
      ]
    },
    {
      "type": "Microsoft.Sql/servers/databases/transparentDataEncryption",
      "apiVersion": "2023-08-01-preview",
      "name": "[format('{0}/{1}/{2}', parameters('sqlServerName'), parameters('databasesName'), 'current')]",
      "properties": {
        "state": "[parameters('transparentDataEncryption')]"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers/databases', parameters('sqlServerName'), parameters('databasesName'))]"
      ]
    },
    {
      "type": "Microsoft.Sql/servers/securityAlertPolicies",
      "apiVersion": "2023-08-01-preview",
      "name": "[format('{0}/{1}', parameters('sqlServerName'), 'default')]",
      "properties": {
        "state": "Enabled"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
      ]
    },
    {
      "type": "Microsoft.Sql/servers/auditingSettings",
      "apiVersion": "2023-08-01-preview",
      "name": "[format('{0}/{1}', parameters('sqlServerName'), 'default')]",
      "properties": {
        "isAzureMonitorTargetEnabled": true,
        "state": "Enabled",
        "retentionDays": 7,
        "auditActionsAndGroups": [
          "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP",
          "FAILED_DATABASE_AUTHENTICATION_GROUP",
          "BATCH_COMPLETED_GROUP"
        ]
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
      ]
    }
  ],
  "outputs": {
    "location": {
      "type": "string",
      "value": "[parameters('location')]"
    },
    "name": {
      "type": "string",
      "value": "[parameters('sqlServerName')]"
    },
    "resourceGroupName": {
      "type": "string",
      "value": "[resourceGroup().name]"
    },
    "resourceId": {
      "type": "string",
      "value": "[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
    }
  }
}

该模板定义一个资源:

部署模板

  1. 选择下图登录到 Azure 并打开模板。 此模板可创建专用 SQL 池(之前称为 SQL DW)。

    Button to deploy the Resource Manager template to Azure.

  2. 输入或更新以下值:

    • 订阅:选择 Azure 订阅。
    • 资源组: 选择“新建”,输入资源组的唯一名称,然后选择“确定”。 新的资源组会促进资源清理。
    • 区域:选择区域。 例如“美国中部”。
    • SQL Server 名称:接受默认名称,或为 SQL Server 名称输入新名称。
    • SQL 管理员登录:输入 SQL Server 的管理员用户名。
    • SQL 管理员密码:输入 SQL Server 的管理员密码。
    • 数据仓库名称:输入专用 SQL 池名称。
    • 透明数据加密:接受默认值“已启用”。
    • 服务级别目标:接受默认值“DW400c”。
    • 位置:接受资源组的默认位置。
    • 审阅并创建:选中。
    • 创建:选中。

查看已部署的资源

可以使用 Azure 门户来检查已部署的资源,也可以使用 Azure CLI 或 Azure PowerShell 脚本列出已部署的资源。

echo "Enter the resource group where your dedicated SQL pool (formerly SQL DW) exists:" &&
read resourcegroupName &&
az resource list --resource-group $resourcegroupName

清理资源

不再需要时,可使用 Azure CLI 或 Azure PowerShell 删除资源组:

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

后续步骤

在本快速入门中,你使用 ARM 模板创建了专用 SQL 池(之前称为 SQL DW),并验证了部署。 若要详细了解 Azure Synapse Analytics 和 Azure 资源管理器,请参阅以下文章。