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

Microsoft.DBforMySQL flexibleServers

Bicep 资源定义

flexibleServers 资源类型可以使用面向以下对象的操作进行部署:

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

资源格式

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

resource symbolicname 'Microsoft.DBforMySQL/flexibleServers@2023-10-01-preview' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  sku: {
    name: 'string'
    tier: 'string'
  }
  identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
      {customized property}: any()
    }
  }
  properties: {
    administratorLogin: 'string'
    administratorLoginPassword: 'string'
    availabilityZone: 'string'
    backup: {
      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: 'AzureBlob'
      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'
  }
}

属性值

flexibleServers

名称 说明
name 资源名称 字符串 (必需)
location 资源所在的地理位置 字符串 (必需)
标记 资源标记。 标记名称和值的字典。 请参阅 模板中的标记
sku SKU (服务器的定价层) 。 MySQLServerSku
标识 服务器的 cmk 标识。 MySQLServerIdentity
properties 服务器的属性。 ServerProperties

MySQLServerIdentity

名称 说明 Value
type 托管服务标识的类型。 “UserAssigned”
userAssignedIdentities 用户分配标识的元数据。 MySQLServerIdentityUserAssignedIdentities

MySQLServerIdentityUserAssignedIdentities

名称 说明
{customized property} 对于 Bicep,可以使用 any () 函数。

ServerProperties

名称 说明
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器且需要创建) 时指定。 字符串
administratorLoginPassword 创建服务器) 所需的管理员登录 (密码。 字符串

约束:
敏感值。 作为安全参数传入。
availabilityZone 服务器的可用性区域信息。 字符串
备份 (backup) 服务器的备份相关属性。 备份
createMode 创建新 MySQL 服务器的模式。 'Default'
“GeoRestore”
“PointInTimeRestore”
“副本”
dataEncryption CMK 的数据加密。 DataEncryption
highAvailability 服务器的高可用性相关属性。 HighAvailability
importSourceProperties 从存储导入的源属性。 ImportSourceProperties
maintenanceWindow 服务器的维护时段。 MaintenanceWindow
network 服务器的网络相关属性。 Network
replicationRole 复制角色。 “None”
“副本”
“源”
restorePointInTime 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 字符串
sourceServerResourceId 源 MySQL 服务器 ID。 字符串
存储 服务器的存储相关属性。 存储
版本 服务器版本。 '5.7'
'8.0.21'

备份

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 是否启用异地冗余备份。 “Disabled”
“已启用”

DataEncryption

名称 说明
geoBackupKeyURI 异地备份密钥 URI 作为密钥保管库不能跨区域,需要与异地备份位于同一区域中的 cmk 字符串
geoBackupUserAssignedIdentityId 异地备份用户标识资源 ID 作为标识不能跨区域,需要标识与异地备份位于同一区域中 字符串
primaryKeyURI 主键 URI 字符串
primaryUserAssignedIdentityId 主要用户标识资源 ID 字符串
type 密钥类型,启用 cmk 的 AzureKeyVault,禁用 cmk 的 SystemManaged。 “AzureKeyVault”
“SystemManaged”

HighAvailability

名称 说明
mode 服务器的高可用性模式。 “Disabled”
“SameZone”
“ZoneRedundant”
standbyAvailabilityZone 备用服务器的可用性区域。 字符串

ImportSourceProperties

名称 说明
dataDirPath 存储中数据目录的相对路径。 字符串
sasToken 用于访问源存储的 Sas 令牌。 sas 令牌需要读取和列出权限。 字符串

约束:
敏感值。 作为安全参数传入。
storageType 导入源的存储类型。 “AzureBlob”
storageUrl 导入源存储的 URI。 字符串

MaintenanceWindow

名称 说明
customWindow 指示是启用或禁用自定义窗口 字符串
dayOfWeek 维护时段的星期数 int
startHour 维护时段的开始时间 int
startMinute 维护时段的开始分钟数 int

网络

名称 说明
delegatedSubnetResourceId 用于为服务器设置 vnet 的委托子网资源 ID。 字符串
privateDnsZoneResourceId 专用 DNS区域资源 ID。 字符串
publicNetworkAccess 是否允许此服务器访问公用网络。 当服务器具有 VNet 集成时,值为“禁用”。 “Disabled”
“已启用”

存储

名称 说明
autoGrow 启用存储自动增长与否。 “Disabled”
“已启用”
autoIoScaling 是否启用 IO 自动缩放。 “Disabled”
“已启用”
iops 服务器的存储 IOPS。 int
logOnDisk 是否启用登录磁盘。 “Disabled”
“已启用”
storageSizeGB 服务器允许的最大存储大小。 int

MySQLServerSku

名称 说明
name SKU 的名称,例如Standard_D32s_v3。 字符串 (必需)
特定 SKU 的层,例如 GeneralPurpose。 “突发”
“GeneralPurpose”
需要“MemoryOptimized” ()

快速入门模板

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

模板 说明
使用 VNet 部署Azure Database for MySQL (灵活)

部署到 Azure
此模板提供了一种通过 VNet 集成部署适用于 MySQL 的灵活服务器 Azure 数据库的方法。

ARM 模板资源定义

flexibleServers 资源类型可以使用面向以下对象的操作进行部署:

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

资源格式

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

{
  "type": "Microsoft.DBforMySQL/flexibleServers",
  "apiVersion": "2023-10-01-preview",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "sku": {
    "name": "string",
    "tier": "string"
  },
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "{customized property}": {}
    }
  },
  "properties": {
    "administratorLogin": "string",
    "administratorLoginPassword": "string",
    "availabilityZone": "string",
    "backup": {
      "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": "AzureBlob",
      "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"
  }
}

属性值

flexibleServers

名称 说明 Value
type 资源类型 “Microsoft.DBforMySQL/flexibleServers”
apiVersion 资源 API 版本 “2023-10-01-preview”
name 资源名称 字符串 (必需)
location 资源所在的地理位置 字符串 (必需)
标记 资源标记。 标记名称和值的字典。 请参阅 模板中的标记
sku SKU (服务器的定价层) 。 MySQLServerSku
标识 服务器的 cmk 标识。 MySQLServerIdentity
properties 服务器的属性。 ServerProperties

MySQLServerIdentity

名称 说明 Value
type 托管服务标识的类型。 “UserAssigned”
userAssignedIdentities 用户分配标识的元数据。 MySQLServerIdentityUserAssignedIdentities

MySQLServerIdentityUserAssignedIdentities

名称 说明
{customized property}

ServerProperties

名称 说明
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器且需要创建) 时指定。 字符串
administratorLoginPassword 创建服务器) 所需的管理员登录 (密码。 字符串

约束:
敏感值。 作为安全参数传入。
availabilityZone 服务器的可用性区域信息。 字符串
备份 (backup) 服务器的备份相关属性。 备份
createMode 创建新 MySQL 服务器的模式。 'Default'
“GeoRestore”
“PointInTimeRestore”
“副本”
dataEncryption CMK 的数据加密。 DataEncryption
highAvailability 服务器的高可用性相关属性。 HighAvailability
importSourceProperties 从存储导入的源属性。 ImportSourceProperties
maintenanceWindow 服务器的维护时段。 MaintenanceWindow
network 服务器的网络相关属性。 Network
replicationRole 复制角色。 “None”
“副本”
“源”
restorePointInTime 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 字符串
sourceServerResourceId 源 MySQL 服务器 ID。 字符串
存储 服务器的存储相关属性。 存储
版本 服务器版本。 '5.7'
'8.0.21'

备份

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 是否启用异地冗余备份。 “Disabled”
“已启用”

DataEncryption

名称 说明
geoBackupKeyURI 异地备份密钥 URI 作为密钥保管库不能跨区域,需要与异地备份位于同一区域中的 cmk 字符串
geoBackupUserAssignedIdentityId 异地备份用户标识资源 ID 作为标识不能跨区域,需要标识与异地备份位于同一区域中 字符串
primaryKeyURI 主键 URI 字符串
primaryUserAssignedIdentityId 主要用户标识资源 ID 字符串
type 密钥类型,启用 cmk 的 AzureKeyVault,禁用 cmk 的 SystemManaged。 “AzureKeyVault”
“SystemManaged”

HighAvailability

名称 说明
mode 服务器的高可用性模式。 “Disabled”
“SameZone”
“ZoneRedundant”
standbyAvailabilityZone 备用服务器的可用性区域。 字符串

ImportSourceProperties

名称 说明
dataDirPath 存储中数据目录的相对路径。 字符串
sasToken 用于访问源存储的 Sas 令牌。 sas 令牌需要读取和列出权限。 字符串

约束:
敏感值。 作为安全参数传入。
storageType 导入源的存储类型。 “AzureBlob”
storageUrl 导入源存储的 URI。 字符串

MaintenanceWindow

名称 说明
customWindow 指示是启用或禁用自定义窗口 字符串
dayOfWeek 维护时段的星期数 int
startHour 维护时段的开始时间 int
startMinute 维护时段的开始分钟数 int

网络

名称 说明
delegatedSubnetResourceId 用于为服务器设置 vnet 的委托子网资源 ID。 字符串
privateDnsZoneResourceId 专用 DNS区域资源 ID。 字符串
publicNetworkAccess 是否允许此服务器访问公用网络。 当服务器具有 VNet 集成时,值为“禁用”。 “Disabled”
“已启用”

存储

名称 说明
autoGrow 启用存储自动增长与否。 “Disabled”
“已启用”
autoIoScaling 是否启用 IO 自动缩放。 “Disabled”
“已启用”
iops 服务器的存储 IOPS。 int
logOnDisk 是否启用登录磁盘。 “Disabled”
“已启用”
storageSizeGB 服务器允许的最大存储大小。 int

MySQLServerSku

名称 说明
name SKU 的名称,例如Standard_D32s_v3。 字符串 (必需)
特定 SKU 的层,例如 GeneralPurpose。 “突发”
“GeneralPurpose”
需要“MemoryOptimized” ()

快速入门模板

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

模板 说明
使用 VNet 部署Azure Database for MySQL (灵活)

部署到 Azure
此模板提供了一种通过 VNet 集成部署适用于 MySQL 的灵活服务器 Azure 数据库的方法。

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

可以使用面向以下操作部署 flexibleServers 资源类型:

  • 资源组

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

资源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DBforMySQL/flexibleServers@2023-10-01-preview"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  identity {
    type = "UserAssigned"
    identity_ids = []
  }
  body = jsonencode({
    properties = {
      administratorLogin = "string"
      administratorLoginPassword = "string"
      availabilityZone = "string"
      backup = {
        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 = "AzureBlob"
        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"
    }
  })
}

属性值

flexibleServers

名称 说明 Value
type 资源类型 “Microsoft.DBforMySQL/flexibleServers@2023-10-01-preview”
name 资源名称 字符串 (必需)
location 资源所在的地理位置 字符串 (必需)
parent_id 若要部署到资源组,请使用该资源组的 ID。 字符串 (必需)
标记 资源标记。 标记名称和值的字典。
sku 服务器的 SKU (定价层) 。 MySQLServerSku
标识 服务器的 cmk 标识。 MySQLServerIdentity
properties 服务器的属性。 ServerProperties

MySQLServerIdentity

名称 说明 Value
type 托管服务标识的类型。 “UserAssigned”
identity_ids 用户分配标识的元数据。 用户标识 ID 的数组。

MySQLServerIdentityUserAssignedIdentities

名称 说明
{customized property}

ServerProperties

名称 说明
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器时指定,并且需要创建) 。 字符串
administratorLoginPassword 创建服务器) 所需的管理员登录 (密码。 字符串

约束:
敏感值。 作为安全参数传入。
availabilityZone 服务器的可用性区域信息。 字符串
备份 (backup) 服务器的备份相关属性。 备份
createMode 用于创建新的 MySQL 服务器的模式。 “Default”
“GeoRestore”
“PointInTimeRestore”
“副本”
dataEncryption CMK 的数据加密。 DataEncryption
highAvailability 服务器的高可用性相关属性。 HighAvailability
importSourceProperties 用于从存储导入的源属性。 ImportSourceProperties
maintenanceWindow 服务器的维护时段。 MaintenanceWindow
network 服务器的网络相关属性。 Network
replicationRole 复制角色。 "None"
“副本”
“Source”
restorePointInTime 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 字符串
sourceServerResourceId 源 MySQL 服务器 ID。 字符串
存储 服务器的存储相关属性。 存储
版本 服务器版本。 "5.7"
"8.0.21"

备份

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 是否启用异地冗余备份。 “Disabled”
“Enabled”

DataEncryption

名称 说明
geoBackupKeyURI 异地备份密钥 URI,因为密钥保管库不能跨区域,需要与异地备份位于同一区域中的 cmk 字符串
geoBackupUserAssignedIdentityId 异地备份用户标识资源 ID 作为标识不能跨区域,需要与异地备份位于同一区域中的标识 字符串
primaryKeyURI 主键 URI 字符串
primaryUserAssignedIdentityId 主要用户标识资源 ID 字符串
type 密钥类型,用于启用 cmk 的 AzureKeyVault,用于禁用 cmk 的 SystemManaged。 “AzureKeyVault”
“SystemManaged”

HighAvailability

名称 说明
mode 服务器的高可用性模式。 “Disabled”
“SameZone”
“ZoneRedundant”
standbyAvailabilityZone 备用服务器的可用性区域。 字符串

ImportSourceProperties

名称 说明
dataDirPath 存储中数据目录的相对路径。 字符串
sasToken 用于访问源存储的 Sas 令牌。 sas 令牌需要读取和列出权限。 字符串

约束:
敏感值。 作为安全参数传入。
storageType 导入源的存储类型。 “AzureBlob”
storageUrl 导入源存储的 URI。 字符串

MaintenanceWindow

名称 说明
customWindow 指示是启用或禁用自定义窗口 字符串
dayOfWeek 维护时段的星期数 int
startHour 维护时段的开始时间 int
startMinute 维护时段的开始分钟数 int

网络

名称 说明
delegatedSubnetResourceId 用于为服务器设置 vnet 的委托子网资源 ID。 字符串
privateDnsZoneResourceId 专用 DNS区域资源 ID。 字符串
publicNetworkAccess 是否允许此服务器访问公用网络。 当服务器具有 VNet 集成时,值为“Disabled”。 “Disabled”
“Enabled”

存储

名称 说明
autoGrow 启用存储自动增长与否。 “Disabled”
“Enabled”
autoIoScaling 是否启用 IO 自动缩放。 “Disabled”
“Enabled”
iops 服务器的存储 IOPS。 int
logOnDisk 是否启用登录磁盘。 “Disabled”
“Enabled”
storageSizeGB 服务器允许的最大存储大小。 int

MySQLServerSku

名称 说明
name sku 的名称,例如Standard_D32s_v3。 字符串 (必需)
特定 SKU 的层,例如 GeneralPurpose。 “突发”
“GeneralPurpose”
需要“MemoryOptimized” ()