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

Microsoft.DBforPostgreSQL flexibleServers

Bicep 资源定义

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

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

资源格式

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

resource symbolicname 'Microsoft.DBforPostgreSQL/flexibleServers@2023-03-01-preview' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  sku: {
    name: 'string'
    tier: 'string'
  }
  identity: {
    type: 'string'
    userAssignedIdentities: {}
  }
  properties: {
    administratorLogin: 'string'
    administratorLoginPassword: 'string'
    authConfig: {
      activeDirectoryAuth: 'string'
      passwordAuth: 'string'
      tenantId: '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'
    }
    maintenanceWindow: {
      customWindow: 'string'
      dayOfWeek: int
      startHour: int
      startMinute: int
    }
    network: {
      delegatedSubnetResourceId: 'string'
      privateDnsZoneArmResourceId: 'string'
    }
    pointInTimeUTC: 'string'
    replicationRole: 'string'
    sourceServerResourceId: 'string'
    storage: {
      autoGrow: 'string'
      storageSizeGB: int
      tier: 'string'
    }
    version: 'string'
  }
}

属性值

flexibleServers

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

UserAssignedIdentity

名称 说明 Value
type 与此资源关联的标识类型;当前限制为“None 和 UserAssigned” “None”
“UserAssigned” (必需)
userAssignedIdentities 表示用户分配的标识映射。 对象 (object)

ServerProperties

名称 说明
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器时指定,并且需要创建) 。 string
administratorLoginPassword 创建服务器) (管理员登录密码。 字符串
authConfig 服务器的 AuthConfig 属性。 AuthConfig
availabilityZone 服务器的可用性区域信息。 字符串
备份 (backup) 服务器的备份属性。 备份
createMode 用于创建新的 PostgreSQL 服务器的模式。 'Create'
'Default'
“GeoRestore”
“PointInTimeRestore”
“Replica”
'ReviveDropped'
'Update'
dataEncryption 服务器的数据加密属性。 DataEncryption
highAvailability 服务器的高可用性属性。 HighAvailability
maintenanceWindow 服务器的维护时段属性。 MaintenanceWindow
network 服务器的网络属性。 仅当希望服务器为专用访问服务器时,才需要传递此 Network 属性。 Network
pointInTimeUTC 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 当“createMode”为“PointInTimeRestore”、“GeoRestore”或“ReviveDropped”时,这是必需的。 字符串
replicationRole 服务器的复制角色 “AsyncReplica”
“GeoAsyncReplica”
“None”
“Primary”
sourceServerResourceId 要从中还原的源服务器资源 ID。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“Replica”或“ReviveDropped”时,这是必需的。 仅副本服务器返回此属性 字符串
存储 服务器的存储属性。 存储
版本 PostgreSQL 服务器版本。 '11'
'12'
'13'
'14'
'15'

AuthConfig

名称 说明
activeDirectoryAuth 如果已启用,则启用 Azure Active Directory 身份验证。 “Disabled”
“已启用”
passwordAuth 如果已启用,则启用密码身份验证。 “Disabled”
“已启用”
tenantId 服务器的租户 ID。 字符串

备份

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 指示是否在服务器上启用 Geo-Redundant 备份的值。 “Disabled”
“已启用”

DataEncryption

名称 说明
geoBackupKeyURI keyvault 中用于服务器异地备份的数据加密密钥的 URI。 字符串
geoBackupUserAssignedIdentityId 用户分配的标识的资源 ID,用于服务器异地备份的数据加密。 string
primaryKeyURI keyvault 中用于主服务器数据加密的密钥的 URI。 字符串
primaryUserAssignedIdentityId 要用于主服务器数据加密的用户分配标识的资源 ID。 字符串
type 用于描述它是系统托管还是 Azure 密钥保管库的数据加密类型。 “AzureKeyVault”
“SystemManaged”

HighAvailability

名称 说明
mode 服务器的 HA 模式。 “Disabled”
“SameZone”
“ZoneRedundant”
standbyAvailabilityZone 备用数据库的可用性区域信息。 string

MaintenanceWindow

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

网络

名称 说明
delegatedSubnetResourceId 委托的子网 arm 资源 ID。如果我们希望服务器注入 VNET(即专用访问服务器),则需要在创建期间传递此服务器。 在更新期间,仅当我们想要更新专用 DNS区域的值时,才传递此项。 字符串
privateDnsZoneArmResourceId 专用 DNS 区域 arm 资源 ID。如果我们希望服务器注入 VNET(即专用访问服务器),则需要在创建过程中传递此项。 在更新期间,仅当我们想要更新专用 DNS区域的值时,才传递此项。 字符串

存储

名称 说明
autoGrow 用于为灵活服务器启用/禁用存储自动增长的标志。 'Disabled'
'Enabled'
storageSizeGB 服务器允许的最大存储。 int
IOPS 存储层的名称。 “P1”
“P10”
“P15”
“P2”
“P20”
“P3”
“P30”
“P4”
“P40”
“P50”
“P6”
'P60'
'P70'
'P80'

SKU

名称 说明
name sku 的名称,通常为层 + 系列 + 核心,例如Standard_D4s_v3。 字符串 (必需)
特定 SKU 的层,例如可突发。 'Burstable'
“GeneralPurpose”
需要“MemoryOptimized” ()

快速入门模板

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

模板 说明
使用 AAD 部署Azure Database for PostgreSQL (灵活)

部署到 Azure
此模板提供了一种通过 AAD 集成部署灵活服务器 Azure Database for PostgreSQL 的方法。
使用 VNet 部署Azure Database for PostgreSQL (灵活)

部署到 Azure
此模板提供了一种通过 VNet 集成部署灵活服务器 Azure Database for PostgreSQL 的方法。
具有 PostgreSQL 和 VNet 集成的 Web 应用上的 SonarQube

部署到 Azure
此模板提供通过 PostgreSQL 灵活服务器、VNet 集成和专用 DNS 轻松地将 SonarQube 部署到 Linux 上的 Web 应用。

ARM 模板资源定义

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

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

资源格式

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

{
  "type": "Microsoft.DBforPostgreSQL/flexibleServers",
  "apiVersion": "2023-03-01-preview",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "sku": {
    "name": "string",
    "tier": "string"
  },
  "identity": {
    "type": "string",
    "userAssignedIdentities": {}
  },
  "properties": {
    "administratorLogin": "string",
    "administratorLoginPassword": "string",
    "authConfig": {
      "activeDirectoryAuth": "string",
      "passwordAuth": "string",
      "tenantId": "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"
    },
    "maintenanceWindow": {
      "customWindow": "string",
      "dayOfWeek": "int",
      "startHour": "int",
      "startMinute": "int"
    },
    "network": {
      "delegatedSubnetResourceId": "string",
      "privateDnsZoneArmResourceId": "string"
    },
    "pointInTimeUTC": "string",
    "replicationRole": "string",
    "sourceServerResourceId": "string",
    "storage": {
      "autoGrow": "string",
      "storageSizeGB": "int",
      "tier": "string"
    },
    "version": "string"
  }
}

属性值

flexibleServers

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

UserAssignedIdentity

名称 说明 Value
type 与此资源关联的标识类型;当前限制为“None 和 UserAssigned” “None”
“UserAssigned” (必需)
userAssignedIdentities 表示用户分配的标识映射。 对象 (object)

ServerProperties

名称 说明
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器且需要创建) 时指定。 字符串
administratorLoginPassword (创建服务器) 所需的管理员登录密码。 字符串
authConfig 服务器的 AuthConfig 属性。 AuthConfig
availabilityZone 服务器的可用性区域信息。 字符串
备份 (backup) 服务器的备份属性。 备份
createMode 创建新 PostgreSQL 服务器的模式。 “创建”
'Default'
“GeoRestore”
“PointInTimeRestore”
“副本”
“ReviveDropped”
“Update”
dataEncryption 服务器的数据加密属性。 DataEncryption
highAvailability 服务器的高可用性属性。 HighAvailability
maintenanceWindow 服务器的维护时段属性。 MaintenanceWindow
network 服务器的网络属性。 仅当希望服务器为专用访问服务器时,才需要传递此 Network 属性。 Network
pointInTimeUTC 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“ReviveDropped”时,这是必需的。 字符串
replicationRole 服务器的复制角色 “AsyncReplica”
“GeoAsyncReplica”
“None”
“Primary”
sourceServerResourceId 要从中还原的源服务器资源 ID。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“Replica”或“ReviveDropped”时,这是必需的。 仅副本服务器返回此属性 字符串
存储 服务器的存储属性。 存储
版本 PostgreSQL 服务器版本。 '11'
'12'
'13'
'14'
'15'

AuthConfig

名称 说明
activeDirectoryAuth 如果已启用,则启用 Azure Active Directory 身份验证。 “Disabled”
“已启用”
passwordAuth 如果已启用,则启用密码身份验证。 “Disabled”
“已启用”
tenantId 服务器的租户 ID。 字符串

备份

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 指示是否在服务器上启用 Geo-Redundant 备份的值。 “Disabled”
“已启用”

DataEncryption

名称 说明
geoBackupKeyURI keyvault 中用于服务器异地备份的数据加密密钥的 URI。 字符串
geoBackupUserAssignedIdentityId 用户分配的标识的资源 ID,用于服务器异地备份的数据加密。 字符串
primaryKeyURI keyvault 中用于主服务器数据加密的密钥的 URI。 string
primaryUserAssignedIdentityId 要用于主服务器数据加密的用户分配标识的资源 ID。 字符串
type 用于描述它是系统托管还是 Azure 密钥保管库的数据加密类型。 “AzureKeyVault”
“SystemManaged”

HighAvailability

名称 说明
mode 服务器的 HA 模式。 “Disabled”
“SameZone”
“ZoneRedundant”
standbyAvailabilityZone 备用数据库的可用性区域信息。 string

MaintenanceWindow

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

网络

名称 说明
delegatedSubnetResourceId 委托的子网 arm 资源 ID。如果我们希望服务器注入 VNET(即专用访问服务器),则需要在创建期间传递此服务器。 在更新期间,仅当我们想要更新专用 DNS区域的值时传递此值。 字符串
privateDnsZoneArmResourceId 专用 dns 区域 arm 资源 ID。如果我们希望服务器注入 VNET(即专用访问服务器),则需要在创建期间传递此服务器。 在更新期间,仅当我们想要更新专用 DNS区域的值时传递此值。 字符串

存储

名称 说明
autoGrow 为灵活服务器启用/禁用存储自动增长的标志。 “Disabled”
“已启用”
storageSizeGB 服务器允许的最大存储。 int
IOPS 存储层的名称。 “P1”
“P10”
“P15”
“P2”
“P20”
“P3”
“P30”
“P4”
“P40”
“P50”
“P6”
“P60”
“P70”
“P80”

SKU

名称 说明
name SKU 的名称,通常为层 + 系列 + 核心,例如Standard_D4s_v3。 字符串 (必需)
特定 SKU 的层,例如可突发的。 “突发”
“GeneralPurpose”
需要“MemoryOptimized” ()

快速入门模板

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

模板 说明
使用 AAD 部署Azure Database for PostgreSQL (灵活)

部署到 Azure
此模板提供了一种使用 AAD 集成部署灵活服务器 Azure Database for PostgreSQL 的方法。
使用 VNet 部署Azure Database for PostgreSQL (灵活)

部署到 Azure
此模板提供了一种通过 VNet 集成部署灵活服务器 Azure Database for PostgreSQL 的方法。
使用 PostgreSQL 和 VNet 集成的 Web 应用上的 SonarQube

部署到 Azure
此模板提供通过 PostgreSQL 灵活服务器、VNet 集成和专用 DNS 轻松将 SonarQube 部署到 Linux 上的 Web 应用。

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

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

  • 资源组

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

资源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DBforPostgreSQL/flexibleServers@2023-03-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"
      authConfig = {
        activeDirectoryAuth = "string"
        passwordAuth = "string"
        tenantId = "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"
      }
      maintenanceWindow = {
        customWindow = "string"
        dayOfWeek = int
        startHour = int
        startMinute = int
      }
      network = {
        delegatedSubnetResourceId = "string"
        privateDnsZoneArmResourceId = "string"
      }
      pointInTimeUTC = "string"
      replicationRole = "string"
      sourceServerResourceId = "string"
      storage = {
        autoGrow = "string"
        storageSizeGB = int
        tier = "string"
      }
      version = "string"
    }
    sku = {
      name = "string"
      tier = "string"
    }
  })
}

属性值

flexibleServers

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

UserAssignedIdentity

名称 说明 Value
type 与此资源关联的标识类型;当前限制为“None and UserAssigned” “UserAssigned” (必需)
identity_ids 表示用户分配的标识映射。 用户标识 ID 数组。

ServerProperties

名称 说明
administratorLogin 服务器的管理员登录名。 只能在 (创建服务器且需要创建) 时指定。 string
administratorLoginPassword (创建服务器) 所需的管理员登录密码。 string
authConfig 服务器的 AuthConfig 属性。 AuthConfig
availabilityZone 服务器的可用性区域信息。 字符串
备份 (backup) 服务器的备份属性。 备份
createMode 创建新 PostgreSQL 服务器的模式。 “创建”
“Default”
“GeoRestore”
“PointInTimeRestore”
“副本”
“ReviveDropped”
“更新”
dataEncryption 服务器的数据加密属性。 DataEncryption
highAvailability 服务器的高可用性属性。 HighAvailability
maintenanceWindow 服务器的维护时段属性。 MaintenanceWindow
network 服务器的网络属性。 仅当希望服务器为专用访问服务器时,才需要传递此 Network 属性。 Network
pointInTimeUTC 还原点创建时间 (ISO8601 格式) ,指定要从其还原的时间。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“ReviveDropped”时,这是必需的。 string
replicationRole 服务器的复制角色 “AsyncReplica”
“GeoAsyncReplica”
"None"
“Primary”
sourceServerResourceId 要从中还原的源服务器资源 ID。 当“createMode”为“PointInTimeRestore”、“GeoRestore”或“Replica”或“ReviveDropped”时,需要它。 此属性仅为副本服务器返回 字符串
存储 服务器的存储属性。 存储
版本 PostgreSQL 服务器版本。 "11"
"12"
"13"
"14"
“15”

AuthConfig

名称 说明
activeDirectoryAuth 如果已启用,则启用 Azure Active Directory 身份验证。 “Disabled”
“Enabled”
passwordAuth 如果已启用,则启用密码身份验证。 “Disabled”
“Enabled”
tenantId 服务器的租户 ID。 字符串

备份

名称 说明
backupRetentionDays 服务器的备份保留天数。 int
geoRedundantBackup 一个 值,该值指示服务器上是否启用了 Geo-Redundant 备份。 “Disabled”
“Enabled”

DataEncryption

名称 说明
geoBackupKeyURI keyvault 中密钥的 URI,用于服务器异地备份的数据加密。 string
geoBackupUserAssignedIdentityId 要用于服务器异地备份的数据加密的用户分配标识的资源 ID。 字符串
primaryKeyURI keyvault 中密钥的 URI,用于主服务器的数据加密。 string
primaryUserAssignedIdentityId 要用于主服务器数据加密的用户分配标识的资源 ID。 字符串
type 数据加密类型,用于描述它是系统托管还是 Azure Key Vault。 “AzureKeyVault”
“SystemManaged”

HighAvailability

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

MaintenanceWindow

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

网络

名称 说明
delegatedSubnetResourceId 委托的子网 arm 资源 ID。如果我们希望服务器注入 VNET(即专用访问服务器),则需要在创建过程中传递此项。 在更新期间,仅当我们想要更新专用 DNS区域的值时,才传递此项。 字符串
privateDnsZoneArmResourceId 专用 DNS 区域 arm 资源 ID。如果我们希望服务器注入 VNET(即专用访问服务器),则需要在创建过程中传递此项。 在更新期间,仅当我们想要更新专用 DNS区域的值时,才传递此项。 字符串

存储

名称 说明
autoGrow 用于为灵活服务器启用/禁用存储自动增长的标志。 “Disabled”
“Enabled”
storageSizeGB 服务器允许的最大存储。 int
IOPS 存储层的名称。 “P1”
“P10”
“P15”
“P2”
“P20”
“P3”
“P30”
“P4”
“P40”
“P50”
“P6”
“P60”
“P70”
“P80”

SKU

名称 说明
name sku 的名称,通常为层 + 系列 + 核心,例如Standard_D4s_v3。 字符串 (必需)
特定 SKU 的层,例如可突发。 “突发”
“GeneralPurpose”
需要“MemoryOptimized” ()