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

az postgres flexible-server

注意

此命令组具有在 Azure CLI 和至少一个扩展中定义的命令。 安装每个扩展,使其受益于其扩展功能。 详细了解扩展。

管理 Azure Database for PostgreSQL 灵活服务器。

命令

名称 说明 类型 状态
az postgres flexible-server ad-admin

管理服务器 Active Directory 管理员。

核心 GA
az postgres flexible-server ad-admin create

创建 Active Directory 管理员。

核心 GA
az postgres flexible-server ad-admin delete

删除 Active Directory 管理员。

核心 GA
az postgres flexible-server ad-admin list

列出所有 Active Directory 管理员。

核心 GA
az postgres flexible-server ad-admin show

获取 Active Directory 管理员。

核心 GA
az postgres flexible-server ad-admin wait

等待 Active Directory 管理员满足某些条件。

核心 GA
az postgres flexible-server advanced-threat-protection-setting

管理 PostgreSQL 灵活服务器的高级威胁防护设置。

核心 GA
az postgres flexible-server advanced-threat-protection-setting show

获取 PostgreSL 灵活服务器的高级威胁防护设置。

核心 GA
az postgres flexible-server advanced-threat-protection-setting update

汇报灵活服务器的高级威胁防护设置状态。

核心 GA
az postgres flexible-server backup

管理灵活的服务器备份。

核心 GA
az postgres flexible-server backup list

列出给定服务器的所有备份。

核心 GA
az postgres flexible-server backup show

显示给定服务器的特定备份的详细信息。

核心 GA
az postgres flexible-server connect

连接灵活服务器。

扩展 GA
az postgres flexible-server create

创建 PostgreSQL 灵活服务器。

核心 GA
az postgres flexible-server db

管理灵活服务器上的 PostgreSQL 数据库。

核心 GA
az postgres flexible-server db create

在灵活服务器上创建 PostgreSQL 数据库。

核心 GA
az postgres flexible-server db delete

删除灵活服务器上的数据库。

核心 GA
az postgres flexible-server db list

列出灵活服务器的数据库。

核心 GA
az postgres flexible-server db show

显示数据库的详细信息。

核心 GA
az postgres flexible-server delete

删除灵活服务器。

核心 GA
az postgres flexible-server deploy

为 PostgreSQL 服务器启用并运行 GitHub Actions 工作流。

核心 GA
az postgres flexible-server deploy run

在 github 存储库中运行现有工作流。

核心 GA
az postgres flexible-server deploy setup

为 PostgreSQL 服务器创建 GitHub Actions 工作流文件。

核心 GA
az postgres flexible-server execute

连接灵活服务器。

扩展 GA
az postgres flexible-server firewall-rule

管理服务器的防火墙规则。

核心 GA
az postgres flexible-server firewall-rule create

为灵活服务器创建新的防火墙规则。

核心 GA
az postgres flexible-server firewall-rule delete

删除防火墙规则。

核心 GA
az postgres flexible-server firewall-rule list

列出灵活服务器的所有防火墙规则。

核心 GA
az postgres flexible-server firewall-rule show

获取防火墙规则的详细信息。

核心 GA
az postgres flexible-server firewall-rule update

更新防火墙规则。

核心 GA
az postgres flexible-server geo-restore

从备份中异地还原灵活服务器。

核心 GA
az postgres flexible-server identity

管理服务器用户分配的标识。

核心 GA
az postgres flexible-server identity assign

将用户签名的托管标识添加到服务器。

核心 GA
az postgres flexible-server identity list

列出服务器中的所有用户分配的托管标识。

核心 GA
az postgres flexible-server identity remove

从服务器中删除用户签名的托管标识。

核心 GA
az postgres flexible-server identity show

从服务器获取用户分配的托管标识。

核心 GA
az postgres flexible-server list

列出可用的灵活服务器。

核心 GA
az postgres flexible-server list-skus

列出给定区域中的可用 SKU。

核心 GA
az postgres flexible-server migration

管理 PostgreSQL 灵活服务器的迁移工作流。

核心 GA
az postgres flexible-server migration check-name-availability

检查是否可以使用提供的迁移名称。

核心 GA
az postgres flexible-server migration create

为灵活服务器创建新的迁移工作流。

核心 GA
az postgres flexible-server migration list

列出灵活服务器的迁移。

核心 GA
az postgres flexible-server migration show

获取特定迁移的详细信息。

核心 GA
az postgres flexible-server migration update

更新特定迁移。

核心 GA
az postgres flexible-server parameter

用于管理灵活服务器的服务器参数值的命令。

核心 GA
az postgres flexible-server parameter list

列出灵活服务器的参数值。

核心 GA
az postgres flexible-server parameter set

更新灵活服务器的参数。

核心 GA
az postgres flexible-server parameter show

获取灵活服务器的参数。”

核心 GA
az postgres flexible-server private-endpoint-connection

管理 PostgreSQL 灵活服务器专用终结点连接。

核心 GA
az postgres flexible-server private-endpoint-connection approve

批准与 PostgreSQL 灵活服务器关联的指定专用终结点连接。

核心 GA
az postgres flexible-server private-endpoint-connection delete

删除与 PostgreSQL 灵活服务器关联的指定专用终结点连接。

核心 GA
az postgres flexible-server private-endpoint-connection list

列出与 PostgreSQL 灵活服务器关联的所有专用终结点连接。

核心 GA
az postgres flexible-server private-endpoint-connection reject

拒绝与 PostgreSQL 灵活服务器关联的指定专用终结点连接。

核心 GA
az postgres flexible-server private-endpoint-connection show

显示与 PostgreSQL 灵活服务器关联的专用终结点连接的详细信息。

核心 GA
az postgres flexible-server private-link-resource

获取 PostgreSQL 灵活服务器的专用链接资源。

核心 GA
az postgres flexible-server private-link-resource list

列出与 PostgreSQL 灵活服务器关联的专用链接资源。

核心 GA
az postgres flexible-server private-link-resource show

获取 PostgreSQL 灵活服务器的专用链接资源。

核心 GA
az postgres flexible-server replica

管理读取副本 (replica)。

核心 GA
az postgres flexible-server replica create

创建服务器的只读副本。

核心 GA
az postgres flexible-server replica list

列出某个给定服务器的所有只读副本。

核心 GA
az postgres flexible-server replica promote

停止读取副本 (replica)副本 (replica)并将其提升为独立服务器或主服务器。

核心 GA
az postgres flexible-server replica stop-replication

停止复制到只读副本,并使该副本成为读/写服务器。

核心 已放弃
az postgres flexible-server restart

重启灵活服务器。

核心 GA
az postgres flexible-server restore

从备份还原灵活服务器。

核心 GA
az postgres flexible-server revive-dropped

从备份中恢复已删除的灵活服务器。

核心 GA
az postgres flexible-server server-logs

管理 PostgreSQL 灵活服务器的服务器日志(日志文件)。

核心 GA
az postgres flexible-server server-logs download

下载 PostgreSQL 灵活服务器的日志文件。

核心 GA
az postgres flexible-server server-logs list

列出 PostgreSQL 灵活服务器的日志文件。

核心 GA
az postgres flexible-server show

获取灵活服务器的详细信息。

核心 GA
az postgres flexible-server show-connection-string

显示 PostgreSQL 灵活服务器数据库的连接字符串。

核心 GA
az postgres flexible-server start

启动灵活服务器。

核心 GA
az postgres flexible-server stop

停止灵活服务器。

核心 GA
az postgres flexible-server update

更新灵活服务器。

核心 GA
az postgres flexible-server upgrade

升级灵活服务器的主要版本。

核心 GA
az postgres flexible-server virtual-endpoint

管理 PostgreSQL 灵活服务器的虚拟终结点。

核心 GA
az postgres flexible-server virtual-endpoint create

为灵活服务器创建新的虚拟终结点。

核心 GA
az postgres flexible-server virtual-endpoint delete

删除虚拟终结点。

核心 GA
az postgres flexible-server virtual-endpoint list

列出灵活服务器的所有虚拟终结点。

核心 GA
az postgres flexible-server virtual-endpoint show

获取虚拟终结点的详细信息。

核心 GA
az postgres flexible-server virtual-endpoint update

更新虚拟终结点。

核心 GA
az postgres flexible-server wait

等待灵活服务器满足某些条件。

核心 GA

az postgres flexible-server connect

连接灵活服务器。

az postgres flexible-server connect --admin-user
                                    --name
                                    [--admin-password]
                                    [--database-name]
                                    [--interactive]
                                    [--querytext]

必需参数

--admin-user -u

管理员的登录用户名。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

可选参数

--admin-password -p

管理员的登录密码。

--database-name -d

数据库的名称。

--interactive

传递此参数以在交互模式下连接到数据库。

--querytext -q
已放弃

参数“querytext”已弃用,将在将来的版本中删除。 请改用“执行”。

要针对灵活服务器运行的查询。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server create

创建 PostgreSQL 灵活服务器。

使用自定义或默认配置创建 PostgreSQL 灵活服务器。 有关网络配置的详细信息,请参阅

az postgres flexible-server create [--active-directory-auth {Disabled, Enabled}]
                                   [--address-prefixes]
                                   [--admin-password]
                                   [--admin-user]
                                   [--backup-identity]
                                   [--backup-key]
                                   [--backup-retention]
                                   [--database-name]
                                   [--geo-redundant-backup {Disabled, Enabled}]
                                   [--high-availability {Disabled, SameZone, ZoneRedundant}]
                                   [--identity]
                                   [--iops]
                                   [--key]
                                   [--location]
                                   [--name]
                                   [--password-auth {Disabled, Enabled}]
                                   [--performance-tier]
                                   [--private-dns-zone]
                                   [--public-access]
                                   [--resource-group]
                                   [--sku-name]
                                   [--standby-zone]
                                   [--storage-auto-grow {Disabled, Enabled}]
                                   [--storage-size]
                                   [--storage-type {PremiumV2_LRS, Premium_LRS}]
                                   [--subnet]
                                   [--subnet-prefixes]
                                   [--tags]
                                   [--throughput]
                                   [--tier]
                                   [--version]
                                   [--vnet]
                                   [--yes]
                                   [--zone]

示例

使用自定义参数创建 PostgreSQL 灵活服务器

az postgres flexible-server create --location northeurope --resource-group testGroup \
  --name testserver --admin-user username --admin-password password \
  --sku-name Standard_B1ms --tier Burstable --public-access 153.24.26.117 --storage-size 128 \
  --tags "key=value" --version 13 --high-availability ZoneRedundant --zone 1 \
  --standby-zone 3

使用 高级版 SSD v2 磁盘创建 PostgreSQL 灵活服务器。

# set storage type to "PremiumV2_LRS" and provide values for Storage size (in GiB), IOPS (operations/sec), and Throughput (MB/sec).
az postgres flexible-server create --location northeurope --resource-group testGroup \
    --name testserver --admin-user username --admin-password password \
    --sku-name Standard_B1ms --tier Burstable --storage-type PremiumV2_LRS --storage-size 128 --iops 3000 --throughput 125

创建默认参数和启用公共访问的 PostgreSQL 灵活服务器。 资源组、服务器名称、用户名、密码和默认数据库将由 CLI 创建

az postgres flexible-server create

创建具有公共访问权限的 PostgreSQL 灵活服务器,并添加 IP 地址范围以有权访问此服务器。 --public-access 参数可以是“All”、“None”或 <startIpAddress><startIpAddress>-<endIpAddress>

az postgres flexible-server create --resource-group testGroup --name testserver --public-access 125.23.54.31-125.23.54.35

创建具有专用访问权限的 PostgreSQL 灵活服务器。 如果提供的虚拟网络和子网不存在,则会创建具有指定地址前缀的虚拟网络和子网。

az postgres flexible-server create --resource-group testGroup --name testserver --vnet myVnet --subnet mySubnet --address-prefixes 10.0.0.0/16 --subnet-prefixes 10.0.0.0/24

使用新的子网资源 ID 和新的专用 DNS 区域资源 ID 创建 PostgreSQL 灵活服务器。 可以在不同的订阅或资源组中创建子网和 DNS 区域。

az postgres flexible-server create \
  --resource-group testGroup --name testserver \
  --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNetName}/subnets/{SubnetName} \
  --private-dns-zone /subscriptions/{SubID}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/privateDnsZones/testPostgreSQLFlexibleDnsZone.private.postgres.database.azure.com \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24

使用同一资源组中的现有网络资源创建 PostgreSQL 灵活服务器。 提供的子网不应在其中部署任何其他资源,并且此子网将委派给 Microsoft.DBforPostgreSQL/flexibleServers(如果尚未委派)。 如果尚未链接,专用 DNS 区域将链接到虚拟网络。

# create vnet
az network vnet create --resource-group testGroup --name testVnet --location testLocation --address-prefixes 172.0.0.0/16

# create subnet
az network vnet subnet create --resource-group testGroup --vnet-name testVnet --address-prefixes 172.0.0.0/24 --name testSubnet

# create private dns zone
az network private-dns zone create -g testGroup -n testDNS.private.postgres.database.azure.com

az postgres flexible-server create --resource-group testGroup \
  --name testserver --location testLocation \
  --subnet /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
  --private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com\


az postgres flexible-server create --resource-group testGroup --name testserver \
  --vnet testVnet --subnet testSubnet --location testLocation \
  --private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com

使用不同资源组/订阅中的现有网络资源创建 PostgreSQL 灵活服务器。

az postgres flexible-server create --resource-group testGroup \
   --name testserver --location testLocation \
  --subnet /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
  --private-dns-zone /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com

使用数据加密创建 PostgreSQL 灵活服务器。

# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
  --vault-name testVault --query key.kid -o tsv)


# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
  --location testLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
  --key-permissions wrapKey unwrapKey get list


# create flexible server with data encryption enabled
az postgres flexible-server create -g testGroup -n testServer --location testLocation \
  --key $keyIdentifier --identity testIdentity

创建具有 Active Directory 身份验证和密码身份验证的 PostgreSQL 灵活服务器。

# create flexible server with aad auth and password auth enabled
az postgres flexible-server create -g testGroup -n testServer --location testLocation \
  --active-directory-auth Enabled

仅创建具有 Active Directory 身份验证的 PostgreSQL 灵活服务器。

# create flexible server with aad only auth and password auth disabled
az postgres flexible-server create -g testGroup -n testServer --location testLocation \
  --active-directory-auth Enabled --password-auth Disabled

创建启用了公共访问、异地冗余备份的 PostgreSQL 灵活服务器,并添加 IP 地址范围,以访问此服务器。 --public-access 参数可以是“All”、“None”或 <startIpAddress><startIpAddress>-<endIpAddress>

az postgres flexible-server create --resource-group testGroup --name testserver --geo-redundant-backup Enabled --public-access 125.23.54.31-125.23.54.35

为启用了异地运行备份的服务器创建具有数据加密的 PostgreSQL 灵活服务器。

# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
  --vault-name testVault --query key.kid -o tsv)


# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
  --location testLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
  --key-permissions wrapKey unwrapKey get list

# create keyvault in geo-paired region
az keyvault create -g testGroup -n geoVault --location geoPairedLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
geoKeyIdentifier=$(az keyvault key create --name geoKey -p software \
  --vault-name geoVault --query key.kid -o tsv)


# create identity in geo-raired location and save its principalId
geoIdentityPrincipalId=$(az identity create -g testGroup --name geoIdentity \
  --location geoPairedLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n geoVault --object-id $geoIdentityPrincipalId \
  --key-permissions wrapKey unwrapKey get list


# create flexible server with data encryption enabled for geo-backup Enabled server
az postgres flexible-server create -g testGroup -n testServer --location testLocation --geo-redundant-backup Enabled \
  --key $keyIdentifier --identity testIdentity --backup-key $geoKeyIdentifier --backup-identity geoIdentity

使用自定义存储性能层创建灵活服务器。 接受的值“P4”、“P6”、“P10”、“P15”、“P20”、“P30”、“\”P40“、”P50“、”P60“、”P70“、”P80”。 实际允许的值取决于灵活服务器创建的 --storage 大小选择。 \ 存储性能层的默认值取决于为灵活服务器创建选择的 --storage 大小。

az postgres flexible-server create -g testGroup -n testServer --location testLocation --performance-tier P15

创建灵活服务器,存储自动增长为已启用。 接受的值已启用/已禁用。 存储自动增长的默认值为“已禁用”。

az postgres flexible-server create -g testGroup -n testServer --location testLocation --storage-auto-grow Enabled

可选参数

--active-directory-auth

是否启用 Azure Active Directory 身份验证。

接受的值: Disabled, Enabled
默认值: Disabled
--address-prefixes

以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。

--admin-password -p

管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。

--admin-user -u

服务器管理员istrator 用户名。 设置后,无法更改它。

默认值: nexteggs9
--backup-identity

用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。

--backup-key

用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。

--backup-retention

备份保留的天数。 范围为 7 到 35 天。 默认值为 7 天。

默认值: 7
--database-name -d

预配数据库服务器时要创建的数据库的名称。

--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
默认值: Disabled
--high-availability

启用(ZoneRedundant 或 SameZone)或禁用高可用性功能。

接受的值: Disabled, SameZone, ZoneRedundant
默认值: Disabled
--identity

用于数据加密的用户分配的标识的名称或资源 ID。

--iops

要为此服务器分配的 IOPS(操作/秒)的值。 仅当灵活服务器使用 高级版 SSD v2 磁盘时,才能更新此值。

--key

用于数据加密的主密钥库密钥的资源 ID。

--location -l

Location。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--password-auth

是否启用密码身份验证。

接受的值: Disabled, Enabled
默认值: Enabled
--performance-tier

服务器的性能层。

--private-dns-zone

此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--public-access

确定公共访问。 输入要包含在 IP 允许列表中的单个或一系列 IP 地址。 IP 地址范围必须用短划线分隔,并且不包含任何空格。 如果指定 0.0.0.0,则允许从 Azure 中部署的任何资源进行公共访问来访问服务器。 将其设置为“None”会将服务器设置为公共访问模式,但不创建防火墙规则。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--sku-name

计算 SKU 的名称。 遵循Standard_{VM 名称}的约定。 示例:Standard_B1ms。

默认值: Standard_D2s_v3
--standby-zone

启用高可用性时备用服务器的可用性区域信息。

--storage-auto-grow

启用或禁用存储的自动增长。 默认值为“已启用”。

接受的值: Disabled, Enabled
默认值: Disabled
--storage-size

服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。

默认值: 128
--storage-type

服务器存储类型。 允许的值是高级版_LRS和高级版V2_LRS。 默认值为高级版_LRS。如果使用高级版V2_LRS,则必须设置 iops 和吞吐量。

接受的值: PremiumV2_LRS, Premium_LRS
--subnet

新的或现有的子网的名称或资源 ID。 如果要使用不同资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委托给 flexibleServer。 进行委托后,此子网不能用于任何其他类型的 Azure 资源。

--subnet-prefixes

以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。

--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

--throughput

存储服务器的吞吐量(MB/秒)。 仅当灵活服务器使用 高级版 SSD v2 磁盘时,才能更新此值。

--tier

服务器的计算层。 接受的值:可突发、GeneralPurpose、MemoryOptimized。

默认值: GeneralPurpose
--version

服务器主版本。

默认值: 13
--vnet

新的或现有的虚拟网络的名称或 ID。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须包含 2 到 64 个字符。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。

--yes -y

不提示确认。

默认值: False
--zone -z

要在其中预配资源的可用性区域。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server delete

删除灵活服务器。

az postgres flexible-server delete [--ids]
                                   [--name]
                                   [--resource-group]
                                   [--subscription]
                                   [--yes]

示例

删除灵活服务器。

az postgres flexible-server delete --resource-group testGroup --name testserver

在不提示或确认的情况下删除灵活服务器。

az postgres flexible-server delete --resource-group testGroup --name testserver --yes

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--yes -y

不提示确认。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server execute

连接灵活服务器。

az postgres flexible-server execute --admin-password
                                    --admin-user
                                    --name
                                    [--database-name]
                                    [--file-path]
                                    [--querytext]

必需参数

--admin-password -p

管理员的登录密码。

--admin-user -u

管理员的登录用户名。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

可选参数

--database-name -d

数据库的名称。

--file-path -f

要执行的 sql 文件的路径。

--querytext -q

要针对灵活服务器运行的查询。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server geo-restore

从备份中异地还原灵活服务器。

az postgres flexible-server geo-restore --location
                                        --source-server
                                        [--address-prefixes]
                                        [--backup-identity]
                                        [--backup-key]
                                        [--geo-redundant-backup {Disabled, Enabled}]
                                        [--identity]
                                        [--ids]
                                        [--key]
                                        [--name]
                                        [--no-wait]
                                        [--private-dns-zone]
                                        [--resource-group]
                                        [--subnet]
                                        [--subnet-prefixes]
                                        [--subscription]
                                        [--vnet]
                                        [--yes]
                                        [--zone]

示例

将公共访问服务器“testerver”异地还原到具有公共访问权限的位置“newLocation”的新服务器“testserverNew”。

az postgres flexible-server geo-restore --resource-group testGroup --name testserverNew --source-server testserver --location newLocation

将专用访问服务器“testerver”异地还原为具有新子网的新服务器“testserverNew”。 将为还原的服务器预配新的 vnet、子网和专用 DNS 区域。 有关更多专用访问方案,请参阅“灵活服务器创建”命令。

az postgres flexible-server geo-restore --resource-group testGroup --name testserverNew \
  --source-server testserver --vnet newVnet --subnet newSubnet \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \
  --private-dns-zone testDNS.postgres.database.azure.com --location newLocation

将“testerver”异地还原到当前时间点,作为不同订阅/资源组中的新服务器“testserverNew”。 \ 此处 --restore-group 适用于目标服务器的资源组,并且 --source-server 必须作为资源 ID 传递。 \ 此资源 ID 可以位于与用于 az account set 的订阅不同的订阅中。

az postgres flexible-server geo-restore --resource-group testGroup --name testserverNew --location newLocation \
  --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName}

必需参数

--location -l

Location。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--source-server

要从中还原的源服务器的名称或资源 ID。

可选参数

--address-prefixes

以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。

--backup-identity

用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。

--backup-key

用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。

--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
默认值: Disabled
--identity

用于数据加密的用户分配的标识的名称或资源 ID。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--key

用于数据加密的主密钥库密钥的资源 ID。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--private-dns-zone

此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subnet

新的或现有的子网的名称或资源 ID。 如果要使用不同资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委托给 flexibleServer。 进行委托后,此子网不能用于任何其他类型的 Azure 资源。

--subnet-prefixes

以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--vnet

新的或现有的虚拟网络的名称或 ID。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须包含 2 到 64 个字符。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。

--yes -y

不提示确认。

默认值: False
--zone -z

要在其中预配资源的可用性区域。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server list

列出可用的灵活服务器。

az postgres flexible-server list [--resource-group]

示例

列出订阅中的所有 PostgreSQL 灵活服务器。

az postgres flexible-server list

列出资源组中的所有 PostgreSQL 灵活服务器。

az postgres flexible-server list --resource-group testGroup

以表格式列出资源组中的所有 PostgreSQL 灵活服务器。

az postgres flexible-server list --resource-group testGroup --output table

可选参数

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server list-skus

列出给定区域中的可用 SKU。

az postgres flexible-server list-skus --location

必需参数

--location -l

Location。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server restart

重启灵活服务器。

az postgres flexible-server restart [--failover]
                                    [--ids]
                                    [--name]
                                    [--resource-group]
                                    [--subscription]

示例

重启灵活服务器。

az postgres flexible-server restart --resource-group testGroup --name testserver

使用 计划的故障转移 重启服务器

az postgres flexible-server restart --resource-group testGroup --name testserver --failover Planned

使用强制故障转移重启服务器

az postgres flexible-server restart --resource-group testGroup --name testserver --failover Forced

可选参数

--failover

强制或计划的故障转移服务器重启操作。 允许的值:强制、计划。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server restore

从备份还原灵活服务器。

az postgres flexible-server restore --source-server
                                    [--address-prefixes]
                                    [--backup-identity]
                                    [--backup-key]
                                    [--geo-redundant-backup {Disabled, Enabled}]
                                    [--identity]
                                    [--ids]
                                    [--key]
                                    [--name]
                                    [--no-wait]
                                    [--private-dns-zone]
                                    [--resource-group]
                                    [--restore-time]
                                    [--subnet]
                                    [--subnet-prefixes]
                                    [--subscription]
                                    [--vnet]
                                    [--yes]
                                    [--zone]

示例

将“testerver”还原到特定的时间点,作为新的服务器“testserverNew”。

az postgres flexible-server restore --resource-group testGroup --name testserverNew --source-server testserver --restore-time "2017-06-15T13:10:00Z"

将“testserver”还原到当前时间点,作为新的服务器“testserverNew”。

az postgres flexible-server restore --resource-group testGroup --name testserverNew --source-server testserver

将“testerver”还原到当前时间点,作为不同资源组中的新服务器“testserverNew”。 \ 此处 --restore-group 适用于目标服务器的资源组,并且 --source-server 必须作为资源 ID 传递。

az postgres flexible-server restore --resource-group testGroup --name testserverNew \
  --source-server /subscriptions/{testSubscription}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName}

将“testerver”还原到当前时间点,作为不同订阅中的新服务器“testserverNew”。 \ 此处 --restore-group 适用于目标服务器的资源组,并且 --source-server 必须作为资源 ID 传递。 \ 此资源 ID 可以位于与用于 az account set 的订阅不同的订阅中。

az postgres flexible-server restore --resource-group testGroup --name testserverNew \
  --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName}

必需参数

--source-server

要从中还原的源服务器的名称或资源 ID。

可选参数

--address-prefixes

以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。

--backup-identity

用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。

--backup-key

用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。

--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
默认值: Disabled
--identity

用于数据加密的用户分配的标识的名称或资源 ID。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--key

用于数据加密的主密钥库密钥的资源 ID。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--private-dns-zone

此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--restore-time

要从 UTC 还原的时间点(ISO8601格式),例如 2017-04-26T02:10:00+00:00 默认值设置为当前时间。

默认值: 2024-04-23T03:39:17+00:00
--subnet

新的或现有的子网的名称或资源 ID。 如果要使用不同资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委托给 flexibleServer。 进行委托后,此子网不能用于任何其他类型的 Azure 资源。

--subnet-prefixes

以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--vnet

新的或现有的虚拟网络的名称或 ID。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须包含 2 到 64 个字符。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。

--yes -y

不提示确认。

默认值: False
--zone -z

要在其中预配资源的可用性区域。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server revive-dropped

从备份中恢复已删除的灵活服务器。

az postgres flexible-server revive-dropped --location
                                           --source-server
                                           [--address-prefixes]
                                           [--backup-identity]
                                           [--backup-key]
                                           [--geo-redundant-backup {Disabled, Enabled}]
                                           [--identity]
                                           [--ids]
                                           [--key]
                                           [--name]
                                           [--no-wait]
                                           [--private-dns-zone]
                                           [--resource-group]
                                           [--subnet]
                                           [--subnet-prefixes]
                                           [--subscription]
                                           [--vnet]
                                           [--yes]
                                           [--zone]

示例

恢复公共访问服务器“testerver”到具有公共访问权限的“newLocation”位置的新服务器“testserverNew”。

az postgres flexible-server revive-dropped --resource-group testGroup --name testserverNew --source-server /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver --location newLocation

恢复删除的公共访问服务器“testserver”,数据加密已启用数据加密,作为具有数据加密的新服务器“testserverNew”。

az postgres flexible-server revive-dropped -l testLocation --resource-group testGroup --name testserverNew \
  --source-server testserver --key newKeyIdentifier --identity newIdentity

必需参数

--location -l

Location。 az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--source-server

要从中还原的源服务器的名称或资源 ID。

可选参数

--address-prefixes

以 CIDR 格式创建新虚拟网络时要使用的 IP 地址前缀。 默认值为 10.0.0.0/16。

--backup-identity

用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。

--backup-key

用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。

--geo-redundant-backup

是否启用异地冗余备份。

接受的值: Disabled, Enabled
默认值: Disabled
--identity

用于数据加密的用户分配的标识的名称或资源 ID。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--key

用于数据加密的主密钥库密钥的资源 ID。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--private-dns-zone

此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subnet

新的或现有的子网的名称或资源 ID。 如果要使用不同资源组或订阅中的子网,请提供资源 ID 而不是名称。 请注意,子网将委托给 flexibleServer。 进行委托后,此子网不能用于任何其他类型的 Azure 资源。

--subnet-prefixes

以 CIDR 格式创建新子网时要使用的子网 IP 地址前缀。 默认值为 10.0.0.0/24。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--vnet

新的或现有的虚拟网络的名称或 ID。 如果要使用不同资源组或订阅中的 vnet,请提供资源 ID。 名称必须包含 2 到 64 个字符。 名称必须以字母或数字开头,以字母、数字或下划线结尾,并且只能包含字母、数字、下划线、句点或连字符。

--yes -y

不提示确认。

默认值: False
--zone -z

要在其中预配资源的可用性区域。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server show

获取灵活服务器的详细信息。

az postgres flexible-server show [--ids]
                                 [--name]
                                 [--resource-group]
                                 [--subscription]

示例

获取灵活服务器的详细信息

az postgres flexible-server show --resource-group testGroup --name testserver

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server show-connection-string

显示 PostgreSQL 灵活服务器数据库的连接字符串。

az postgres flexible-server show-connection-string [--admin-password]
                                                   [--admin-user]
                                                   [--database-name]
                                                   [--ids]
                                                   [--pg-bouncer]
                                                   [--server-name]
                                                   [--subscription]

示例

显示 cmd 和编程语言的连接字符串。

az postgres flexible-server show-connection-string -s testserver -u username -p password -d databasename

显示启用了 PgBouncer 的 cmd 和编程语言的连接字符串。

az postgres flexible-server show-connection-string -s testserver -u username -p password -d databasename --pg-bouncer

可选参数

--admin-password -p

管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。

默认值: {password}
--admin-user -u

服务器管理员istrator 用户名。 设置后,无法更改它。

默认值: {login}
--database-name -d

预配数据库服务器时要创建的数据库的名称。

默认值: {database}
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--pg-bouncer

显示 PgBouncer 的连接字符串。

默认值: False
--server-name -s

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

默认值: {server}
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server start

启动灵活服务器。

az postgres flexible-server start [--ids]
                                  [--name]
                                  [--no-wait]
                                  [--resource-group]
                                  [--subscription]

示例

启动灵活服务器。

az postgres flexible-server start --resource-group testGroup --name testserver

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server stop

停止灵活服务器。

az postgres flexible-server stop [--ids]
                                 [--name]
                                 [--no-wait]
                                 [--resource-group]
                                 [--subscription]

示例

停止灵活服务器。

az postgres flexible-server stop --resource-group testGroup --name testserver

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--no-wait

不等待长时间运行的操作完成。

默认值: False
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server update

更新灵活服务器。

az postgres flexible-server update [--active-directory-auth {Disabled, Enabled}]
                                   [--add]
                                   [--admin-password]
                                   [--backup-identity]
                                   [--backup-key]
                                   [--backup-retention]
                                   [--force-string]
                                   [--high-availability {Disabled, SameZone, ZoneRedundant}]
                                   [--identity]
                                   [--ids]
                                   [--iops]
                                   [--key]
                                   [--maintenance-window]
                                   [--name]
                                   [--password-auth {Disabled, Enabled}]
                                   [--performance-tier]
                                   [--private-dns-zone]
                                   [--remove]
                                   [--resource-group]
                                   [--set]
                                   [--sku-name]
                                   [--standby-zone]
                                   [--storage-auto-grow {Disabled, Enabled}]
                                   [--storage-size]
                                   [--subscription]
                                   [--tags]
                                   [--throughput]
                                   [--tier]
                                   [--yes]

示例

使用服务器和资源组的本地上下文更新灵活服务器的 SKU。

az postgres flexible-server update --sku-name Standard_D4s_v3

更新服务器的标记。

az postgres flexible-server update --resource-group testGroup --name testserver --tags "k1=v1" "k2=v2"

重置密码

az postgres flexible-server update --resource-group testGroup --name testserver -p password123

更新灵活服务器,为已启用密码身份验证的服务器启用 Active Directory 身份验证

az postgres flexible-server update --resource-group testGroup --name testserver --active-directory-auth Enabled

更改数据加密的密钥/标识。 无法在创建服务器后启用数据加密,这只会更新密钥/标识。

# get key identifier of the existing key
newKeyIdentifier=$(az keyvault key show --vault-name testVault --name testKey \
  --query key.kid -o tsv)


# update server with new key/identity
az postgres flexible-server update --resource-group testGroup --name testserver \
  --key $newKeyIdentifier --identity newIdentity

更新灵活服务器以使用同一资源组和订阅中的专用 DNS 区域更新已启用 VNET 的服务器专用 DNS 区域。 私人 DNS区域将创建私人 DNS区域将链接到 VNET(如果尚未链接)。

az postgres flexible-server update --resource-group testGroup --name testserver --private-dns-zone testDNS2.postgres.database.azure.com

更新灵活服务器以使用不同资源组和订阅中的专用 DNS 区域更新已启用 VNET 的服务器专用 DNS 区域。 私人 DNS区域将链接到 VNET(如果尚未链接)。

az postgres flexible-server update --resource-group testGroup --name testserver --private-dns-zone /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com

更新灵活服务器的存储以启用/禁用存储自动增长。

az postgres flexible-server update --resource-group testGroup --name testserver --storage-auto-grow Enabled

更新灵活服务器的存储以设置自定义存储性能层。

az postgres flexible-server update --resource-group testGroup --name testserver --performance-tier P15

更新灵活服务器的存储以设置 IOPS(操作/秒)。 服务器必须使用 高级版 SSD v2 磁盘。

az postgres flexible-server update --resource-group testGroup --name testserver --iops 3000

更新灵活服务器的存储以设置吞吐量(MB/秒)。 服务器必须使用 高级版 SSD v2 磁盘。

az postgres flexible-server update --resource-group testGroup --name testserver --throughput 125

可选参数

--active-directory-auth

是否启用 Azure Active Directory 身份验证。

接受的值: Disabled, Enabled
--add

通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>

默认值: []
--admin-password -p

管理员的密码。 最少 8 个字符,最多 128 个字符。 密码必须包含以下类别中的三个类别的字符:英文大写字母、英文小写字母、数字和非字母数字字符。

--backup-identity

用于数据加密的异地备份用户标识的名称或资源 ID。 标识需要与备份区域位于同一区域。

--backup-key

用于数据加密的异地备份 keyvault 密钥的资源 ID。 密钥需要与备份区域位于同一区域。

--backup-retention

备份保留的天数。 范围为 7 到 35 天。 默认值为 7 天。

--force-string

使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。

默认值: False
--high-availability

启用(ZoneRedundant 或 SameZone)或禁用高可用性功能。

接受的值: Disabled, SameZone, ZoneRedundant
--identity

用于数据加密的用户分配的标识的名称或资源 ID。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--iops

要为此服务器分配的 IOPS(操作/秒)的值。 仅当灵活服务器使用 高级版 SSD v2 磁盘时,才能更新此值。

--key

用于数据加密的主密钥库密钥的资源 ID。

--maintenance-window

为维护指定的时间段(UTC)。 示例:“Sun:23:30”计划于星期天晚上 11:30 UTC。 若要重新设置为默认传入“Disabled”。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--password-auth

是否启用密码身份验证。

接受的值: Disabled, Enabled
--performance-tier

服务器的性能层。

--private-dns-zone

此参数仅适用于具有专用访问权限的服务器。 新的或现有的专用 DNS 区域的名称或 ID。 可以使用同一资源组、不同资源组或不同订阅中的专用 DNS 区域。 如果要使用不同资源组或订阅中的区域,请提供资源 ID。如果用户未提供专用 DNS 区域,CLI 会在虚拟网络所在的资源组中创建一个新的。

--remove

从列表中删除属性或元素。 示例: --remove property.list <indexToRemove> OR --remove propertyToRemove.

默认值: []
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--set

通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>

默认值: []
--sku-name

计算 SKU 的名称。 遵循Standard_{VM 名称}的约定。 示例:Standard_B1ms。

--standby-zone

启用高可用性时备用服务器的可用性区域信息。

--storage-auto-grow

启用或禁用存储的自动增长。 默认值为“已启用”。

接受的值: Disabled, Enabled
--storage-size

服务器的存储容量。 最小值为 32 GiB,最大值为 16 TiB。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

--throughput

存储服务器的吞吐量(MB/秒)。 仅当灵活服务器使用 高级版 SSD v2 磁盘时,才能更新此值。

--tier

服务器的计算层。 接受的值:可突发、GeneralPurpose、MemoryOptimized。

--yes -y

不提示确认。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server upgrade

升级灵活服务器的主要版本。

az postgres flexible-server upgrade --version {12, 13, 14, 15}
                                    [--ids]
                                    [--name]
                                    [--resource-group]
                                    [--subscription]
                                    [--yes]

示例

将服务器“testsvr”升级到 PostgreSQL 主版本 14。

az postgres flexible-server upgrade -g testgroup -n testsvr -v 14

必需参数

--version -v

服务器主版本。

接受的值: 12, 13, 14, 15

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--yes -y

不提示确认。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az postgres flexible-server wait

等待灵活服务器满足某些条件。

az postgres flexible-server wait [--created]
                                 [--custom]
                                 [--deleted]
                                 [--exists]
                                 [--ids]
                                 [--interval]
                                 [--name]
                                 [--resource-group]
                                 [--subscription]
                                 [--timeout]
                                 [--updated]

可选参数

--created

等待在“Succeeded”中使用“provisioningState”创建。

默认值: False
--custom

等待条件满足自定义 JMESPath 查询。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

--deleted

等到删除为止。

默认值: False
--exists

等待资源存在。

默认值: False
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--interval

轮询间隔(以秒为单位)。

默认值: 30
--name -n

服务器的名称。 名称只能包含小写字母、数字和连字符 (-)。 最少 3 个字符,最多 63 个字符。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--timeout

最大等待(以秒为单位)。

默认值: 3600
--updated

等到 provisioningState 更新为“Succeeded”。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。