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

Microsoft.DBforMySQL 服务器

Bicep 资源定义

可以使用针对以下操作部署服务器资源类型:

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

资源格式

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

resource symbolicname 'Microsoft.DBforMySQL/servers@2017-12-01' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
    {customized property}: 'string'
  sku: {
    capacity: int
    family: 'string'
    name: 'string'
    size: 'string'
    tier: 'string'
  }
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    infrastructureEncryption: 'string'
    minimalTlsVersion: 'string'
    publicNetworkAccess: 'string'
    sslEnforcement: 'string'
    storageProfile: {
      backupRetentionDays: int
      geoRedundantBackup: 'string'
      storageAutogrow: 'string'
      storageMB: int
    }
    version: 'string'
    createMode: 'string'
    // For remaining properties, see ServerPropertiesForCreateOrServerProperties objects
  }
}

ServerPropertiesForCreateOrServerProperties 对象

设置 createMode 属性以指定对象的类型。

对于 “默认值”,请使用:

  createMode: 'Default'
  administratorLogin: 'string'
  administratorLoginPassword: 'string'

对于 GeoRestore,请使用:

  createMode: 'GeoRestore'
  sourceServerId: 'string'

对于 PointInTimeRestore,请使用:

  createMode: 'PointInTimeRestore'
  restorePointInTime: 'string'
  sourceServerId: 'string'

对于 副本,请使用:

注意

使用模板创建具有 副本 值的 MySQL 服务器不是幂等的。 首次成功创建服务器。 但是,在副本 (replica) 服务器已存在时部署模板将返回错误。

  createMode: 'Replica'
  sourceServerId: 'string'

属性值

servers

名称 说明
name 资源名称 字符串 (必需)

字符限制:3-63

有效字符:
小写字母、连字符和数字。

不能以连字符开头或结尾。

资源名称在 Azure 中必须是唯一的。
location 资源所在的位置。 字符串 (必需)
标记 键值对形式的应用程序特定元数据。 标记名称和值的字典。 请参阅 模板中的标记
sku SKU (服务器的定价层) 。 Sku
标识 服务器的 Azure Active Directory 标识。 ResourceIdentity
properties 服务器的属性。 ServerPropertiesForCreateOrServerProperties (必需)

ResourceIdentity

名称 说明 Value
type 标识类型。 将此设置为“SystemAssigned”,以便自动为资源创建和分配 Azure Active Directory 主体。 “SystemAssigned”

ServerPropertiesForCreateOrServerProperties

名称 说明
infrastructureEncryption 显示服务器是否已启用基础结构加密的状态。 “Disabled”
“已启用”
minimalTlsVersion 为服务器强制实施最低 Tls 版本。 “TLS1_0”
“TLS1_1”
“TLS1_2”
“TLSEnforcementDisabled”
publicNetworkAccess 是否允许此服务器访问公用网络。 值是可选的,但如果传入,则必须为“Enabled”或“Disabled” “Disabled”
“已启用”
sslEnforcement 在连接到服务器时是否启用 ssl 强制实施。 “Disabled”
“已启用”
storageProfile 服务器的存储配置文件。 StorageProfile
版本 服务器版本。 '5.6'
'5.7'
'8.0'
createMode 设置对象类型 Default
GeoRestore
PointInTimeRestore
需要副本 ()

StorageProfile

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 为服务器备份启用异地冗余或不启用。 “Disabled”
“已启用”
storageAutogrow 启用存储自动增长。 “Disabled”
“已启用”
storageMB 服务器允许的最大存储。 int

ServerPropertiesForDefaultCreate

名称 说明
createMode 创建新服务器的模式。 “Default” (必需)
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器且需要创建) 时指定。 更新密码时需要登录名。 字符串 (必需)
administratorLoginPassword 管理员登录名的密码。 字符串 (必需)

约束:
敏感值。 作为安全参数传入。

ServerPropertiesForGeoRestore

名称 说明
createMode 创建新服务器的模式。 “GeoRestore” (必需)
sourceServerId 要从中还原的源服务器 ID。 字符串 (必需)

ServerPropertiesForRestore

名称 说明
createMode 创建新服务器的模式。 “PointInTimeRestore” (必需)
restorePointInTime 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 字符串 (必需)
sourceServerId 要从中还原的源服务器 ID。 字符串 (必需)

ServerPropertiesForReplica

名称 说明
createMode 创建新服务器的模式。 “副本” (必需)
sourceServerId 要从中创建副本 (replica) 的主服务器 ID。 字符串 (必需)

SKU

名称 说明
容量 扩展/横向扩展容量,表示服务器的计算单位。 int

约束:
最小值 = 0
family 硬件系列。 字符串
name sku 的名称,通常为层 + 系列 + 核心,例如B_Gen4_1、GP_Gen5_8。 字符串 (必需)
大小 大小代码,由资源根据需要解释。 字符串
特定 SKU 的层,例如基本。 “Basic”
“GeneralPurpose”
“MemoryOptimized”

快速入门模板

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

模板 说明
Buffalo Web 应用

部署到 Azure
快速且廉价地开始在 Azure 上运行 Golang Buffalo 应用程序。
使用 Jenkins 和 Azure Web 应用实现 Java CI/CD

部署到 Azure
这是使用 Jenkins 和 Azure Web 应用的 Java CI/CD 的示例。
使用 VNet 部署Azure Database for MySQL

部署到 Azure
此模板提供了一种通过 VNet 集成部署 Azure 数据库 for MySQL 的方法。
具有 IP 限制的 Web 应用的应用程序网关

部署到 Azure
此模板在 Azure Web 应用前面创建应用程序网关,并在 Web 应用上启用了 IP 限制。
使用 Azure Database for MySQL 在 Linux 上生成 Web 应用

部署到 Azure
此模板提供了一种使用 Azure database for MySQL 在 Linux 上部署Web 应用的方法。
具有 MySQL 的 Linux 上的 Sonarqube Docker Web 应用

部署到 Azure
此模板提供了一种在 Linux Web 应用上使用 Azure Database for MySQL 部署 Sonarqube docker 映像 (alpine 标记) 的简单方法
使用 Azure database for MySQL 的 Web 应用

部署到 Azure
此模板提供了一种使用 Azure database for MySQL 在 Azure 应用服务 Web 应用 上部署 Web 应用的简单方法。

ARM 模板资源定义

可以使用针对以下操作部署服务器资源类型:

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

资源格式

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

{
  "type": "Microsoft.DBforMySQL/servers",
  "apiVersion": "2017-12-01",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
    "{customized property}": "string"
  "sku": {
    "capacity": "int",
    "family": "string",
    "name": "string",
    "size": "string",
    "tier": "string"
  },
  "identity": {
    "type": "SystemAssigned"
  },
  "properties": {
    "infrastructureEncryption": "string",
    "minimalTlsVersion": "string",
    "publicNetworkAccess": "string",
    "sslEnforcement": "string",
    "storageProfile": {
      "backupRetentionDays": "int",
      "geoRedundantBackup": "string",
      "storageAutogrow": "string",
      "storageMB": "int"
    },
    "version": "string",
    "createMode": "string"
    // For remaining properties, see ServerPropertiesForCreateOrServerProperties objects
  }
}

ServerPropertiesForCreateOrServerProperties 对象

设置 createMode 属性以指定对象的类型。

对于 “默认值”,请使用:

  "createMode": "Default",
  "administratorLogin": "string",
  "administratorLoginPassword": "string"

对于 GeoRestore,请使用:

  "createMode": "GeoRestore",
  "sourceServerId": "string"

对于 PointInTimeRestore,请使用:

  "createMode": "PointInTimeRestore",
  "restorePointInTime": "string",
  "sourceServerId": "string"

对于 副本,请使用:

注意

使用模板创建具有 副本 值的 MySQL 服务器不是幂等的。 首次成功创建服务器。 但是,在副本 (replica) 服务器已存在时部署模板将返回错误。

  "createMode": "Replica",
  "sourceServerId": "string"

属性值

servers

名称 说明 Value
type 资源类型 “Microsoft.DBforMySQL/servers”
apiVersion 资源 API 版本 '2017-12-01'
name 资源名称 字符串 (必需)

字符限制:3-63

有效字符:
小写字母、连字符和数字。

不能以连字符开头或结尾。

资源名称在 Azure 中必须是唯一的。
location 资源所在的位置。 字符串 (必需)
标记 键值对形式的应用程序特定元数据。 标记名称和值的字典。 请参阅 模板中的标记
sku SKU (服务器的定价层) 。 Sku
标识 服务器的 Azure Active Directory 标识。 ResourceIdentity
properties 服务器的属性。 ServerPropertiesForCreateOrServerProperties (必需)

ResourceIdentity

名称 说明 Value
type 标识类型。 将此设置为“SystemAssigned”,以便自动为资源创建和分配 Azure Active Directory 主体。 “SystemAssigned”

ServerPropertiesForCreateOrServerProperties

名称 说明
infrastructureEncryption 显示服务器是否已启用基础结构加密的状态。 “Disabled”
“已启用”
minimalTlsVersion 为服务器强制实施最低 Tls 版本。 “TLS1_0”
“TLS1_1”
“TLS1_2”
“TLSEnforcementDisabled”
publicNetworkAccess 是否允许此服务器访问公用网络。 值是可选的,但如果传入,则必须为“Enabled”或“Disabled” “Disabled”
“已启用”
sslEnforcement 在连接到服务器时是否启用 ssl 强制实施。 “Disabled”
“已启用”
storageProfile 服务器的存储配置文件。 StorageProfile
版本 服务器版本。 '5.6'
'5.7'
'8.0'
createMode 设置对象类型 Default
GeoRestore
PointInTimeRestore
需要副本 ()

StorageProfile

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 为服务器备份启用异地冗余或不启用异地冗余。 'Disabled'
'Enabled'
storageAutogrow 启用存储自动增长。 'Disabled'
'Enabled'
storageMB 服务器允许的最大存储。 int

ServerPropertiesForDefaultCreate

名称 说明
createMode 用于创建新服务器的模式。 “Default” (必需)
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器时指定,并且需要创建) 。 更新密码时需要登录名。 字符串 (必需)
administratorLoginPassword 管理员登录名的密码。 字符串 (必需)

约束:
敏感值。 作为安全参数传入。

ServerPropertiesForGeoRestore

名称 说明
createMode 用于创建新服务器的模式。 “GeoRestore” (必需)
sourceServerId 要从中还原的源服务器 ID。 字符串 (必需)

ServerPropertiesForRestore

名称 说明
createMode 用于创建新服务器的模式。 “PointInTimeRestore” (必需)
restorePointInTime 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 字符串 (必需)
sourceServerId 要从中还原的源服务器 ID。 字符串 (必需)

ServerPropertiesForReplica

名称 说明
createMode 用于创建新服务器的模式。 需要“副本” ()
sourceServerId 要从中创建副本 (replica) 的主服务器 ID。 字符串 (必需)

SKU

名称 说明
容量 纵向扩展/横向扩展容量,表示服务器的计算单位。 int

约束:
最小值 = 0
family 硬件系列。 字符串
name sku 的名称,通常为层 + 系列 + 核心,例如B_Gen4_1、GP_Gen5_8。 字符串 (必需)
大小 要由资源根据需要解释的大小代码。 字符串
特定 SKU 的层,例如基本。 'Basic'
“GeneralPurpose”
“MemoryOptimized”

快速入门模板

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

模板 说明
Buffalo Web 应用

部署到 Azure
开始快速且廉价地在 Azure 上运行 Golang Buffalo 应用程序。
使用 Jenkins 和 Azure Web 应用实现 Java CI/CD

部署到 Azure
这是使用 Jenkins 和 Azure Web 应用的 Java CI/CD 的示例。
使用 VNet 部署Azure Database for MySQL

部署到 Azure
此模板提供了一种通过 VNet 集成部署 Azure Database for MySQL 的方法。
具有 IP 限制的 Web 应用的应用程序网关

部署到 Azure
此模板在 Azure Web 应用前面创建一个应用程序网关,并在 Web 应用上启用了 IP 限制。
使用 Azure Database for MySQL 在 Linux 上生成 Web 应用

部署到 Azure
此模板提供了一种使用 Azure Database for MySQL 在 Linux 上部署Web 应用的方法。
使用 MySQL 的 Linux 上的 Sonarqube Docker Web 应用

部署到 Azure
此模板提供了一种在 Linux Web 应用上使用 Azure Database for MySQL 将 Sonarqube docker 映像 (alpine 标记) 部署的简单方法
使用 Azure Database for MySQL 的 Web 应用

部署到 Azure
此模板提供了一种使用 Azure Database for MySQL 在 Azure 应用服务 Web 应用 上部署 Web 应用的简单方法。

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

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

  • 资源组

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

资源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DBforMySQL/servers@2017-12-01"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
    {customized property} = "string"
  identity {
    type = "SystemAssigned"
  }
  body = jsonencode({
    properties = {
      infrastructureEncryption = "string"
      minimalTlsVersion = "string"
      publicNetworkAccess = "string"
      sslEnforcement = "string"
      storageProfile = {
        backupRetentionDays = int
        geoRedundantBackup = "string"
        storageAutogrow = "string"
        storageMB = int
      }
      version = "string"
      createMode = "string"
      // For remaining properties, see ServerPropertiesForCreateOrServerProperties objects
    }
    sku = {
      capacity = int
      family = "string"
      name = "string"
      size = "string"
      tier = "string"
    }
  })
}

ServerPropertiesForCreateOrServerProperties 对象

设置 createMode 属性以指定对象的类型。

对于 “默认值”,请使用:

  createMode = "Default"
  administratorLogin = "string"
  administratorLoginPassword = "string"

对于 GeoRestore,请使用:

  createMode = "GeoRestore"
  sourceServerId = "string"

对于 PointInTimeRestore,请使用:

  createMode = "PointInTimeRestore"
  restorePointInTime = "string"
  sourceServerId = "string"

对于 副本,请使用:

注意

使用模板创建具有 副本 值的 MySQL 服务器不是幂等的。 首次成功创建服务器。 但是,在副本 (replica) 服务器已存在时部署模板将返回错误。

  createMode = "Replica"
  sourceServerId = "string"

属性值

servers

名称 说明 Value
type 资源类型 “Microsoft.DBforMySQL/servers@2017-12-01”
name 资源名称 字符串 (必需)

字符限制:3-63

有效字符:
小写字母、连字符和数字。

不能以连字符开头或结尾。

资源名称在 Azure 中必须是唯一的。
location 资源所在的位置。 字符串 (必需)
parent_id 若要部署到资源组,请使用该资源组的 ID。 字符串 (必需)
标记 键值对形式的应用程序特定元数据。 标记名称和值的字典。
sku 服务器的 SKU (定价层) 。 Sku
标识 服务器的 Azure Active Directory 标识。 ResourceIdentity
properties 服务器的属性。 ServerPropertiesForCreateOrServerProperties (必需的)

ResourceIdentity

名称 说明 Value
type 标识类型。 将其设置为“SystemAssigned”,以便自动为资源创建和分配 Azure Active Directory 主体。 “SystemAssigned”

ServerPropertiesForCreateOrServerProperties

名称 说明
infrastructureEncryption 显示服务器是否启用了基础结构加密的状态。 “Disabled”
“Enabled”
minimalTlsVersion 为服务器强制实施最低 Tls 版本。 “TLS1_0”
“TLS1_1”
“TLS1_2”
“TLSEnforcementDisabled”
publicNetworkAccess 是否允许此服务器访问公用网络。 值是可选的,但如果传入,则必须为“Enabled”或“Disabled” “Disabled”
“已启用”
sslEnforcement 在连接到服务器时是否启用 ssl 强制实施。 “Disabled”
“已启用”
storageProfile 服务器的存储配置文件。 StorageProfile
版本 服务器版本。 "5.6"
"5.7"
"8.0"
createMode 设置对象类型 Default
GeoRestore
PointInTimeRestore
需要副本 ()

StorageProfile

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 为服务器备份启用异地冗余或不启用。 “Disabled”
“已启用”
storageAutogrow 启用存储自动增长。 “Disabled”
“已启用”
storageMB 服务器允许的最大存储。 int

ServerPropertiesForDefaultCreate

名称 说明
createMode 创建新服务器的模式。 “Default” (必需)
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器且需要创建) 时指定。 更新密码时需要登录名。 字符串 (必需)
administratorLoginPassword 管理员登录名的密码。 字符串 (必需)

约束:
敏感值。 作为安全参数传入。

ServerPropertiesForGeoRestore

名称 说明
createMode 创建新服务器的模式。 “GeoRestore” (必需)
sourceServerId 要从中还原的源服务器 ID。 字符串 (必需)

ServerPropertiesForRestore

名称 说明
createMode 创建新服务器的模式。 “PointInTimeRestore” (必需)
restorePointInTime 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 字符串 (必需)
sourceServerId 要从中还原的源服务器 ID。 字符串 (必需)

ServerPropertiesForReplica

名称 说明
createMode 创建新服务器的模式。 “副本” (必需)
sourceServerId 要从中创建副本 (replica) 的主服务器 ID。 字符串 (必需)

SKU

名称 说明
容量 扩展/横向扩展容量,表示服务器的计算单位。 int

约束:
最小值 = 0
family 硬件系列。 字符串
name sku 的名称,通常为层 + 系列 + 核心,例如B_Gen4_1、GP_Gen5_8。 字符串 (必需)
大小 要由资源根据需要解释的大小代码。 字符串
特定 SKU 的层,例如基本。 "Basic"
“GeneralPurpose”
“MemoryOptimized”