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

Microsoft.SqlVirtualMachine sqlVirtualMachines

Bicep 资源定义

可以使用目标操作部署 sqlVirtualMachines 资源类型:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.SqlVirtualMachine/sqlVirtualMachines 资源,请将以下 Bicep 添加到模板。

resource symbolicname 'Microsoft.SqlVirtualMachine/sqlVirtualMachines@2023-10-01' = {
  identity: {
    type: 'string'
  }
  location: 'string'
  name: 'string'
  properties: {
    assessmentSettings: {
      enable: bool
      runImmediately: bool
      schedule: {
        dayOfWeek: 'string'
        enable: bool
        monthlyOccurrence: int
        startTime: 'string'
        weeklyInterval: int
      }
    }
    autoBackupSettings: {
      backupScheduleType: 'string'
      backupSystemDbs: bool
      daysOfWeek: [
        'string'
      ]
      enable: bool
      enableEncryption: bool
      fullBackupFrequency: 'string'
      fullBackupStartTime: int
      fullBackupWindowHours: int
      logBackupFrequency: int
      password: 'string'
      retentionPeriod: int
      storageAccessKey: 'string'
      storageAccountUrl: 'string'
      storageContainerName: 'string'
    }
    autoPatchingSettings: {
      additionalVmPatch: 'string'
      dayOfWeek: 'string'
      enable: bool
      maintenanceWindowDuration: int
      maintenanceWindowStartingHour: int
    }
    enableAutomaticUpgrade: bool
    keyVaultCredentialSettings: {
      azureKeyVaultUrl: 'string'
      credentialName: 'string'
      enable: bool
      servicePrincipalName: 'string'
      servicePrincipalSecret: 'string'
    }
    leastPrivilegeMode: 'string'
    serverConfigurationsManagementSettings: {
      additionalFeaturesServerConfigurations: {
        isRServicesEnabled: bool
      }
      azureAdAuthenticationSettings: {
        clientId: 'string'
      }
      sqlConnectivityUpdateSettings: {
        connectivityType: 'string'
        port: int
        sqlAuthUpdatePassword: 'string'
        sqlAuthUpdateUserName: 'string'
      }
      sqlInstanceSettings: {
        collation: 'string'
        isIfiEnabled: bool
        isLpimEnabled: bool
        isOptimizeForAdHocWorkloadsEnabled: bool
        maxDop: int
        maxServerMemoryMB: int
        minServerMemoryMB: int
      }
      sqlStorageUpdateSettings: {
        diskConfigurationType: 'string'
        diskCount: int
        startingDeviceId: int
      }
      sqlWorkloadTypeUpdateSettings: {
        sqlWorkloadType: 'string'
      }
    }
    sqlImageOffer: 'string'
    sqlImageSku: 'string'
    sqlManagement: 'string'
    sqlServerLicenseType: 'string'
    sqlVirtualMachineGroupResourceId: 'string'
    storageConfigurationSettings: {
      diskConfigurationType: 'string'
      enableStorageConfigBlade: bool
      sqlDataSettings: {
        defaultFilePath: 'string'
        luns: [
          int
        ]
        useStoragePool: bool
      }
      sqlLogSettings: {
        defaultFilePath: 'string'
        luns: [
          int
        ]
        useStoragePool: bool
      }
      sqlSystemDbOnDataDisk: bool
      sqlTempDbSettings: {
        dataFileCount: int
        dataFileSize: int
        dataGrowth: int
        defaultFilePath: 'string'
        logFileSize: int
        logGrowth: int
        luns: [
          int
        ]
        persistFolder: bool
        persistFolderPath: 'string'
        useStoragePool: bool
      }
      storageWorkloadType: 'string'
    }
    virtualMachineIdentitySettings: {
      resourceId: 'string'
      type: 'string'
    }
    virtualMachineResourceId: 'string'
    wsfcDomainCredentials: {
      clusterBootstrapAccountPassword: 'string'
      clusterOperatorAccountPassword: 'string'
      sqlServiceAccountPassword: 'string'
    }
    wsfcStaticIp: 'string'
  }
  tags: {
    {customized property}: 'string'
  }
}

属性值

AADAuthenticationSettings

名字 描述 价值
clientId 要查询Microsoft图形 API 的托管标识的客户端 ID。 空字符串必须用于系统分配的托管标识 字符串

AdditionalFeaturesServerConfigurations

名字 描述 价值
isRServicesEnabled 启用或禁用 R 服务(SQL 2016 及更高版本)。 bool

AssessmentSettings

名字 描述 价值
使 启用或禁用 SQL 虚拟机上的 SQL 最佳做法评估功能。 bool
runImmediately 立即在 SQL 虚拟机上运行 SQL 最佳做法评估。 bool
附表 计划 SQL 最佳做法评估。 计划

AutoBackupSettings

名字 描述 价值
backupScheduleType 备份计划类型。 “自动化”
“Manual”
backupSystemDbs 包括或排除自动备份中的系统数据库。 bool
daysOfWeek 当 FullBackupFrequency 设置为“每周”时,备份的一周中的天数。 包含任一项的字符串数组:
“Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用自动回退。 bool
enableEncryption 启用或禁用 SQL 虚拟机上备份的加密。 bool
fullBackupFrequency 完整备份的频率。 在这两种情况下,完整备份将在下一个计划的时间范围内开始。 “每日”
“Weekly”
fullBackupStartTime 给定日期的开始时间,在此期间可以进行完整备份。 0-23 小时。 int
fullBackupWindowHours 给定日期的时间窗口的持续时间,在此期间可以进行完整备份。 1-23 小时。 int
logBackupFrequency 日志备份的频率。 5-60 分钟。 int
密码 备份时加密的密码。 字符串
retentionPeriod 备份的保留期:1-90 天。 int
storageAccessKey 将备份到的存储帐户密钥。 字符串
storageAccountUrl 将备份到的存储帐户 URL。 字符串
storageContainerName 将备份到的存储容器名称。 字符串

AutoPatchingSettings

名字 描述 价值
additionalVmPatch 要在 SQL 虚拟机上启用或启用的其他修补程序。 “MicrosoftUpdate”
“NotSet”
dayOfWeek 应用修补程序的一周中的一天。 “每天”
“Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用自动修补。 bool
maintenanceWindowDuration 修补的持续时间。 int
maintenanceWindowStartingHour 开始修补的一天中的一小时。 本地 VM 时间。 int

KeyVaultCredentialSettings

名字 描述 价值
azureKeyVaultUrl Azure Key Vault URL。 字符串
credentialName 凭据名称。 字符串
使 启用或禁用密钥保管库凭据设置。 bool
servicePrincipalName 用于访问密钥保管库的服务主体名称。 字符串
servicePrincipalSecret 用于访问密钥保管库的服务主体名称机密。 字符串

Microsoft.SqlVirtualMachine/sqlVirtualMachines

名字 描述 价值
身份 请勿使用。 此值将弃用。 服务器的 Azure Active Directory 标识。 ResourceIdentity
位置 资源位置。 string (必需)
名字 资源名称 字符串

约束:
最小长度 = 1
最大长度 = 64
模式 = ^((?!_)[^\\/"'\[\]:|<>+=;,?*@&]{1,64}(?<![.-]))$ (必需)
性能 资源属性。 SqlVirtualMachineProperties
标签 资源标记 标记名称和值的字典。 请参阅模板 中的 标记

ResourceIdentity

名字 描述 价值
类型 标识类型。 将此设置为“SystemAssigned”,以便自动为资源创建和分配 Azure Active Directory 主体。 “None”
“SystemAssigned”
“SystemAssigned,UserAssigned”
“UserAssigned”

附表

名字 描述 价值
dayOfWeek 运行评估的一周中的一天。 “Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用评估计划。 bool
monthlyOccurrence 在一个月内发生 DayOfWeek 日期以安排评估。 采用值:1,2,3,4 和 -1。 对月份的最后一天使用 -1 OfWeek 日期 int
startTime 以 HH:mm 格式表示的一天时间。例如17:30 字符串
weeklyInterval 计划 2 个评估运行之间的周数。 从 1-6 获取值 int

ServerConfigurationsManagementSettings

名字 描述 价值
additionalFeaturesServerConfigurations 其他 SQL 功能设置。 AdditionalFeaturesServerConfigurations
azureAdAuthenticationSettings Azure AD 身份验证设置。 AADAuthenticationSettings
sqlConnectivityUpdateSettings SQL 连接类型设置。 SqlConnectivityUpdateSettings
sqlInstanceSettings SQL 实例设置。 SQLInstanceSettings
sqlStorageUpdateSettings SQL 存储更新设置。 SqlStorageUpdateSettings
sqlWorkloadTypeUpdateSettings SQL 工作负荷类型设置。 SqlWorkloadTypeUpdateSettings

SqlConnectivityUpdateSettings

名字 描述 价值
connectivityType SQL Server 连接选项。 “LOCAL”
“PRIVATE”
“PUBLIC”
港口 SQL Server 端口。 int
sqlAuthUpdatePassword SQL Server sysadmin 登录密码。 字符串
sqlAuthUpdateUserName 要创建的 SQL Server sysadmin 登录名。 字符串

SQLInstanceSettings

名字 描述 价值
整理 SQL Server 排序规则。 字符串
isIfiEnabled SQL Server IFI。 bool
isLpimEnabled SQL Server LPIM。 bool
isOptimizeForAdHocWorkloadsEnabled SQL Server Optimize for Adhoc workloads. bool
maxDop SQL Server MAXDOP。 int
maxServerMemoryMB SQL Server 最大内存。 int
minServerMemoryMB SQL Server 最小内存。 int

SQLStorageSettings

名字 描述 价值
defaultFilePath SQL Server 默认文件路径 字符串
luns 磁盘的逻辑单元号。 int[]
useStoragePool 使用存储池生成驱动器(如果为 true 或未提供) bool

SqlStorageUpdateSettings

名字 描述 价值
diskConfigurationType 要应用于 SQL Server 的磁盘配置。 “ADD”
“EXTEND”
“NEW”
diskCount 虚拟机磁盘计数。 int
startingDeviceId 要更新的第一个磁盘的设备 ID。 int

SQLTempDbSettings

名字 描述 价值
dataFileCount SQL Server tempdb 数据文件计数 int
dataFileSize SQL Server tempdb 数据文件大小 int
dataGrowth SQL Server tempdb 数据文件自动增长大小 int
defaultFilePath SQL Server 默认文件路径 字符串
logFileSize SQL Server tempdb 日志文件大小 int
logGrowth SQL Server tempdb 日志文件自动增长大小 int
luns 磁盘的逻辑单元号。 int[]
persistFolder SQL Server tempdb persist 文件夹选项 bool
persistFolderPath SQL Server tempdb 保留文件夹位置 字符串
useStoragePool 使用存储池生成驱动器(如果为 true 或未提供) bool

SqlVirtualMachineProperties

名字 描述 价值
assessmentSettings SQL 最佳做法评估设置。 AssessmentSettings
autoBackupSettings SQL Server 的自动备份设置。 AutoBackupSettings
autoPatchingSettings 自动修补设置,用于将关键安全更新应用到 SQL 虚拟机。 AutoPatchingSettings
enableAutomaticUpgrade 启用 Sql IaaS 扩展代理的自动升级。 bool
keyVaultCredentialSettings 密钥保管库凭据设置。 KeyVaultCredentialSettings
leastPrivilegeMode SQL IaaS 代理最低特权模式。 “Enabled”
“NotSet”
serverConfigurationsManagementSettings SQL Server 配置管理设置。 ServerConfigurationsManagementSettings
sqlImageOffer SQL 映像产品/服务。 示例包括 SQL2016-WS2016、SQL2017-WS2016。 字符串
sqlImageSku SQL Server 版本类型。 “Developer”
“Enterprise”
“Express”
“Standard”
“Web”
sqlManagement SQL Server 管理类型。 注意:不再使用此参数。 API 会自动检测 Sql 管理,避免使用它。 “Full”
“LightWeight”
“NoAgent”
sqlServerLicenseType SQL Server 许可证类型。 “AHUB”
“DR”
“PAYG”
sqlVirtualMachineGroupResourceId 此 SQL 虚拟机所属的 SQL 虚拟机组的 ARM 资源 ID 或将成为其中的一部分。 字符串
storageConfigurationSettings 存储配置设置。 StorageConfigurationSettings
virtualMachineIdentitySettings 用于 Sql IaaS 扩展配置的虚拟机标识详细信息。 VirtualMachineIdentity
virtualMachineResourceId 从 SQL 市场映像创建的基础虚拟机的 ARM 资源 ID。 字符串
wsfcDomainCredentials 用于为 SQL 可用性组设置 Windows Server 故障转移群集的域凭据。 WsfcDomainCredentials
wsfcStaticIp 用于为 SQL 可用性组设置 Windows Server 故障转移群集的域凭据。 字符串

SqlWorkloadTypeUpdateSettings

名字 描述 价值
sqlWorkloadType SQL Server 工作负荷类型。 “DW”
“GENERAL”
“OLTP”

StorageConfigurationSettings

名字 描述 价值
diskConfigurationType 要应用于 SQL Server 的磁盘配置。 “ADD”
“EXTEND”
“NEW”
enableStorageConfigBlade 在 Azure 门户中启用 SQL IaaS 代理存储配置边栏选项卡。 bool
sqlDataSettings SQL Server 数据存储设置。 SQLStorageSettings
sqlLogSettings SQL Server 日志存储设置。 SQLStorageSettings
sqlSystemDbOnDataDisk DataPool 上的 SQL Server SystemDb 存储(如果为 true)。 bool
sqlTempDbSettings SQL Server TempDb 存储设置。 SQLTempDbSettings
storageWorkloadType 存储工作负荷类型。 “DW”
“GENERAL”
“OLTP”

TrackedResourceTags

名字 描述 价值

VirtualMachineIdentity

名字 描述 价值
resourceId 标识的 ARM 资源 ID。 仅当选择了 UserAssigned 标识时才是必需的。 字符串
类型 虚拟机的标识类型。 指定“无”以选择退出托管标识。 “None”
“SystemAssigned”
“UserAssigned”

WsfcDomainCredentials

名字 描述 价值
clusterBootstrapAccountPassword 群集启动帐户密码。 字符串
clusterOperatorAccountPassword 群集操作员帐户密码。 字符串
sqlServiceAccountPassword SQL 服务帐户密码。 字符串

快速入门示例

以下快速入门示例部署此资源类型。

Bicep 文件 描述
具有性能优化存储设置的 SQL Server VM 在 PremiumSSD 上创建具有性能优化存储设置的 SQL Server 虚拟机

ARM 模板资源定义

可以使用目标操作部署 sqlVirtualMachines 资源类型:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.SqlVirtualMachine/sqlVirtualMachines 资源,请将以下 JSON 添加到模板。

{
  "type": "Microsoft.SqlVirtualMachine/sqlVirtualMachines",
  "apiVersion": "2023-10-01",
  "name": "string",
  "identity": {
    "type": "string"
  },
  "location": "string",
  "properties": {
    "assessmentSettings": {
      "enable": "bool",
      "runImmediately": "bool",
      "schedule": {
        "dayOfWeek": "string",
        "enable": "bool",
        "monthlyOccurrence": "int",
        "startTime": "string",
        "weeklyInterval": "int"
      }
    },
    "autoBackupSettings": {
      "backupScheduleType": "string",
      "backupSystemDbs": "bool",
      "daysOfWeek": [ "string" ],
      "enable": "bool",
      "enableEncryption": "bool",
      "fullBackupFrequency": "string",
      "fullBackupStartTime": "int",
      "fullBackupWindowHours": "int",
      "logBackupFrequency": "int",
      "password": "string",
      "retentionPeriod": "int",
      "storageAccessKey": "string",
      "storageAccountUrl": "string",
      "storageContainerName": "string"
    },
    "autoPatchingSettings": {
      "additionalVmPatch": "string",
      "dayOfWeek": "string",
      "enable": "bool",
      "maintenanceWindowDuration": "int",
      "maintenanceWindowStartingHour": "int"
    },
    "enableAutomaticUpgrade": "bool",
    "keyVaultCredentialSettings": {
      "azureKeyVaultUrl": "string",
      "credentialName": "string",
      "enable": "bool",
      "servicePrincipalName": "string",
      "servicePrincipalSecret": "string"
    },
    "leastPrivilegeMode": "string",
    "serverConfigurationsManagementSettings": {
      "additionalFeaturesServerConfigurations": {
        "isRServicesEnabled": "bool"
      },
      "azureAdAuthenticationSettings": {
        "clientId": "string"
      },
      "sqlConnectivityUpdateSettings": {
        "connectivityType": "string",
        "port": "int",
        "sqlAuthUpdatePassword": "string",
        "sqlAuthUpdateUserName": "string"
      },
      "sqlInstanceSettings": {
        "collation": "string",
        "isIfiEnabled": "bool",
        "isLpimEnabled": "bool",
        "isOptimizeForAdHocWorkloadsEnabled": "bool",
        "maxDop": "int",
        "maxServerMemoryMB": "int",
        "minServerMemoryMB": "int"
      },
      "sqlStorageUpdateSettings": {
        "diskConfigurationType": "string",
        "diskCount": "int",
        "startingDeviceId": "int"
      },
      "sqlWorkloadTypeUpdateSettings": {
        "sqlWorkloadType": "string"
      }
    },
    "sqlImageOffer": "string",
    "sqlImageSku": "string",
    "sqlManagement": "string",
    "sqlServerLicenseType": "string",
    "sqlVirtualMachineGroupResourceId": "string",
    "storageConfigurationSettings": {
      "diskConfigurationType": "string",
      "enableStorageConfigBlade": "bool",
      "sqlDataSettings": {
        "defaultFilePath": "string",
        "luns": [ "int" ],
        "useStoragePool": "bool"
      },
      "sqlLogSettings": {
        "defaultFilePath": "string",
        "luns": [ "int" ],
        "useStoragePool": "bool"
      },
      "sqlSystemDbOnDataDisk": "bool",
      "sqlTempDbSettings": {
        "dataFileCount": "int",
        "dataFileSize": "int",
        "dataGrowth": "int",
        "defaultFilePath": "string",
        "logFileSize": "int",
        "logGrowth": "int",
        "luns": [ "int" ],
        "persistFolder": "bool",
        "persistFolderPath": "string",
        "useStoragePool": "bool"
      },
      "storageWorkloadType": "string"
    },
    "virtualMachineIdentitySettings": {
      "resourceId": "string",
      "type": "string"
    },
    "virtualMachineResourceId": "string",
    "wsfcDomainCredentials": {
      "clusterBootstrapAccountPassword": "string",
      "clusterOperatorAccountPassword": "string",
      "sqlServiceAccountPassword": "string"
    },
    "wsfcStaticIp": "string"
  },
  "tags": {
    "{customized property}": "string"
  }
}

属性值

AADAuthenticationSettings

名字 描述 价值
clientId 要查询Microsoft图形 API 的托管标识的客户端 ID。 空字符串必须用于系统分配的托管标识 字符串

AdditionalFeaturesServerConfigurations

名字 描述 价值
isRServicesEnabled 启用或禁用 R 服务(SQL 2016 及更高版本)。 bool

AssessmentSettings

名字 描述 价值
使 启用或禁用 SQL 虚拟机上的 SQL 最佳做法评估功能。 bool
runImmediately 立即在 SQL 虚拟机上运行 SQL 最佳做法评估。 bool
附表 计划 SQL 最佳做法评估。 计划

AutoBackupSettings

名字 描述 价值
backupScheduleType 备份计划类型。 “自动化”
“Manual”
backupSystemDbs 包括或排除自动备份中的系统数据库。 bool
daysOfWeek 当 FullBackupFrequency 设置为“每周”时,备份的一周中的天数。 包含任一项的字符串数组:
“Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用自动回退。 bool
enableEncryption 启用或禁用 SQL 虚拟机上备份的加密。 bool
fullBackupFrequency 完整备份的频率。 在这两种情况下,完整备份将在下一个计划的时间范围内开始。 “每日”
“Weekly”
fullBackupStartTime 给定日期的开始时间,在此期间可以进行完整备份。 0-23 小时。 int
fullBackupWindowHours 给定日期的时间窗口的持续时间,在此期间可以进行完整备份。 1-23 小时。 int
logBackupFrequency 日志备份的频率。 5-60 分钟。 int
密码 备份时加密的密码。 字符串
retentionPeriod 备份的保留期:1-90 天。 int
storageAccessKey 将备份到的存储帐户密钥。 字符串
storageAccountUrl 将备份到的存储帐户 URL。 字符串
storageContainerName 将备份到的存储容器名称。 字符串

AutoPatchingSettings

名字 描述 价值
additionalVmPatch 要在 SQL 虚拟机上启用或启用的其他修补程序。 “MicrosoftUpdate”
“NotSet”
dayOfWeek 应用修补程序的一周中的一天。 “每天”
“Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用自动修补。 bool
maintenanceWindowDuration 修补的持续时间。 int
maintenanceWindowStartingHour 开始修补的一天中的一小时。 本地 VM 时间。 int

KeyVaultCredentialSettings

名字 描述 价值
azureKeyVaultUrl Azure Key Vault URL。 字符串
credentialName 凭据名称。 字符串
使 启用或禁用密钥保管库凭据设置。 bool
servicePrincipalName 用于访问密钥保管库的服务主体名称。 字符串
servicePrincipalSecret 用于访问密钥保管库的服务主体名称机密。 字符串

Microsoft.SqlVirtualMachine/sqlVirtualMachines

名字 描述 价值
apiVersion API 版本 '2023-10-01'
身份 请勿使用。 此值将弃用。 服务器的 Azure Active Directory 标识。 ResourceIdentity
位置 资源位置。 string (必需)
名字 资源名称 字符串

约束:
最小长度 = 1
最大长度 = 64
模式 = ^((?!_)[^\\/"'\[\]:|<>+=;,?*@&]{1,64}(?<![.-]))$ (必需)
性能 资源属性。 SqlVirtualMachineProperties
标签 资源标记 标记名称和值的字典。 请参阅模板 中的 标记
类型 资源类型 “Microsoft.SqlVirtualMachine/sqlVirtualMachines”

ResourceIdentity

名字 描述 价值
类型 标识类型。 将此设置为“SystemAssigned”,以便自动为资源创建和分配 Azure Active Directory 主体。 “None”
“SystemAssigned”
“SystemAssigned,UserAssigned”
“UserAssigned”

附表

名字 描述 价值
dayOfWeek 运行评估的一周中的一天。 “Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用评估计划。 bool
monthlyOccurrence 在一个月内发生 DayOfWeek 日期以安排评估。 采用值:1,2,3,4 和 -1。 对月份的最后一天使用 -1 OfWeek 日期 int
startTime 以 HH:mm 格式表示的一天时间。例如17:30 字符串
weeklyInterval 计划 2 个评估运行之间的周数。 从 1-6 获取值 int

ServerConfigurationsManagementSettings

名字 描述 价值
additionalFeaturesServerConfigurations 其他 SQL 功能设置。 AdditionalFeaturesServerConfigurations
azureAdAuthenticationSettings Azure AD 身份验证设置。 AADAuthenticationSettings
sqlConnectivityUpdateSettings SQL 连接类型设置。 SqlConnectivityUpdateSettings
sqlInstanceSettings SQL 实例设置。 SQLInstanceSettings
sqlStorageUpdateSettings SQL 存储更新设置。 SqlStorageUpdateSettings
sqlWorkloadTypeUpdateSettings SQL 工作负荷类型设置。 SqlWorkloadTypeUpdateSettings

SqlConnectivityUpdateSettings

名字 描述 价值
connectivityType SQL Server 连接选项。 “LOCAL”
“PRIVATE”
“PUBLIC”
港口 SQL Server 端口。 int
sqlAuthUpdatePassword SQL Server sysadmin 登录密码。 字符串
sqlAuthUpdateUserName 要创建的 SQL Server sysadmin 登录名。 字符串

SQLInstanceSettings

名字 描述 价值
整理 SQL Server 排序规则。 字符串
isIfiEnabled SQL Server IFI。 bool
isLpimEnabled SQL Server LPIM。 bool
isOptimizeForAdHocWorkloadsEnabled SQL Server Optimize for Adhoc workloads. bool
maxDop SQL Server MAXDOP。 int
maxServerMemoryMB SQL Server 最大内存。 int
minServerMemoryMB SQL Server 最小内存。 int

SQLStorageSettings

名字 描述 价值
defaultFilePath SQL Server 默认文件路径 字符串
luns 磁盘的逻辑单元号。 int[]
useStoragePool 使用存储池生成驱动器(如果为 true 或未提供) bool

SqlStorageUpdateSettings

名字 描述 价值
diskConfigurationType 要应用于 SQL Server 的磁盘配置。 “ADD”
“EXTEND”
“NEW”
diskCount 虚拟机磁盘计数。 int
startingDeviceId 要更新的第一个磁盘的设备 ID。 int

SQLTempDbSettings

名字 描述 价值
dataFileCount SQL Server tempdb 数据文件计数 int
dataFileSize SQL Server tempdb 数据文件大小 int
dataGrowth SQL Server tempdb 数据文件自动增长大小 int
defaultFilePath SQL Server 默认文件路径 字符串
logFileSize SQL Server tempdb 日志文件大小 int
logGrowth SQL Server tempdb 日志文件自动增长大小 int
luns 磁盘的逻辑单元号。 int[]
persistFolder SQL Server tempdb persist 文件夹选项 bool
persistFolderPath SQL Server tempdb 保留文件夹位置 字符串
useStoragePool 使用存储池生成驱动器(如果为 true 或未提供) bool

SqlVirtualMachineProperties

名字 描述 价值
assessmentSettings SQL 最佳做法评估设置。 AssessmentSettings
autoBackupSettings SQL Server 的自动备份设置。 AutoBackupSettings
autoPatchingSettings 自动修补设置,用于将关键安全更新应用到 SQL 虚拟机。 AutoPatchingSettings
enableAutomaticUpgrade 启用 Sql IaaS 扩展代理的自动升级。 bool
keyVaultCredentialSettings 密钥保管库凭据设置。 KeyVaultCredentialSettings
leastPrivilegeMode SQL IaaS 代理最低特权模式。 “Enabled”
“NotSet”
serverConfigurationsManagementSettings SQL Server 配置管理设置。 ServerConfigurationsManagementSettings
sqlImageOffer SQL 映像产品/服务。 示例包括 SQL2016-WS2016、SQL2017-WS2016。 字符串
sqlImageSku SQL Server 版本类型。 “Developer”
“Enterprise”
“Express”
“Standard”
“Web”
sqlManagement SQL Server 管理类型。 注意:不再使用此参数。 API 会自动检测 Sql 管理,避免使用它。 “Full”
“LightWeight”
“NoAgent”
sqlServerLicenseType SQL Server 许可证类型。 “AHUB”
“DR”
“PAYG”
sqlVirtualMachineGroupResourceId 此 SQL 虚拟机所属的 SQL 虚拟机组的 ARM 资源 ID 或将成为其中的一部分。 字符串
storageConfigurationSettings 存储配置设置。 StorageConfigurationSettings
virtualMachineIdentitySettings 用于 Sql IaaS 扩展配置的虚拟机标识详细信息。 VirtualMachineIdentity
virtualMachineResourceId 从 SQL 市场映像创建的基础虚拟机的 ARM 资源 ID。 字符串
wsfcDomainCredentials 用于为 SQL 可用性组设置 Windows Server 故障转移群集的域凭据。 WsfcDomainCredentials
wsfcStaticIp 用于为 SQL 可用性组设置 Windows Server 故障转移群集的域凭据。 字符串

SqlWorkloadTypeUpdateSettings

名字 描述 价值
sqlWorkloadType SQL Server 工作负荷类型。 “DW”
“GENERAL”
“OLTP”

StorageConfigurationSettings

名字 描述 价值
diskConfigurationType 要应用于 SQL Server 的磁盘配置。 “ADD”
“EXTEND”
“NEW”
enableStorageConfigBlade 在 Azure 门户中启用 SQL IaaS 代理存储配置边栏选项卡。 bool
sqlDataSettings SQL Server 数据存储设置。 SQLStorageSettings
sqlLogSettings SQL Server 日志存储设置。 SQLStorageSettings
sqlSystemDbOnDataDisk DataPool 上的 SQL Server SystemDb 存储(如果为 true)。 bool
sqlTempDbSettings SQL Server TempDb 存储设置。 SQLTempDbSettings
storageWorkloadType 存储工作负荷类型。 “DW”
“GENERAL”
“OLTP”

TrackedResourceTags

名字 描述 价值

VirtualMachineIdentity

名字 描述 价值
resourceId 标识的 ARM 资源 ID。 仅当选择了 UserAssigned 标识时才是必需的。 字符串
类型 虚拟机的标识类型。 指定“无”以选择退出托管标识。 “None”
“SystemAssigned”
“UserAssigned”

WsfcDomainCredentials

名字 描述 价值
clusterBootstrapAccountPassword 群集启动帐户密码。 字符串
clusterOperatorAccountPassword 群集操作员帐户密码。 字符串
sqlServiceAccountPassword SQL 服务帐户密码。 字符串

快速入门模板

以下快速入门模板部署此资源类型。

模板 描述
使用现有 SQL 虚拟机 部署 SQL Always ON 设置

部署到 Azure
使用现有 SQL 虚拟机部署 SQL Always ON 安装程序。 虚拟机应已加入现有域,并且必须运行 SQL Server 的企业版本。
具有性能优化存储设置的 SQL Server VM

部署到 Azure
在 PremiumSSD 上创建具有性能优化存储设置的 SQL Server 虚拟机
在 UltraSSD 上 SQL VM 性能优化存储设置

部署到 Azure
使用 UltraSSD for SQL 日志文件创建具有性能优化存储设置的 SQL Server 虚拟机

Terraform (AzAPI 提供程序)资源定义

可以使用目标操作部署 sqlVirtualMachines 资源类型:

  • 资源组

有关每个 API 版本中已更改属性的列表,请参阅 更改日志

资源格式

若要创建 Microsoft.SqlVirtualMachine/sqlVirtualMachines 资源,请将以下 Terraform 添加到模板。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.SqlVirtualMachine/sqlVirtualMachines@2023-10-01"
  name = "string"
  identity = {
    type = "string"
  }
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = jsonencode({
    properties = {
      assessmentSettings = {
        enable = bool
        runImmediately = bool
        schedule = {
          dayOfWeek = "string"
          enable = bool
          monthlyOccurrence = int
          startTime = "string"
          weeklyInterval = int
        }
      }
      autoBackupSettings = {
        backupScheduleType = "string"
        backupSystemDbs = bool
        daysOfWeek = [
          "string"
        ]
        enable = bool
        enableEncryption = bool
        fullBackupFrequency = "string"
        fullBackupStartTime = int
        fullBackupWindowHours = int
        logBackupFrequency = int
        password = "string"
        retentionPeriod = int
        storageAccessKey = "string"
        storageAccountUrl = "string"
        storageContainerName = "string"
      }
      autoPatchingSettings = {
        additionalVmPatch = "string"
        dayOfWeek = "string"
        enable = bool
        maintenanceWindowDuration = int
        maintenanceWindowStartingHour = int
      }
      enableAutomaticUpgrade = bool
      keyVaultCredentialSettings = {
        azureKeyVaultUrl = "string"
        credentialName = "string"
        enable = bool
        servicePrincipalName = "string"
        servicePrincipalSecret = "string"
      }
      leastPrivilegeMode = "string"
      serverConfigurationsManagementSettings = {
        additionalFeaturesServerConfigurations = {
          isRServicesEnabled = bool
        }
        azureAdAuthenticationSettings = {
          clientId = "string"
        }
        sqlConnectivityUpdateSettings = {
          connectivityType = "string"
          port = int
          sqlAuthUpdatePassword = "string"
          sqlAuthUpdateUserName = "string"
        }
        sqlInstanceSettings = {
          collation = "string"
          isIfiEnabled = bool
          isLpimEnabled = bool
          isOptimizeForAdHocWorkloadsEnabled = bool
          maxDop = int
          maxServerMemoryMB = int
          minServerMemoryMB = int
        }
        sqlStorageUpdateSettings = {
          diskConfigurationType = "string"
          diskCount = int
          startingDeviceId = int
        }
        sqlWorkloadTypeUpdateSettings = {
          sqlWorkloadType = "string"
        }
      }
      sqlImageOffer = "string"
      sqlImageSku = "string"
      sqlManagement = "string"
      sqlServerLicenseType = "string"
      sqlVirtualMachineGroupResourceId = "string"
      storageConfigurationSettings = {
        diskConfigurationType = "string"
        enableStorageConfigBlade = bool
        sqlDataSettings = {
          defaultFilePath = "string"
          luns = [
            int
          ]
          useStoragePool = bool
        }
        sqlLogSettings = {
          defaultFilePath = "string"
          luns = [
            int
          ]
          useStoragePool = bool
        }
        sqlSystemDbOnDataDisk = bool
        sqlTempDbSettings = {
          dataFileCount = int
          dataFileSize = int
          dataGrowth = int
          defaultFilePath = "string"
          logFileSize = int
          logGrowth = int
          luns = [
            int
          ]
          persistFolder = bool
          persistFolderPath = "string"
          useStoragePool = bool
        }
        storageWorkloadType = "string"
      }
      virtualMachineIdentitySettings = {
        resourceId = "string"
        type = "string"
      }
      virtualMachineResourceId = "string"
      wsfcDomainCredentials = {
        clusterBootstrapAccountPassword = "string"
        clusterOperatorAccountPassword = "string"
        sqlServiceAccountPassword = "string"
      }
      wsfcStaticIp = "string"
    }
  })
}

属性值

AADAuthenticationSettings

名字 描述 价值
clientId 要查询Microsoft图形 API 的托管标识的客户端 ID。 空字符串必须用于系统分配的托管标识 字符串

AdditionalFeaturesServerConfigurations

名字 描述 价值
isRServicesEnabled 启用或禁用 R 服务(SQL 2016 及更高版本)。 bool

AssessmentSettings

名字 描述 价值
使 启用或禁用 SQL 虚拟机上的 SQL 最佳做法评估功能。 bool
runImmediately 立即在 SQL 虚拟机上运行 SQL 最佳做法评估。 bool
附表 计划 SQL 最佳做法评估。 计划

AutoBackupSettings

名字 描述 价值
backupScheduleType 备份计划类型。 “自动化”
“Manual”
backupSystemDbs 包括或排除自动备份中的系统数据库。 bool
daysOfWeek 当 FullBackupFrequency 设置为“每周”时,备份的一周中的天数。 包含任一项的字符串数组:
“Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用自动回退。 bool
enableEncryption 启用或禁用 SQL 虚拟机上备份的加密。 bool
fullBackupFrequency 完整备份的频率。 在这两种情况下,完整备份将在下一个计划的时间范围内开始。 “每日”
“Weekly”
fullBackupStartTime 给定日期的开始时间,在此期间可以进行完整备份。 0-23 小时。 int
fullBackupWindowHours 给定日期的时间窗口的持续时间,在此期间可以进行完整备份。 1-23 小时。 int
logBackupFrequency 日志备份的频率。 5-60 分钟。 int
密码 备份时加密的密码。 字符串
retentionPeriod 备份的保留期:1-90 天。 int
storageAccessKey 将备份到的存储帐户密钥。 字符串
storageAccountUrl 将备份到的存储帐户 URL。 字符串
storageContainerName 将备份到的存储容器名称。 字符串

AutoPatchingSettings

名字 描述 价值
additionalVmPatch 要在 SQL 虚拟机上启用或启用的其他修补程序。 “MicrosoftUpdate”
“NotSet”
dayOfWeek 应用修补程序的一周中的一天。 “每天”
“Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用自动修补。 bool
maintenanceWindowDuration 修补的持续时间。 int
maintenanceWindowStartingHour 开始修补的一天中的一小时。 本地 VM 时间。 int

KeyVaultCredentialSettings

名字 描述 价值
azureKeyVaultUrl Azure Key Vault URL。 字符串
credentialName 凭据名称。 字符串
使 启用或禁用密钥保管库凭据设置。 bool
servicePrincipalName 用于访问密钥保管库的服务主体名称。 字符串
servicePrincipalSecret 用于访问密钥保管库的服务主体名称机密。 字符串

Microsoft.SqlVirtualMachine/sqlVirtualMachines

名字 描述 价值
身份 请勿使用。 此值将弃用。 服务器的 Azure Active Directory 标识。 ResourceIdentity
位置 资源位置。 string (必需)
名字 资源名称 字符串

约束:
最小长度 = 1
最大长度 = 64
模式 = ^((?!_)[^\\/"'\[\]:|<>+=;,?*@&]{1,64}(?<![.-]))$ (必需)
性能 资源属性。 SqlVirtualMachineProperties
标签 资源标记 标记名称和值的字典。
类型 资源类型 “Microsoft.SqlVirtualMachine/sqlVirtualMachines@2023-10-01”

ResourceIdentity

名字 描述 价值
类型 标识类型。 将此设置为“SystemAssigned”,以便自动为资源创建和分配 Azure Active Directory 主体。 “None”
“SystemAssigned”
“SystemAssigned,UserAssigned”
“UserAssigned”

附表

名字 描述 价值
dayOfWeek 运行评估的一周中的一天。 “Friday”
“Monday”
“Saturday”
“星期日”
“星期四”
“Tuesday”
“Wednesday”
使 在 SQL 虚拟机上启用或禁用评估计划。 bool
monthlyOccurrence 在一个月内发生 DayOfWeek 日期以安排评估。 采用值:1,2,3,4 和 -1。 对月份的最后一天使用 -1 OfWeek 日期 int
startTime 以 HH:mm 格式表示的一天时间。例如17:30 字符串
weeklyInterval 计划 2 个评估运行之间的周数。 从 1-6 获取值 int

ServerConfigurationsManagementSettings

名字 描述 价值
additionalFeaturesServerConfigurations 其他 SQL 功能设置。 AdditionalFeaturesServerConfigurations
azureAdAuthenticationSettings Azure AD 身份验证设置。 AADAuthenticationSettings
sqlConnectivityUpdateSettings SQL 连接类型设置。 SqlConnectivityUpdateSettings
sqlInstanceSettings SQL 实例设置。 SQLInstanceSettings
sqlStorageUpdateSettings SQL 存储更新设置。 SqlStorageUpdateSettings
sqlWorkloadTypeUpdateSettings SQL 工作负荷类型设置。 SqlWorkloadTypeUpdateSettings

SqlConnectivityUpdateSettings

名字 描述 价值
connectivityType SQL Server 连接选项。 “LOCAL”
“PRIVATE”
“PUBLIC”
港口 SQL Server 端口。 int
sqlAuthUpdatePassword SQL Server sysadmin 登录密码。 字符串
sqlAuthUpdateUserName 要创建的 SQL Server sysadmin 登录名。 字符串

SQLInstanceSettings

名字 描述 价值
整理 SQL Server 排序规则。 字符串
isIfiEnabled SQL Server IFI。 bool
isLpimEnabled SQL Server LPIM。 bool
isOptimizeForAdHocWorkloadsEnabled SQL Server Optimize for Adhoc workloads. bool
maxDop SQL Server MAXDOP。 int
maxServerMemoryMB SQL Server 最大内存。 int
minServerMemoryMB SQL Server 最小内存。 int

SQLStorageSettings

名字 描述 价值
defaultFilePath SQL Server 默认文件路径 字符串
luns 磁盘的逻辑单元号。 int[]
useStoragePool 使用存储池生成驱动器(如果为 true 或未提供) bool

SqlStorageUpdateSettings

名字 描述 价值
diskConfigurationType 要应用于 SQL Server 的磁盘配置。 “ADD”
“EXTEND”
“NEW”
diskCount 虚拟机磁盘计数。 int
startingDeviceId 要更新的第一个磁盘的设备 ID。 int

SQLTempDbSettings

名字 描述 价值
dataFileCount SQL Server tempdb 数据文件计数 int
dataFileSize SQL Server tempdb 数据文件大小 int
dataGrowth SQL Server tempdb 数据文件自动增长大小 int
defaultFilePath SQL Server 默认文件路径 字符串
logFileSize SQL Server tempdb 日志文件大小 int
logGrowth SQL Server tempdb 日志文件自动增长大小 int
luns 磁盘的逻辑单元号。 int[]
persistFolder SQL Server tempdb persist 文件夹选项 bool
persistFolderPath SQL Server tempdb 保留文件夹位置 字符串
useStoragePool 使用存储池生成驱动器(如果为 true 或未提供) bool

SqlVirtualMachineProperties

名字 描述 价值
assessmentSettings SQL 最佳做法评估设置。 AssessmentSettings
autoBackupSettings SQL Server 的自动备份设置。 AutoBackupSettings
autoPatchingSettings 自动修补设置,用于将关键安全更新应用到 SQL 虚拟机。 AutoPatchingSettings
enableAutomaticUpgrade 启用 Sql IaaS 扩展代理的自动升级。 bool
keyVaultCredentialSettings 密钥保管库凭据设置。 KeyVaultCredentialSettings
leastPrivilegeMode SQL IaaS 代理最低特权模式。 “Enabled”
“NotSet”
serverConfigurationsManagementSettings SQL Server 配置管理设置。 ServerConfigurationsManagementSettings
sqlImageOffer SQL 映像产品/服务。 示例包括 SQL2016-WS2016、SQL2017-WS2016。 字符串
sqlImageSku SQL Server 版本类型。 “Developer”
“Enterprise”
“Express”
“Standard”
“Web”
sqlManagement SQL Server 管理类型。 注意:不再使用此参数。 API 会自动检测 Sql 管理,避免使用它。 “Full”
“LightWeight”
“NoAgent”
sqlServerLicenseType SQL Server 许可证类型。 “AHUB”
“DR”
“PAYG”
sqlVirtualMachineGroupResourceId 此 SQL 虚拟机所属的 SQL 虚拟机组的 ARM 资源 ID 或将成为其中的一部分。 字符串
storageConfigurationSettings 存储配置设置。 StorageConfigurationSettings
virtualMachineIdentitySettings 用于 Sql IaaS 扩展配置的虚拟机标识详细信息。 VirtualMachineIdentity
virtualMachineResourceId 从 SQL 市场映像创建的基础虚拟机的 ARM 资源 ID。 字符串
wsfcDomainCredentials 用于为 SQL 可用性组设置 Windows Server 故障转移群集的域凭据。 WsfcDomainCredentials
wsfcStaticIp 用于为 SQL 可用性组设置 Windows Server 故障转移群集的域凭据。 字符串

SqlWorkloadTypeUpdateSettings

名字 描述 价值
sqlWorkloadType SQL Server 工作负荷类型。 “DW”
“GENERAL”
“OLTP”

StorageConfigurationSettings

名字 描述 价值
diskConfigurationType 要应用于 SQL Server 的磁盘配置。 “ADD”
“EXTEND”
“NEW”
enableStorageConfigBlade 在 Azure 门户中启用 SQL IaaS 代理存储配置边栏选项卡。 bool
sqlDataSettings SQL Server 数据存储设置。 SQLStorageSettings
sqlLogSettings SQL Server 日志存储设置。 SQLStorageSettings
sqlSystemDbOnDataDisk DataPool 上的 SQL Server SystemDb 存储(如果为 true)。 bool
sqlTempDbSettings SQL Server TempDb 存储设置。 SQLTempDbSettings
storageWorkloadType 存储工作负荷类型。 “DW”
“GENERAL”
“OLTP”

TrackedResourceTags

名字 描述 价值

VirtualMachineIdentity

名字 描述 价值
resourceId 标识的 ARM 资源 ID。 仅当选择了 UserAssigned 标识时才是必需的。 字符串
类型 虚拟机的标识类型。 指定“无”以选择退出托管标识。 “None”
“SystemAssigned”
“UserAssigned”

WsfcDomainCredentials

名字 描述 价值
clusterBootstrapAccountPassword 群集启动帐户密码。 字符串
clusterOperatorAccountPassword 群集操作员帐户密码。 字符串
sqlServiceAccountPassword SQL 服务帐户密码。 字符串