你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
言论
仅在更新现有灵活服务器时使用 maintenanceWindow 属性。 创建新的灵活服务器时,请不要为此属性指定值。
Bicep 资源定义
可以使用目标操作部署 flexibleServers 资源类型:
- 资源组 - 请参阅 资源组部署命令
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DBforMySQL/flexibleServers 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.DBforMySQL/flexibleServers@2023-12-01-preview' = {
identity: {
type: 'string'
userAssignedIdentities: {
{customized property}: any(...)
}
}
location: 'string'
name: 'string'
properties: {
administratorLogin: 'string'
administratorLoginPassword: 'string'
availabilityZone: 'string'
backup: {
backupIntervalHours: int
backupRetentionDays: int
geoRedundantBackup: 'string'
}
createMode: 'string'
dataEncryption: {
geoBackupKeyURI: 'string'
geoBackupUserAssignedIdentityId: 'string'
primaryKeyURI: 'string'
primaryUserAssignedIdentityId: 'string'
type: 'string'
}
highAvailability: {
mode: 'string'
standbyAvailabilityZone: 'string'
}
importSourceProperties: {
dataDirPath: 'string'
sasToken: 'string'
storageType: 'string'
storageUrl: 'string'
}
maintenanceWindow: {
customWindow: 'string'
dayOfWeek: int
startHour: int
startMinute: int
}
network: {
delegatedSubnetResourceId: 'string'
privateDnsZoneResourceId: 'string'
publicNetworkAccess: 'string'
}
replicationRole: 'string'
restorePointInTime: 'string'
sourceServerResourceId: 'string'
storage: {
autoGrow: 'string'
autoIoScaling: 'string'
iops: int
logOnDisk: 'string'
storageSizeGB: int
}
version: 'string'
}
sku: {
name: 'string'
tier: 'string'
}
tags: {
{customized property}: 'string'
}
}
属性值
Microsoft.DBforMySQL/flexibleServers
| 名字 | 描述 | 价值 |
|---|---|---|
| 标识 | 服务器的 cmk 标识。 | MySQLServerIdentity |
| 位置 | 资源所在的地理位置 | string (必需) |
| 名字 | 资源名称 | 字符串 约束: 模式 = ^[a-z0-9][-a-z0-9]*(?<!-)$ (必需) |
| 性能 | 服务器的属性。 | ServerProperties |
| SKU | 服务器的 SKU(定价层)。 | MySQLServerSku |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
备份
| 名字 | 描述 | 价值 |
|---|---|---|
| backupInterval小时 | 服务器的备份间隔小时数。 | 整数 (int) |
| backupRetentionDays 备份 | 服务器的备份保留日。 | 整数 (int) |
| geoRedundantBackup | 是否启用异地冗余备份。 | “Disabled” “Enabled” |
数据加密
| 名字 | 描述 | 价值 |
|---|---|---|
| geoBackupKeyURI 的 | 异地备份密钥 URI,因为密钥保管库不能跨区域,需要与异地备份位于同一区域中的 cmk | 字符串 |
| geoBackupUserAssignedIdentityId | 异地备份用户标识资源 ID 作为标识不能跨区域,需要与异地备份位于同一区域中的标识 | 字符串 |
| primaryKeyURI 的 | 主键 URI | 字符串 |
| primaryUserAssignedIdentityId | 主要用户标识资源 ID | 字符串 |
| 类型 | 密钥类型,用于启用 cmk 的 AzureKeyVault、用于禁用 cmk 的 SystemManaged。 | “AzureKeyVault” “SystemManaged” |
高可用性
| 名字 | 描述 | 价值 |
|---|---|---|
| 模式 | 服务器的高可用性模式。 | “Disabled” “SameZone” “ZoneRedundant” |
| standbyAvailabilityZone | 备用服务器的可用性区域。 | 字符串 |
ImportSourceProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| dataDirPath 数据目录 | 存储中的数据目录的相对路径。 | 字符串 |
| sasToken 代币 | 用于访问源存储的 Sas 令牌。 SAS 令牌需要读取和列出权限。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| 存储类型 | 导入源的存储类型。 | “AzureBlob” |
| 存储网址 | 导入源存储的 URI。 | 字符串 |
MaintenanceWindow (维护窗口)
| 名字 | 描述 | 价值 |
|---|---|---|
| 自定义窗口 | 指示是启用还是禁用自定义窗口 | 字符串 |
| dayOfWeek (周) | 维护时段的星期几 | 整数 (int) |
| startHour (开始小时) | 维护时段的开始时间 | 整数 (int) |
| startMinute (开始分钟) | 维护时段的开始时间 | 整数 (int) |
MySQLServerIdentity
| 名字 | 描述 | 价值 |
|---|---|---|
| 类型 | 托管服务标识的类型。 | “UserAssigned” |
| 用户分配的标识 | 用户分配标识的元数据。 | MySQLServerIdentityUserAssignedIdentities |
MySQLServerIdentityUserAssignedIdentities
| 名字 | 描述 | 价值 |
|---|
MySQLServerSku
| 名字 | 描述 | 价值 |
|---|---|---|
| 名字 | sku 的名称,例如Standard_D32s_v3。 | string (必需) |
| 分层 | 特定 SKU 的层,例如 GeneralPurpose。 | “可突发” “GeneralPurpose” “MemoryOptimized”(必需) |
网络
| 名字 | 描述 | 价值 |
|---|---|---|
| delegatedSubnetResourceId | 用于为服务器设置 vnet 的委托子网资源 ID。 | 字符串 |
| privateDnsZoneResourceId | 专用 DNS 区域资源 ID。 | 字符串 |
| 公用网络访问 | 是否允许此服务器访问公用网络。 当服务器具有 VNet 集成时,值为“Disabled”。 | “Disabled” “Enabled” |
ServerProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| 管理员登录 | 管理员的服务器登录名。 只能在创建服务器时指定(并且是创建所必需的)。 | 字符串 |
| administratorLoginPassword | 管理员登录名的密码(创建服务器时需要)。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| 可用性区域 | 服务器的可用性区域信息。 | 字符串 |
| 备份 | 备份服务器的相关属性。 | 备份 |
| createMode | 创建新的 MySQL 服务器的模式。 | “Default” “GeoRestore” “PointInTimeRestore” “Replica” |
| 数据加密 | CMK 的数据加密。 | 数据加密 |
| 高可用性 | 服务器的高可用性相关属性。 | 高可用性 |
| importSourceProperties | 从存储导入的源属性。 | ImportSourceProperties |
| 维护窗口 | 服务器的维护时段。 | MaintenanceWindow (维护窗口) |
| 网络 | 服务器的网络相关属性。 | 网络 |
| replicationRole | 复制角色。 | “None” “Replica” “Source” |
| restorePointInTime | 还原点创建时间(ISO8601格式),指定要从中还原的时间。 | 字符串 |
| sourceServerResourceId | 源 MySQL 服务器 ID。 | 字符串 |
| 存储 | 服务器的存储相关属性。 | 存储 |
| 版本 | 服务器版本。 | '5.7' '8.0.21' |
存储
| 名字 | 描述 | 价值 |
|---|---|---|
| 自动增长 | 启用存储自动增长。 | “Disabled” “Enabled” |
| autoIoScaling 的 | 启用 IO 自动缩放。 | “Disabled” “Enabled” |
| IOPS (国际速率) | 服务器的存储 IOPS。 | 整数 (int) |
| 登录磁盘 | 启用登录磁盘。 | “Disabled” “Enabled” |
| 存储大小GB | 服务器允许的最大存储大小。 | 整数 (int) |
TrackedResourceTags
| 名字 | 描述 | 价值 |
|---|
用法示例
Bicep 示例
部署 MySQL 灵活服务器的基本示例。
param location string = 'westeurope'
@description('The administrator login name for the MySQL flexible server')
param administratorLogin string
@secure()
@description('The administrator login password for the MySQL flexible server')
param administratorLoginPassword string
param resourceName string = 'acctest0001'
resource flexibleServer 'Microsoft.DBforMySQL/flexibleServers@2021-05-01' = {
name: resourceName
location: location
sku: {
name: 'Standard_B1s'
tier: 'Burstable'
}
properties: {
administratorLogin: administratorLogin
administratorLoginPassword: administratorLoginPassword
backup: {
backupRetentionDays: 7
geoRedundantBackup: 'Disabled'
}
createMode: ''
dataEncryption: {
type: 'SystemManaged'
}
highAvailability: {
mode: 'Disabled'
}
network: {}
}
}
Azure 验证模块
以下 Azure 验证模块 可用于部署此资源类型。
| 模块 | 描述 |
|---|---|
| DB for MySQL 灵活服务器 | 用于 DB for MySQL 灵活服务器的 AVM 资源模块 |
Azure 快速入门示例
以下 Azure 快速入门模板 包含用于部署此资源类型的 Bicep 示例。
| Bicep 文件 | 描述 |
|---|---|
| 创建MySQL灵活服务器并通过备份库启用保护 | 创建 MySQL 灵活服务器的模板,并通过备份保管库启用保护 |
| 使用 Entra 身份验证部署 MySQL 灵活服务器 | 此模板提供了一种使用 Entra 身份验证部署适用于 MySQL 的 Azure 数据库灵活服务器的方法。 |
| 使用专用终结点部署 MySQL 灵活服务器 | 此模板提供了使用专用终结点部署 Azure Database for MySQL 灵活服务器的方法。 |
| 使用 Vnet 集成部署 MySQL 灵活服务器 | 此模板提供了使用 VNet 集成部署 Azure Database for MySQL 灵活服务器的方法。 |
ARM 模板资源定义
可以使用目标操作部署 flexibleServers 资源类型:
- 资源组 - 请参阅 资源组部署命令
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DBforMySQL/flexibleServers 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.DBforMySQL/flexibleServers",
"apiVersion": "2023-12-01-preview",
"name": "string",
"identity": {
"type": "string",
"userAssignedIdentities": {
"{customized property}": {}
}
},
"location": "string",
"properties": {
"administratorLogin": "string",
"administratorLoginPassword": "string",
"availabilityZone": "string",
"backup": {
"backupIntervalHours": "int",
"backupRetentionDays": "int",
"geoRedundantBackup": "string"
},
"createMode": "string",
"dataEncryption": {
"geoBackupKeyURI": "string",
"geoBackupUserAssignedIdentityId": "string",
"primaryKeyURI": "string",
"primaryUserAssignedIdentityId": "string",
"type": "string"
},
"highAvailability": {
"mode": "string",
"standbyAvailabilityZone": "string"
},
"importSourceProperties": {
"dataDirPath": "string",
"sasToken": "string",
"storageType": "string",
"storageUrl": "string"
},
"maintenanceWindow": {
"customWindow": "string",
"dayOfWeek": "int",
"startHour": "int",
"startMinute": "int"
},
"network": {
"delegatedSubnetResourceId": "string",
"privateDnsZoneResourceId": "string",
"publicNetworkAccess": "string"
},
"replicationRole": "string",
"restorePointInTime": "string",
"sourceServerResourceId": "string",
"storage": {
"autoGrow": "string",
"autoIoScaling": "string",
"iops": "int",
"logOnDisk": "string",
"storageSizeGB": "int"
},
"version": "string"
},
"sku": {
"name": "string",
"tier": "string"
},
"tags": {
"{customized property}": "string"
}
}
属性值
Microsoft.DBforMySQL/flexibleServers
| 名字 | 描述 | 价值 |
|---|---|---|
| apiVersion | API 版本 | “2023-12-01-预览” |
| 标识 | 服务器的 cmk 标识。 | MySQLServerIdentity |
| 位置 | 资源所在的地理位置 | string (必需) |
| 名字 | 资源名称 | 字符串 约束: 模式 = ^[a-z0-9][-a-z0-9]*(?<!-)$ (必需) |
| 性能 | 服务器的属性。 | ServerProperties |
| SKU | 服务器的 SKU(定价层)。 | MySQLServerSku |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
| 类型 | 资源类型 | “Microsoft.DBforMySQL/flexibleServers” |
备份
| 名字 | 描述 | 价值 |
|---|---|---|
| backupInterval小时 | 服务器的备份间隔小时数。 | 整数 (int) |
| backupRetentionDays 备份 | 服务器的备份保留日。 | 整数 (int) |
| geoRedundantBackup | 是否启用异地冗余备份。 | “Disabled” “Enabled” |
数据加密
| 名字 | 描述 | 价值 |
|---|---|---|
| geoBackupKeyURI 的 | 异地备份密钥 URI,因为密钥保管库不能跨区域,需要与异地备份位于同一区域中的 cmk | 字符串 |
| geoBackupUserAssignedIdentityId | 异地备份用户标识资源 ID 作为标识不能跨区域,需要与异地备份位于同一区域中的标识 | 字符串 |
| primaryKeyURI 的 | 主键 URI | 字符串 |
| primaryUserAssignedIdentityId | 主要用户标识资源 ID | 字符串 |
| 类型 | 密钥类型,用于启用 cmk 的 AzureKeyVault、用于禁用 cmk 的 SystemManaged。 | “AzureKeyVault” “SystemManaged” |
高可用性
| 名字 | 描述 | 价值 |
|---|---|---|
| 模式 | 服务器的高可用性模式。 | “Disabled” “SameZone” “ZoneRedundant” |
| standbyAvailabilityZone | 备用服务器的可用性区域。 | 字符串 |
ImportSourceProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| dataDirPath 数据目录 | 存储中的数据目录的相对路径。 | 字符串 |
| sasToken 代币 | 用于访问源存储的 Sas 令牌。 SAS 令牌需要读取和列出权限。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| 存储类型 | 导入源的存储类型。 | “AzureBlob” |
| 存储网址 | 导入源存储的 URI。 | 字符串 |
MaintenanceWindow (维护窗口)
| 名字 | 描述 | 价值 |
|---|---|---|
| 自定义窗口 | 指示是启用还是禁用自定义窗口 | 字符串 |
| dayOfWeek (周) | 维护时段的星期几 | 整数 (int) |
| startHour (开始小时) | 维护时段的开始时间 | 整数 (int) |
| startMinute (开始分钟) | 维护时段的开始时间 | 整数 (int) |
MySQLServerIdentity
| 名字 | 描述 | 价值 |
|---|---|---|
| 类型 | 托管服务标识的类型。 | “UserAssigned” |
| 用户分配的标识 | 用户分配标识的元数据。 | MySQLServerIdentityUserAssignedIdentities |
MySQLServerIdentityUserAssignedIdentities
| 名字 | 描述 | 价值 |
|---|
MySQLServerSku
| 名字 | 描述 | 价值 |
|---|---|---|
| 名字 | sku 的名称,例如Standard_D32s_v3。 | string (必需) |
| 分层 | 特定 SKU 的层,例如 GeneralPurpose。 | “可突发” “GeneralPurpose” “MemoryOptimized”(必需) |
网络
| 名字 | 描述 | 价值 |
|---|---|---|
| delegatedSubnetResourceId | 用于为服务器设置 vnet 的委托子网资源 ID。 | 字符串 |
| privateDnsZoneResourceId | 专用 DNS 区域资源 ID。 | 字符串 |
| 公用网络访问 | 是否允许此服务器访问公用网络。 当服务器具有 VNet 集成时,值为“Disabled”。 | “Disabled” “Enabled” |
ServerProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| 管理员登录 | 管理员的服务器登录名。 只能在创建服务器时指定(并且是创建所必需的)。 | 字符串 |
| administratorLoginPassword | 管理员登录名的密码(创建服务器时需要)。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| 可用性区域 | 服务器的可用性区域信息。 | 字符串 |
| 备份 | 备份服务器的相关属性。 | 备份 |
| createMode | 创建新的 MySQL 服务器的模式。 | “Default” “GeoRestore” “PointInTimeRestore” “Replica” |
| 数据加密 | CMK 的数据加密。 | 数据加密 |
| 高可用性 | 服务器的高可用性相关属性。 | 高可用性 |
| importSourceProperties | 从存储导入的源属性。 | ImportSourceProperties |
| 维护窗口 | 服务器的维护时段。 | MaintenanceWindow (维护窗口) |
| 网络 | 服务器的网络相关属性。 | 网络 |
| replicationRole | 复制角色。 | “None” “Replica” “Source” |
| restorePointInTime | 还原点创建时间(ISO8601格式),指定要从中还原的时间。 | 字符串 |
| sourceServerResourceId | 源 MySQL 服务器 ID。 | 字符串 |
| 存储 | 服务器的存储相关属性。 | 存储 |
| 版本 | 服务器版本。 | '5.7' '8.0.21' |
存储
| 名字 | 描述 | 价值 |
|---|---|---|
| 自动增长 | 启用存储自动增长。 | “Disabled” “Enabled” |
| autoIoScaling 的 | 启用 IO 自动缩放。 | “Disabled” “Enabled” |
| IOPS (国际速率) | 服务器的存储 IOPS。 | 整数 (int) |
| 登录磁盘 | 启用登录磁盘。 | “Disabled” “Enabled” |
| 存储大小GB | 服务器允许的最大存储大小。 | 整数 (int) |
TrackedResourceTags
| 名字 | 描述 | 价值 |
|---|
用法示例
Azure 快速入门模板
以下 Azure 快速入门模板 部署此资源类型。
| 模板 | 描述 |
|---|---|
|
创建MySQL灵活服务器并通过备份库启用保护 |
创建 MySQL 灵活服务器的模板,并通过备份保管库启用保护 |
|
使用 Entra 身份验证部署 MySQL 灵活服务器 |
此模板提供了一种使用 Entra 身份验证部署适用于 MySQL 的 Azure 数据库灵活服务器的方法。 |
|
使用专用终结点部署 MySQL 灵活服务器 |
此模板提供了使用专用终结点部署 Azure Database for MySQL 灵活服务器的方法。 |
|
使用 Vnet 集成部署 MySQL 灵活服务器 |
此模板提供了使用 VNet 集成部署 Azure Database for MySQL 灵活服务器的方法。 |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署 flexibleServers 资源类型:
- 资源组
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DBforMySQL/flexibleServers 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DBforMySQL/flexibleServers@2023-12-01-preview"
name = "string"
parent_id = "string"
identity {
type = "string"
identity_ids = [
"string"
]
}
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
administratorLogin = "string"
administratorLoginPassword = "string"
availabilityZone = "string"
backup = {
backupIntervalHours = int
backupRetentionDays = int
geoRedundantBackup = "string"
}
createMode = "string"
dataEncryption = {
geoBackupKeyURI = "string"
geoBackupUserAssignedIdentityId = "string"
primaryKeyURI = "string"
primaryUserAssignedIdentityId = "string"
type = "string"
}
highAvailability = {
mode = "string"
standbyAvailabilityZone = "string"
}
importSourceProperties = {
dataDirPath = "string"
sasToken = "string"
storageType = "string"
storageUrl = "string"
}
maintenanceWindow = {
customWindow = "string"
dayOfWeek = int
startHour = int
startMinute = int
}
network = {
delegatedSubnetResourceId = "string"
privateDnsZoneResourceId = "string"
publicNetworkAccess = "string"
}
replicationRole = "string"
restorePointInTime = "string"
sourceServerResourceId = "string"
storage = {
autoGrow = "string"
autoIoScaling = "string"
iops = int
logOnDisk = "string"
storageSizeGB = int
}
version = "string"
}
sku = {
name = "string"
tier = "string"
}
}
}
属性值
Microsoft.DBforMySQL/flexibleServers
| 名字 | 描述 | 价值 |
|---|---|---|
| 标识 | 服务器的 cmk 标识。 | MySQLServerIdentity |
| 位置 | 资源所在的地理位置 | string (必需) |
| 名字 | 资源名称 | 字符串 约束: 模式 = ^[a-z0-9][-a-z0-9]*(?<!-)$ (必需) |
| 性能 | 服务器的属性。 | ServerProperties |
| SKU | 服务器的 SKU(定价层)。 | MySQLServerSku |
| 标签 | 资源标记 | 标记名称和值的字典。 |
| 类型 | 资源类型 | “Microsoft.DBforMySQL/flexibleServers@2023-12-01-preview” |
备份
| 名字 | 描述 | 价值 |
|---|---|---|
| backupInterval小时 | 服务器的备份间隔小时数。 | 整数 (int) |
| backupRetentionDays 备份 | 服务器的备份保留日。 | 整数 (int) |
| geoRedundantBackup | 是否启用异地冗余备份。 | “Disabled” “Enabled” |
数据加密
| 名字 | 描述 | 价值 |
|---|---|---|
| geoBackupKeyURI 的 | 异地备份密钥 URI,因为密钥保管库不能跨区域,需要与异地备份位于同一区域中的 cmk | 字符串 |
| geoBackupUserAssignedIdentityId | 异地备份用户标识资源 ID 作为标识不能跨区域,需要与异地备份位于同一区域中的标识 | 字符串 |
| primaryKeyURI 的 | 主键 URI | 字符串 |
| primaryUserAssignedIdentityId | 主要用户标识资源 ID | 字符串 |
| 类型 | 密钥类型,用于启用 cmk 的 AzureKeyVault、用于禁用 cmk 的 SystemManaged。 | “AzureKeyVault” “SystemManaged” |
高可用性
| 名字 | 描述 | 价值 |
|---|---|---|
| 模式 | 服务器的高可用性模式。 | “Disabled” “SameZone” “ZoneRedundant” |
| standbyAvailabilityZone | 备用服务器的可用性区域。 | 字符串 |
ImportSourceProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| dataDirPath 数据目录 | 存储中的数据目录的相对路径。 | 字符串 |
| sasToken 代币 | 用于访问源存储的 Sas 令牌。 SAS 令牌需要读取和列出权限。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| 存储类型 | 导入源的存储类型。 | “AzureBlob” |
| 存储网址 | 导入源存储的 URI。 | 字符串 |
MaintenanceWindow (维护窗口)
| 名字 | 描述 | 价值 |
|---|---|---|
| 自定义窗口 | 指示是启用还是禁用自定义窗口 | 字符串 |
| dayOfWeek (周) | 维护时段的星期几 | 整数 (int) |
| startHour (开始小时) | 维护时段的开始时间 | 整数 (int) |
| startMinute (开始分钟) | 维护时段的开始时间 | 整数 (int) |
MySQLServerIdentity
| 名字 | 描述 | 价值 |
|---|---|---|
| 类型 | 托管服务标识的类型。 | “UserAssigned” |
| 用户分配的标识 | 用户分配标识的元数据。 | MySQLServerIdentityUserAssignedIdentities |
MySQLServerIdentityUserAssignedIdentities
| 名字 | 描述 | 价值 |
|---|
MySQLServerSku
| 名字 | 描述 | 价值 |
|---|---|---|
| 名字 | sku 的名称,例如Standard_D32s_v3。 | string (必需) |
| 分层 | 特定 SKU 的层,例如 GeneralPurpose。 | “可突发” “GeneralPurpose” “MemoryOptimized”(必需) |
网络
| 名字 | 描述 | 价值 |
|---|---|---|
| delegatedSubnetResourceId | 用于为服务器设置 vnet 的委托子网资源 ID。 | 字符串 |
| privateDnsZoneResourceId | 专用 DNS 区域资源 ID。 | 字符串 |
| 公用网络访问 | 是否允许此服务器访问公用网络。 当服务器具有 VNet 集成时,值为“Disabled”。 | “Disabled” “Enabled” |
ServerProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| 管理员登录 | 管理员的服务器登录名。 只能在创建服务器时指定(并且是创建所必需的)。 | 字符串 |
| administratorLoginPassword | 管理员登录名的密码(创建服务器时需要)。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| 可用性区域 | 服务器的可用性区域信息。 | 字符串 |
| 备份 | 备份服务器的相关属性。 | 备份 |
| createMode | 创建新的 MySQL 服务器的模式。 | “Default” “GeoRestore” “PointInTimeRestore” “Replica” |
| 数据加密 | CMK 的数据加密。 | 数据加密 |
| 高可用性 | 服务器的高可用性相关属性。 | 高可用性 |
| importSourceProperties | 从存储导入的源属性。 | ImportSourceProperties |
| 维护窗口 | 服务器的维护时段。 | MaintenanceWindow (维护窗口) |
| 网络 | 服务器的网络相关属性。 | 网络 |
| replicationRole | 复制角色。 | “None” “Replica” “Source” |
| restorePointInTime | 还原点创建时间(ISO8601格式),指定要从中还原的时间。 | 字符串 |
| sourceServerResourceId | 源 MySQL 服务器 ID。 | 字符串 |
| 存储 | 服务器的存储相关属性。 | 存储 |
| 版本 | 服务器版本。 | '5.7' '8.0.21' |
存储
| 名字 | 描述 | 价值 |
|---|---|---|
| 自动增长 | 启用存储自动增长。 | “Disabled” “Enabled” |
| autoIoScaling 的 | 启用 IO 自动缩放。 | “Disabled” “Enabled” |
| IOPS (国际速率) | 服务器的存储 IOPS。 | 整数 (int) |
| 登录磁盘 | 启用登录磁盘。 | “Disabled” “Enabled” |
| 存储大小GB | 服务器允许的最大存储大小。 | 整数 (int) |
TrackedResourceTags
| 名字 | 描述 | 价值 |
|---|
用法示例
Terraform 示例
部署 MySQL 灵活服务器的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
variable "administrator_login" {
type = string
description = "The administrator login name for the MySQL flexible server"
}
variable "administrator_login_password" {
type = string
description = "The administrator login password for the MySQL flexible server"
sensitive = true
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "flexibleServer" {
type = "Microsoft.DBforMySQL/flexibleServers@2021-05-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
administratorLogin = var.administrator_login
administratorLoginPassword = var.administrator_login_password
backup = {
backupRetentionDays = 7
geoRedundantBackup = "Disabled"
}
createMode = ""
dataEncryption = {
type = "SystemManaged"
}
highAvailability = {
mode = "Disabled"
}
network = {
}
}
sku = {
name = "Standard_B1s"
tier = "Burstable"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
Azure 验证模块
以下 Azure 验证模块 可用于部署此资源类型。
| 模块 | 描述 |
|---|---|
| DB for MySQL 灵活服务器 | 用于 DB for MySQL 灵活服务器的 AVM 资源模块 |