你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Bicep 资源定义
可以使用目标操作部署 flexibleServers 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DBforPostgreSQL/flexibleServers 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.DBforPostgreSQL/flexibleServers@2023-06-01-preview' = {
scope: resourceSymbolicName or scope
identity: {
type: 'string'
userAssignedIdentities: {
{customized property}: {
clientId: 'string'
principalId: 'string'
}
}
}
location: 'string'
name: 'string'
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'
publicNetworkAccess: 'string'
}
pointInTimeUTC: 'string'
replica: {
promoteMode: 'string'
promoteOption: 'string'
role: 'string'
}
replicationRole: 'string'
sourceServerResourceId: 'string'
storage: {
autoGrow: 'string'
iops: int
storageSizeGB: int
throughput: int
tier: 'string'
type: 'string'
}
version: 'string'
}
sku: {
name: 'string'
tier: 'string'
}
tags: {
{customized property}: 'string'
}
}
属性值
Microsoft.DBforPostgreSQL/flexibleServers
| 名字 | 描述 | 价值 |
|---|---|---|
| 标识 | 描述应用程序的标识。 | UserAssignedIdentity |
| 位置 | 资源所在的地理位置 | string (必需) |
| 名字 | 资源名称 | 字符串 约束: 最小长度 = 3 最大长度 = 63 模式 = ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)* (必需) |
| 性能 | 服务器的属性。 | ServerProperties |
| 作用域 | 在与部署范围不同的范围内创建资源时使用。 | 将此属性设置为资源的符号名称以应用 扩展资源。 |
| SKU | 服务器的 SKU(定价层)。 | SKU |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
身份验证配置
| 名字 | 描述 | 价值 |
|---|---|---|
| activeDirectoryAuth 的 | 如果已启用,则会启用 Azure Active Directory 身份验证。 | “Disabled” “Enabled” |
| passwordAuth | 如果已启用,则启用密码身份验证。 | “Disabled” “Enabled” |
| 租户ID | 服务器的租户 ID。 | 字符串 |
备份
| 名字 | 描述 | 价值 |
|---|---|---|
| backupRetentionDays 备份 | 服务器的备份保留日。 | 整数 (int) |
| geoRedundantBackup | 一个值,该值指示是否在服务器上启用 Geo-Redundant 备份。 | “Disabled” “Enabled” |
数据加密
| 名字 | 描述 | 价值 |
|---|---|---|
| geoBackupKeyURI 的 | keyvault 中密钥的 URI,用于对服务器进行异地备份的数据加密。 | 字符串 |
| geoBackupUserAssignedIdentityId | 要用于服务器异地备份的数据加密的用户分配标识的资源 ID。 | 字符串 |
| primaryKeyURI 的 | keyvault 中密钥的 URI,用于主服务器的数据加密。 | 字符串 |
| primaryUserAssignedIdentityId | 要用于主服务器数据加密的用户分配标识的资源 ID。 | 字符串 |
| 类型 | 用于描述其是否为系统托管与 Azure Key Vault 的数据加密类型。 | “AzureKeyVault” “SystemManaged” |
高可用性
| 名字 | 描述 | 价值 |
|---|---|---|
| 模式 | 服务器的 HA 模式。 | “Disabled” “SameZone” “ZoneRedundant” |
| standbyAvailabilityZone | 备用服务器的可用性区域信息。 | 字符串 |
MaintenanceWindow (维护窗口)
| 名字 | 描述 | 价值 |
|---|---|---|
| 自定义窗口 | 指示是启用还是禁用自定义窗口 | 字符串 |
| dayOfWeek (周) | 维护时段的星期几 | 整数 (int) |
| startHour (开始小时) | 维护时段的开始时间 | 整数 (int) |
| startMinute (开始分钟) | 维护时段的开始时间 | 整数 (int) |
网络
| 名字 | 描述 | 价值 |
|---|---|---|
| delegatedSubnetResourceId | 委派的子网 arm 资源 ID。在创建过程中需要传递此项,以防我们希望服务器注入 VNET,即专用访问服务器。 在更新期间,仅当我们想要更新专用 DNS 区域的值时,才传递此值。 | 字符串 |
| privateDnsZoneArmResourceId | 专用 dns 区域 arm 资源 ID。在创建过程中需要传递此项,以防我们希望服务器注入 VNET,即专用访问服务器。 在更新期间,仅当我们想要更新专用 DNS 区域的值时,才传递此值。 | 字符串 |
| publicNetworkAccess | 已启用或未启用公用网络访问 | “Disabled” “Enabled” |
复制品
| 名字 | 描述 | 价值 |
|---|---|---|
| promoteMode | 设置副本服务器的提升模式。 这是一个仅写入属性。 | “独立” “switchover” |
| promote选项 | 设置副本服务器的提升选项。 这是一个仅写入属性。 | “forced” “计划” |
| 角色 | 用于指示复制集中服务器的角色。 | “AsyncReplica” “GeoAsyncReplica” “None” “Primary” |
ServerProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| 管理员登录 | 管理员的服务器登录名。 只能在创建服务器时指定(并且是创建所必需的)。 | 字符串 |
| administratorLoginPassword | 管理员登录密码(创建服务器时需要)。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| authConfig 认证 | 服务器的 AuthConfig 属性。 | 身份验证配置 |
| 可用性区域 | 服务器的可用性区域信息。 | 字符串 |
| 备份 | 服务器的备份属性。 | 备份 |
| createMode | 创建新的 PostgreSQL 服务器的模式。 | “Create” “Default” “GeoRestore” “PointInTimeRestore” “Replica” “ReviveDropped” “Update” |
| 数据加密 | 服务器的数据加密属性。 | 数据加密 |
| 高可用性 | 服务器的高可用性属性。 | 高可用性 |
| 维护窗口 | 服务器的维护时段属性。 | MaintenanceWindow (维护窗口) |
| 网络 | 服务器的网络属性。 仅当希望服务器成为专用访问服务器时,才需要传递此网络属性。 | 网络 |
| pointInTimeUTC | 还原点创建时间(ISO8601格式),指定要从中还原的时间。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“ReviveDropped”时,它是必需的。 | 字符串 |
| 副本 | 服务器的副本属性。 仅当想要升级服务器时,才需要传递这些副本属性。 | 副本 |
| replicationRole | 服务器的复制角色 | “AsyncReplica” “GeoAsyncReplica” “None” “Primary” |
| sourceServerResourceId | 要从中还原的源服务器资源 ID。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“Replica”或“ReviveDropped”时,它是必需的。 此属性仅针对副本服务器返回 | 字符串 |
| 存储 | 服务器的存储属性。 | 存储 |
| 版本 | PostgreSQL 服务器版本。 | '11' '12' '13' '14' '15' '16' |
SKU
| 名字 | 描述 | 价值 |
|---|---|---|
| 名字 | SKU 的名称,通常为层 + 系列 + 核心,例如Standard_D4s_v3。 | string (必需) |
| 分层 | 特定 SKU 的层,例如可突发。 | “可突发” “GeneralPurpose” “MemoryOptimized”(必需) |
存储
| 名字 | 描述 | 价值 |
|---|---|---|
| 自动增长 | 为灵活服务器启用/禁用存储自动增长的标志。 | “Disabled” “Enabled” |
| IOPS (国际速率) | 存储层 IOPS 数量。 必须为存储类型PremiumV2_LRS设置此属性 | 整数 (int) |
| 存储大小GB | 服务器允许的最大存储。 | 整数 (int) |
| 吞吐量 | 服务器的存储吞吐量。 这是为存储类型PremiumV2_LRS设置所必需的 | 整数 (int) |
| 分层 | IOPS 的存储层的名称。 | “P1” “P10” “P15” “P2” “P20” “P3” “P30” “P4” “P40” “P50” “P6” “P60” “P70” “P80” |
| 类型 | 服务器的存储类型。 允许的值是Premium_LRS和PremiumV2_LRS,如果未指定,则默认为Premium_LRS | “PremiumV2_LRS” “Premium_LRS” |
TrackedResourceTags
| 名字 | 描述 | 价值 |
|---|
UserAssignedIdentity
| 名字 | 描述 | 价值 |
|---|---|---|
| 类型 | 与此资源关联的标识类型;当前限制为“None 和 UserAssigned” | “None” “UserAssigned”(必需) |
| 用户分配的标识 | 表示用户分配的标识映射。 | UserAssignedIdentityMap |
UserAssignedIdentityMap
| 名字 | 描述 | 价值 |
|---|
用户身份
| 名字 | 描述 | 价值 |
|---|---|---|
| 客户端 ID | 此标识表示的服务主体的客户端标识符。 | 字符串 |
| principalId (主体ID) | 此标识表示的服务主体的对象标识符。 | 字符串 |
用法示例
Azure 验证模块
以下 Azure 验证模块 可用于部署此资源类型。
| 模块 | 描述 |
|---|---|
| DB for Postgre SQL 灵活服务器 | 用于 Postgre SQL 灵活服务器的 DB 的 AVM 资源模块 |
Azure 快速入门示例
以下 Azure 快速入门模板 包含用于部署此资源类型的 Bicep 示例。
| Bicep 文件 | 描述 |
|---|---|
| 创建 PgFlex 服务器 & 通过备份保管库 启用保护 | 创建 PostgreSQL 灵活服务器的模板,并通过备份保管库启用保护 |
| 使用 AAD 部署 Azure Database for PostgreSQL(灵活) |
此模板提供了部署灵活服务器 Azure Database for PostgreSQL 和 AAD 集成的方法。 |
| 使用 VNet 部署 Azure Database for PostgreSQL (灵活) | 此模板提供了部署灵活服务器 Azure Database for PostgreSQL 和 VNet 集成的方法。 |
| 使用 PostgreSQL 和 VNet 集成的 Web 应用 SonarQube | 此模板提供使用 PostgreSQL 灵活服务器、VNet 集成和专用 DNS 轻松将 SonarQube 部署到 Linux 上的 Web 应用。 |
ARM 模板资源定义
可以使用目标操作部署 flexibleServers 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DBforPostgreSQL/flexibleServers 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.DBforPostgreSQL/flexibleServers",
"apiVersion": "2023-06-01-preview",
"name": "string",
"identity": {
"type": "string",
"userAssignedIdentities": {
"{customized property}": {
"clientId": "string",
"principalId": "string"
}
}
},
"location": "string",
"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",
"publicNetworkAccess": "string"
},
"pointInTimeUTC": "string",
"replica": {
"promoteMode": "string",
"promoteOption": "string",
"role": "string"
},
"replicationRole": "string",
"sourceServerResourceId": "string",
"storage": {
"autoGrow": "string",
"iops": "int",
"storageSizeGB": "int",
"throughput": "int",
"tier": "string",
"type": "string"
},
"version": "string"
},
"sku": {
"name": "string",
"tier": "string"
},
"tags": {
"{customized property}": "string"
}
}
属性值
Microsoft.DBforPostgreSQL/flexibleServers
| 名字 | 描述 | 价值 |
|---|---|---|
| apiVersion | API 版本 | “2023-06-01-预览” |
| 标识 | 描述应用程序的标识。 | UserAssignedIdentity |
| 位置 | 资源所在的地理位置 | string (必需) |
| 名字 | 资源名称 | 字符串 约束: 最小长度 = 3 最大长度 = 63 模式 = ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)* (必需) |
| 性能 | 服务器的属性。 | ServerProperties |
| SKU | 服务器的 SKU(定价层)。 | SKU |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
| 类型 | 资源类型 | “Microsoft.DBforPostgreSQL/flexibleServers” |
身份验证配置
| 名字 | 描述 | 价值 |
|---|---|---|
| activeDirectoryAuth 的 | 如果已启用,则会启用 Azure Active Directory 身份验证。 | “Disabled” “Enabled” |
| passwordAuth | 如果已启用,则启用密码身份验证。 | “Disabled” “Enabled” |
| 租户ID | 服务器的租户 ID。 | 字符串 |
备份
| 名字 | 描述 | 价值 |
|---|---|---|
| backupRetentionDays 备份 | 服务器的备份保留日。 | 整数 (int) |
| geoRedundantBackup | 一个值,该值指示是否在服务器上启用 Geo-Redundant 备份。 | “Disabled” “Enabled” |
数据加密
| 名字 | 描述 | 价值 |
|---|---|---|
| geoBackupKeyURI 的 | keyvault 中密钥的 URI,用于对服务器进行异地备份的数据加密。 | 字符串 |
| geoBackupUserAssignedIdentityId | 要用于服务器异地备份的数据加密的用户分配标识的资源 ID。 | 字符串 |
| primaryKeyURI 的 | keyvault 中密钥的 URI,用于主服务器的数据加密。 | 字符串 |
| primaryUserAssignedIdentityId | 要用于主服务器数据加密的用户分配标识的资源 ID。 | 字符串 |
| 类型 | 用于描述其是否为系统托管与 Azure Key Vault 的数据加密类型。 | “AzureKeyVault” “SystemManaged” |
高可用性
| 名字 | 描述 | 价值 |
|---|---|---|
| 模式 | 服务器的 HA 模式。 | “Disabled” “SameZone” “ZoneRedundant” |
| standbyAvailabilityZone | 备用服务器的可用性区域信息。 | 字符串 |
MaintenanceWindow (维护窗口)
| 名字 | 描述 | 价值 |
|---|---|---|
| 自定义窗口 | 指示是启用还是禁用自定义窗口 | 字符串 |
| dayOfWeek (周) | 维护时段的星期几 | 整数 (int) |
| startHour (开始小时) | 维护时段的开始时间 | 整数 (int) |
| startMinute (开始分钟) | 维护时段的开始时间 | 整数 (int) |
网络
| 名字 | 描述 | 价值 |
|---|---|---|
| delegatedSubnetResourceId | 委派的子网 arm 资源 ID。在创建过程中需要传递此项,以防我们希望服务器注入 VNET,即专用访问服务器。 在更新期间,仅当我们想要更新专用 DNS 区域的值时,才传递此值。 | 字符串 |
| privateDnsZoneArmResourceId | 专用 dns 区域 arm 资源 ID。在创建过程中需要传递此项,以防我们希望服务器注入 VNET,即专用访问服务器。 在更新期间,仅当我们想要更新专用 DNS 区域的值时,才传递此值。 | 字符串 |
| publicNetworkAccess | 已启用或未启用公用网络访问 | “Disabled” “Enabled” |
复制品
| 名字 | 描述 | 价值 |
|---|---|---|
| promoteMode | 设置副本服务器的提升模式。 这是一个仅写入属性。 | “独立” “switchover” |
| promote选项 | 设置副本服务器的提升选项。 这是一个仅写入属性。 | “forced” “计划” |
| 角色 | 用于指示复制集中服务器的角色。 | “AsyncReplica” “GeoAsyncReplica” “None” “Primary” |
ServerProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| 管理员登录 | 管理员的服务器登录名。 只能在创建服务器时指定(并且是创建所必需的)。 | 字符串 |
| administratorLoginPassword | 管理员登录密码(创建服务器时需要)。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| authConfig 认证 | 服务器的 AuthConfig 属性。 | 身份验证配置 |
| 可用性区域 | 服务器的可用性区域信息。 | 字符串 |
| 备份 | 服务器的备份属性。 | 备份 |
| createMode | 创建新的 PostgreSQL 服务器的模式。 | “Create” “Default” “GeoRestore” “PointInTimeRestore” “Replica” “ReviveDropped” “Update” |
| 数据加密 | 服务器的数据加密属性。 | 数据加密 |
| 高可用性 | 服务器的高可用性属性。 | 高可用性 |
| 维护窗口 | 服务器的维护时段属性。 | MaintenanceWindow (维护窗口) |
| 网络 | 服务器的网络属性。 仅当希望服务器成为专用访问服务器时,才需要传递此网络属性。 | 网络 |
| pointInTimeUTC | 还原点创建时间(ISO8601格式),指定要从中还原的时间。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“ReviveDropped”时,它是必需的。 | 字符串 |
| 副本 | 服务器的副本属性。 仅当想要升级服务器时,才需要传递这些副本属性。 | 副本 |
| replicationRole | 服务器的复制角色 | “AsyncReplica” “GeoAsyncReplica” “None” “Primary” |
| sourceServerResourceId | 要从中还原的源服务器资源 ID。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“Replica”或“ReviveDropped”时,它是必需的。 此属性仅针对副本服务器返回 | 字符串 |
| 存储 | 服务器的存储属性。 | 存储 |
| 版本 | PostgreSQL 服务器版本。 | '11' '12' '13' '14' '15' '16' |
SKU
| 名字 | 描述 | 价值 |
|---|---|---|
| 名字 | SKU 的名称,通常为层 + 系列 + 核心,例如Standard_D4s_v3。 | string (必需) |
| 分层 | 特定 SKU 的层,例如可突发。 | “可突发” “GeneralPurpose” “MemoryOptimized”(必需) |
存储
| 名字 | 描述 | 价值 |
|---|---|---|
| 自动增长 | 为灵活服务器启用/禁用存储自动增长的标志。 | “Disabled” “Enabled” |
| IOPS (国际速率) | 存储层 IOPS 数量。 必须为存储类型PremiumV2_LRS设置此属性 | 整数 (int) |
| 存储大小GB | 服务器允许的最大存储。 | 整数 (int) |
| 吞吐量 | 服务器的存储吞吐量。 这是为存储类型PremiumV2_LRS设置所必需的 | 整数 (int) |
| 分层 | IOPS 的存储层的名称。 | “P1” “P10” “P15” “P2” “P20” “P3” “P30” “P4” “P40” “P50” “P6” “P60” “P70” “P80” |
| 类型 | 服务器的存储类型。 允许的值是Premium_LRS和PremiumV2_LRS,如果未指定,则默认为Premium_LRS | “PremiumV2_LRS” “Premium_LRS” |
TrackedResourceTags
| 名字 | 描述 | 价值 |
|---|
UserAssignedIdentity
| 名字 | 描述 | 价值 |
|---|---|---|
| 类型 | 与此资源关联的标识类型;当前限制为“None 和 UserAssigned” | “None” “UserAssigned”(必需) |
| 用户分配的标识 | 表示用户分配的标识映射。 | UserAssignedIdentityMap |
UserAssignedIdentityMap
| 名字 | 描述 | 价值 |
|---|
用户身份
| 名字 | 描述 | 价值 |
|---|---|---|
| 客户端 ID | 此标识表示的服务主体的客户端标识符。 | 字符串 |
| principalId (主体ID) | 此标识表示的服务主体的对象标识符。 | 字符串 |
用法示例
Azure 快速入门模板
以下 Azure 快速入门模板 部署此资源类型。
| 模板 | 描述 |
|---|---|
|
创建 PgFlex 服务器 & 通过备份保管库 启用保护 |
创建 PostgreSQL 灵活服务器的模板,并通过备份保管库启用保护 |
| 使用 AAD 部署 Azure Database for PostgreSQL(灵活) |
此模板提供了部署灵活服务器 Azure Database for PostgreSQL 和 AAD 集成的方法。 |
|
使用 VNet 部署 Azure Database for PostgreSQL (灵活) |
此模板提供了部署灵活服务器 Azure Database for PostgreSQL 和 VNet 集成的方法。 |
| 使用 PostgreSQL 和 VNet 集成的 Web 应用 SonarQube |
此模板提供使用 PostgreSQL 灵活服务器、VNet 集成和专用 DNS 轻松将 SonarQube 部署到 Linux 上的 Web 应用。 |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署 flexibleServers 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DBforPostgreSQL/flexibleServers 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DBforPostgreSQL/flexibleServers@2023-06-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"
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"
publicNetworkAccess = "string"
}
pointInTimeUTC = "string"
replica = {
promoteMode = "string"
promoteOption = "string"
role = "string"
}
replicationRole = "string"
sourceServerResourceId = "string"
storage = {
autoGrow = "string"
iops = int
storageSizeGB = int
throughput = int
tier = "string"
type = "string"
}
version = "string"
}
sku = {
name = "string"
tier = "string"
}
}
}
属性值
Microsoft.DBforPostgreSQL/flexibleServers
| 名字 | 描述 | 价值 |
|---|---|---|
| 标识 | 描述应用程序的标识。 | UserAssignedIdentity |
| 位置 | 资源所在的地理位置 | string (必需) |
| 名字 | 资源名称 | 字符串 约束: 最小长度 = 3 最大长度 = 63 模式 = ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)* (必需) |
| parent_id | 要向其应用此扩展资源的资源的 ID。 | string (必需) |
| 性能 | 服务器的属性。 | ServerProperties |
| SKU | 服务器的 SKU(定价层)。 | SKU |
| 标签 | 资源标记 | 标记名称和值的字典。 |
| 类型 | 资源类型 | “Microsoft.DBforPostgreSQL/flexibleServers@2023-06-01-preview” |
身份验证配置
| 名字 | 描述 | 价值 |
|---|---|---|
| activeDirectoryAuth 的 | 如果已启用,则会启用 Azure Active Directory 身份验证。 | “Disabled” “Enabled” |
| passwordAuth | 如果已启用,则启用密码身份验证。 | “Disabled” “Enabled” |
| 租户ID | 服务器的租户 ID。 | 字符串 |
备份
| 名字 | 描述 | 价值 |
|---|---|---|
| backupRetentionDays 备份 | 服务器的备份保留日。 | 整数 (int) |
| geoRedundantBackup | 一个值,该值指示是否在服务器上启用 Geo-Redundant 备份。 | “Disabled” “Enabled” |
数据加密
| 名字 | 描述 | 价值 |
|---|---|---|
| geoBackupKeyURI 的 | keyvault 中密钥的 URI,用于对服务器进行异地备份的数据加密。 | 字符串 |
| geoBackupUserAssignedIdentityId | 要用于服务器异地备份的数据加密的用户分配标识的资源 ID。 | 字符串 |
| primaryKeyURI 的 | keyvault 中密钥的 URI,用于主服务器的数据加密。 | 字符串 |
| primaryUserAssignedIdentityId | 要用于主服务器数据加密的用户分配标识的资源 ID。 | 字符串 |
| 类型 | 用于描述其是否为系统托管与 Azure Key Vault 的数据加密类型。 | “AzureKeyVault” “SystemManaged” |
高可用性
| 名字 | 描述 | 价值 |
|---|---|---|
| 模式 | 服务器的 HA 模式。 | “Disabled” “SameZone” “ZoneRedundant” |
| standbyAvailabilityZone | 备用服务器的可用性区域信息。 | 字符串 |
MaintenanceWindow (维护窗口)
| 名字 | 描述 | 价值 |
|---|---|---|
| 自定义窗口 | 指示是启用还是禁用自定义窗口 | 字符串 |
| dayOfWeek (周) | 维护时段的星期几 | 整数 (int) |
| startHour (开始小时) | 维护时段的开始时间 | 整数 (int) |
| startMinute (开始分钟) | 维护时段的开始时间 | 整数 (int) |
网络
| 名字 | 描述 | 价值 |
|---|---|---|
| delegatedSubnetResourceId | 委派的子网 arm 资源 ID。在创建过程中需要传递此项,以防我们希望服务器注入 VNET,即专用访问服务器。 在更新期间,仅当我们想要更新专用 DNS 区域的值时,才传递此值。 | 字符串 |
| privateDnsZoneArmResourceId | 专用 dns 区域 arm 资源 ID。在创建过程中需要传递此项,以防我们希望服务器注入 VNET,即专用访问服务器。 在更新期间,仅当我们想要更新专用 DNS 区域的值时,才传递此值。 | 字符串 |
| publicNetworkAccess | 已启用或未启用公用网络访问 | “Disabled” “Enabled” |
复制品
| 名字 | 描述 | 价值 |
|---|---|---|
| promoteMode | 设置副本服务器的提升模式。 这是一个仅写入属性。 | “独立” “switchover” |
| promote选项 | 设置副本服务器的提升选项。 这是一个仅写入属性。 | “forced” “计划” |
| 角色 | 用于指示复制集中服务器的角色。 | “AsyncReplica” “GeoAsyncReplica” “None” “Primary” |
ServerProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| 管理员登录 | 管理员的服务器登录名。 只能在创建服务器时指定(并且是创建所必需的)。 | 字符串 |
| administratorLoginPassword | 管理员登录密码(创建服务器时需要)。 | 字符串 约束: 敏感值。 以安全参数的形式传入。 |
| authConfig 认证 | 服务器的 AuthConfig 属性。 | 身份验证配置 |
| 可用性区域 | 服务器的可用性区域信息。 | 字符串 |
| 备份 | 服务器的备份属性。 | 备份 |
| createMode | 创建新的 PostgreSQL 服务器的模式。 | “Create” “Default” “GeoRestore” “PointInTimeRestore” “Replica” “ReviveDropped” “Update” |
| 数据加密 | 服务器的数据加密属性。 | 数据加密 |
| 高可用性 | 服务器的高可用性属性。 | 高可用性 |
| 维护窗口 | 服务器的维护时段属性。 | MaintenanceWindow (维护窗口) |
| 网络 | 服务器的网络属性。 仅当希望服务器成为专用访问服务器时,才需要传递此网络属性。 | 网络 |
| pointInTimeUTC | 还原点创建时间(ISO8601格式),指定要从中还原的时间。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“ReviveDropped”时,它是必需的。 | 字符串 |
| 副本 | 服务器的副本属性。 仅当想要升级服务器时,才需要传递这些副本属性。 | 副本 |
| replicationRole | 服务器的复制角色 | “AsyncReplica” “GeoAsyncReplica” “None” “Primary” |
| sourceServerResourceId | 要从中还原的源服务器资源 ID。 当“createMode”为“PointInTimeRestore”或“GeoRestore”或“Replica”或“ReviveDropped”时,它是必需的。 此属性仅针对副本服务器返回 | 字符串 |
| 存储 | 服务器的存储属性。 | 存储 |
| 版本 | PostgreSQL 服务器版本。 | '11' '12' '13' '14' '15' '16' |
SKU
| 名字 | 描述 | 价值 |
|---|---|---|
| 名字 | SKU 的名称,通常为层 + 系列 + 核心,例如Standard_D4s_v3。 | string (必需) |
| 分层 | 特定 SKU 的层,例如可突发。 | “可突发” “GeneralPurpose” “MemoryOptimized”(必需) |
存储
| 名字 | 描述 | 价值 |
|---|---|---|
| 自动增长 | 为灵活服务器启用/禁用存储自动增长的标志。 | “Disabled” “Enabled” |
| IOPS (国际速率) | 存储层 IOPS 数量。 必须为存储类型PremiumV2_LRS设置此属性 | 整数 (int) |
| 存储大小GB | 服务器允许的最大存储。 | 整数 (int) |
| 吞吐量 | 服务器的存储吞吐量。 这是为存储类型PremiumV2_LRS设置所必需的 | 整数 (int) |
| 分层 | IOPS 的存储层的名称。 | “P1” “P10” “P15” “P2” “P20” “P3” “P30” “P4” “P40” “P50” “P6” “P60” “P70” “P80” |
| 类型 | 服务器的存储类型。 允许的值是Premium_LRS和PremiumV2_LRS,如果未指定,则默认为Premium_LRS | “PremiumV2_LRS” “Premium_LRS” |
TrackedResourceTags
| 名字 | 描述 | 价值 |
|---|
UserAssignedIdentity
| 名字 | 描述 | 价值 |
|---|---|---|
| 类型 | 与此资源关联的标识类型;当前限制为“None 和 UserAssigned” | “None” “UserAssigned”(必需) |
| 用户分配的标识 | 表示用户分配的标识映射。 | UserAssignedIdentityMap |
UserAssignedIdentityMap
| 名字 | 描述 | 价值 |
|---|
用户身份
| 名字 | 描述 | 价值 |
|---|---|---|
| 客户端 ID | 此标识表示的服务主体的客户端标识符。 | 字符串 |
| principalId (主体ID) | 此标识表示的服务主体的对象标识符。 | 字符串 |
用法示例
Terraform 示例
部署 PostgreSQL 灵活服务器的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
azurerm = {
source = "hashicorp/azurerm"
}
}
}
provider "azurerm" {
features {
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "eastus"
}
variable "administrator_login" {
type = string
description = "The administrator login name for the PostgreSQL flexible server"
}
variable "administrator_login_password" {
type = string
description = "The administrator login password for the PostgreSQL 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.DBforPostgreSQL/flexibleServers@2023-06-01-preview"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
identity = {
type = "None",
userAssignedIdentities = null
},
properties = {
administratorLogin = var.administrator_login
administratorLoginPassword = var.administrator_login_password
availabilityZone = "2"
backup = {
geoRedundantBackup = "Disabled"
}
highAvailability = {
mode = "Disabled"
}
network = {
}
storage = {
storageSizeGB = 32
}
version = "12"
}
sku = {
name = "Standard_D2s_v3"
tier = "GeneralPurpose"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
Azure 验证模块
以下 Azure 验证模块 可用于部署此资源类型。
| 模块 | 描述 |
|---|---|
| DB for Postgre SQL 灵活服务器 | 用于 Postgre SQL 灵活服务器的 DB 的 AVM 资源模块 |