快速入门:创建服务器 - Bicep

本快速入门介绍如何通过使用 Bicep 在 Azure 订阅中创建 Analysis Services 服务器资源。

Bicep 是一种特定于域的语言 (DSL),使用声明性语法来部署 Azure 资源。 它提供简明的语法、可靠的类型安全性以及对代码重用的支持。 Bicep 会针对你的 Azure 基础结构即代码解决方案提供最佳创作体验。

先决条件

  • Azure 订阅:访问 Azure 试用版订阅以创建帐户。
  • Microsoft Entra ID:订阅必须与 Microsoft Entra 租户相关联。 并且,你需要使用该 Microsoft Entra ID 中的帐户登录到 Azure。 若要了解详细信息,请参阅身份验证和用户权限

查阅 Bicep 文件

本快速入门中使用的 Bicep 文件来自 Azure 快速入门模板

@description('The name of the Azure Analysis Services server to create. Server name must begin with a letter, be lowercase alphanumeric, and between 3 and 63 characters in length. Server name must be unique per region.')
param serverName string

@description('Location of the Azure Analysis Services server. For supported regions, see https://docs.azure.cn/analysis-services/analysis-services-overview#availability-by-region')
param location string = resourceGroup().location

@description('The sku name of the Azure Analysis Services server to create. Choose from: B1, B2, S0, S1, S2, S3, S4, S8v2, S9v2. Some skus are region specific. See https://docs.azure.cn/analysis-services/analysis-services-overview#availability-by-region')
param skuName string = 'S0'

@description('The total number of query replica scale-out instances. Scale-out of more than one instance is supported on selected regions only. See https://docs.azure.cn/analysis-services/analysis-services-overview#availability-by-region')
param capacity int = 1

@description('The inbound firewall rules to define on the server. If not specified, firewall is disabled.')
param firewallSettings object = {
  firewallRules: [
    {
      firewallRuleName: 'AllowFromAll'
      rangeStart: '0.0.0.0'
      rangeEnd: '255.255.255.255'
    }
  ]
  enablePowerBIService: true
}

@description('The SAS URI to a private Azure Blob Storage container with read, write and list permissions. Required only if you intend to use the backup/restore functionality. See https://docs.azure.cn/analysis-services/analysis-services-backup')
param backupBlobContainerUri string = ''

resource server 'Microsoft.AnalysisServices/servers@2017-08-01' = {
  name: serverName
  location: location
  sku: {
    name: skuName
    capacity: capacity
  }
  properties: {
    ipV4FirewallSettings: firewallSettings
    backupBlobContainerUri: backupBlobContainerUri
  }
}

该 Bicep 文件中定义了一个包含防火墙规则的 Microsoft.AnalysisServices/servers 资源。

部署 Bicep 文件

  1. 将该 Bicep 文件另存为本地计算机上的 main.bicep。

  2. 使用 Azure CLI 或 Azure PowerShell 来部署该 Bicep 文件。

    az group create --name exampleRG --location chinanorth
    
    az deployment group create --resource-group exampleRG --template-file main.bicep --parameters serverName=<analysis-service-name>
    

    备注

    将 <analysis-name> 替换为某个独一无二的分析服务名称。

    部署完成后,应会看到一条指出部署成功的消息。

验证部署

使用 Azure 门户或 Azure PowerShell 来验证资源组和服务器资源是否已创建。

Get-AzAnalysisServicesServer -Name <analysis-service-name>

清理资源

如果不再需要资源组和服务器资源,请使用 Azure 门户、Azure CLI 或 Azure PowerShell 将其删除。

az group delete --name exampleRG

后续步骤

在本快速入门中,你使用 Bicep 文件创建了新资源组和 Azure Analysis Services 服务器资源。 在使用模板创建服务器资源后,请考虑执行以下操作: