az postgres flexible-server
Note
這個指令群組的指令在 Azure CLI 和至少一個擴充功能中都有定義。 安裝每個擴充功能以受益於其擴充功能。 深入了解擴充功能。
Manage 適用於 PostgreSQL 的 Azure 資料庫 flexible servers.
命令
az postgres flexible-server connect
線上到彈性伺服器。
az postgres flexible-server connect --admin-user
--name
[--acquire-policy-token]
[--admin-password]
[--change-reference]
[--database-name]
[--interactive]
[--querytext]
必要參數
系統管理員的登入用戶名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
系統管理員的登入密碼。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
資料庫的名稱。
傳遞此參數以在互動式模式中連線到資料庫。
自變數 'querytext' 已被取代,並將在未來版本中移除。 請改用 『execute』。
針對彈性伺服器執行的查詢。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server create
建立 PostgreSQL 彈性伺服器。
建立具有自定義或預設組態的PostgreSQL彈性伺服器。 如需網路設定的詳細資訊,請參閱
az postgres flexible-server create [--acquire-policy-token]
[--admin-display-name]
[--admin-object-id]
[--admin-password]
[--admin-type {Group, ServicePrincipal, Unknown, User}]
[--admin-user]
[--allow-same-zone]
[--backup-identity]
[--backup-key]
[--backup-retention]
[--change-reference]
[--database-name]
[--geo-redundant-backup {Disabled, Enabled}]
[--identity]
[--iops]
[--key]
[--location]
[--microsoft-entra-auth {Disabled, Enabled}]
[--name]
[--node-count]
[--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]
[--tags]
[--throughput]
[--tier]
[--version]
[--vnet]
[--yes]
[--zonal-resiliency {Disabled, Enabled}]
[--zone]
範例
使用自定義參數建立PostgreSQL彈性伺服器
az postgres flexible-server create --location testlocation --resource-group testgroup \
--name testserver --admin-user testusername --admin-password testpassword \
--sku-name Standard_D2s_v3 --tier GeneralPurpose --public-access 153.24.26.117 --storage-size 128 \
--tags "key=value" --version 18 --zonal-resiliency Enabled --zone 1 \
--standby-zone 3
建立啟用高可用性功能的伺服器,當多區容量無法使用時,允許主區與待命區同時在同一區。
az postgres flexible-server create -g testgroup -n testserver --location testlocation --zonal-resiliency Enabled --allow-same-zone
使用進階 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 testlocation --resource-group testgroup \
--name testserver --admin-user testusername --admin-password testpassword \
--sku-name Standard_B1ms --tier GeneralPurpose --storage-type PremiumV2_LRS --storage-size 128 --iops 3000 --throughput 125
建立 PostgreSQL 彈性伺服器,預設會啟用預設參數和公用存取。 CLI 將會建立資源群組、伺服器名稱、使用者名稱、密碼和預設資料庫
az postgres flexible-server create
建立具有公用存取權的 PostgreSQL 彈性伺服器,並新增 IP 位址範圍以存取此伺服器。 --public-access 參數可以是 'Disabled'、'Enabled'、'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 靈活伺服器,利用現有的虛擬網路、子網及私有 DNS 區域名稱,提供私有存取權限。
az postgres flexible-server create --resource-group testgroup --name testserver --vnet testvnet --subnet testsubnet --private-dns-zone testdns.private.postgres.database.azure.com
利用現有子網及私有 DNS 區域資源識別碼建立 PostgreSQL 彈性伺服器。 子網和 DNS 區域可以屬於不同的訂閱或資源群組。
az postgres flexible-server create \
--resource-group testgroup --name testserver \
--subnet /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNet}/subnets/{Subnet} \
--private-dns-zone /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/privateDnsZones/testdns.private.postgres.database.azure.com
使用相同資源群組中的現有網路資源建立PostgreSQL彈性伺服器。 所提供的子網與私人 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/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet \
--private-dns-zone /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/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/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/privateDnsZones/testdns.postgres.database.azure.com
利用現有的網路資源在不同的資源群組或訂閱中建立一個 PostgreSQL 的彈性伺服器。
az postgres flexible-server create --resource-group testgroup \
--name testserver --location testLocation \
--subnet /subscriptions/{subscriptionId2}/resourceGroups/{resourceGroup2}/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet \
--private-dns-zone /subscriptions/{subscriptionId2}/resourceGroups/{resourceGroup2}/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
建立一台具備 Microsoft Entra 認證及密碼認證的 PostgreSQL 彈性伺服器。
# create flexible server with aad auth and password auth enabled
az postgres flexible-server create -g testgroup -n testserver --location testlocation \
--microsoft-entra-auth Enabled
建立一台僅支援 Microsoft Entra 認證且指定主要管理員的 PostgreSQL 彈性伺服器。
# create flexible server with aad only auth and password auth disabled with primary administrator specified
az postgres flexible-server create -g testgroup -n testserver --location testlocation \
--microsoft-entra-auth Enabled --password-auth Disabled \
--admin-object-id 00000000-0000-0000-0000-000000000000 --admin-display-name john@contoso.com --admin-type User
建立已啟用公用存取、異地備援備份的 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-size 選取專案。 \ 記憶體效能層級的預設值取決於針對彈性伺服器建立選取的 --storage 大小。
az postgres flexible-server create -g testgroup -n testserver --location testlocation --performance-tier P15
建立具有記憶體自動成長為 [已啟用] 的彈性伺服器。 接受的值 Enabled / Disabled。 記憶體自動成長的預設值為 「已停用」。
az postgres flexible-server create -g testgroup -n testserver --location testlocation --storage-auto-grow Enabled
建立節點計數為 5 的彈性叢集。
az postgres flexible-server create -g testGroup -n testCluster --location testLocation --node-count 5
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
顯示 Microsoft Entra 管理員使用者或群組名稱。
Microsoft Entra 管理員的唯一識別碼。
系統管理員的密碼。 最少8個字元,最多128個字元。 密碼必須包含下列三個類別的字元:英文大寫字母、英文小寫字母、數位和非英數位元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
Microsoft Entra 管理員的類型。
| 屬性 | 值 |
|---|---|
| 接受的值: | Group, ServicePrincipal, Unknown, User |
伺服器的系統管理員用戶名稱。 設定之後,就無法變更。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
| 預設值: | adoringpolenta3 |
當多區容量無法使用時,允許主區與待機區在同一區。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
地理備份使用者身份的名稱或資源識別碼用於資料加密。 身分識別必須位於與備份區域相同的區域中。
地理備份金鑰庫金鑰用於資料加密的資源識別碼。 金鑰必須位於與備份區域相同的區域中。
保留備份的天數。 範圍 7 到 35 天。 預設值為 7 天。
| 屬性 | 值 |
|---|---|
| 預設值: | 7 |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
彈性叢集的預設資料庫名稱。 僅在 --node-count 存在時適用。
是否啟用異地備援備份。
| 屬性 | 值 |
|---|---|
| 預設值: | Disabled |
| 接受的值: | Disabled, Enabled |
使用者為資料加密所指派的身份名稱或資源識別碼。
要配置給此伺服器的 IOPS 值(operations/sec)。 只有在彈性伺服器使用進階 SSD v2 磁碟時,才能更新此值。
資料加密時主要金鑰庫金鑰的資源識別碼。
Location. 值的來源:az account list-locations。 您可以使用 az configure --defaults location=<location>來設定預設位置。
是否啟用了 Microsoft Entra 認證。
| 屬性 | 值 |
|---|---|
| 預設值: | Disabled |
| 接受的值: | Disabled, Enabled |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
彈性叢集的節點數目。
是否啟用密碼驗證。
| 屬性 | 值 |
|---|---|
| 預設值: | Enabled |
| 接受的值: | Disabled, Enabled |
伺服器的效能層級。
此參數僅適用於擁有私有存取權的伺服器,且在使用 --vnet 或 --子網路時是必須的。 現有私有 DNS 區域的名稱或資源識別碼。 你可以使用同一資源群組、不同資源群組或不同訂閱的私有 DNS 區域。 如果您想使用不同資源群組或訂閱的區域,請提供該資源識別碼。
判斷公用存取。 輸入要包含在允許IP清單中的單一或IP位址範圍。 IP 位址範圍必須以虛線分隔,且不包含任何空格。 指定 0.0.0.0 允許 Azure 內部署的任何資源公開存取你的伺服器。 將它設定為 「None」 會以公用存取模式設定伺服器,但不會建立防火牆規則。 可接受的值為 'Disabled'、'Enabled'、'All'、'None'、'{startIP}' 和 '{startIP}-{destinationIP}',其中 startIP 和 destinationIP 範圍從 0.0.0.0 到 255.255.255.255。
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
計算 SKU 的名稱。 遵循Standard_{VM 名稱}的慣例。 範例:Standard_B1ms。
啟用高可用性時,待命伺服器的可用性區域資訊。
啟用或停用記憶體的自動成長。 預設值為 Disabled。
| 屬性 | 值 |
|---|---|
| 預設值: | Disabled |
| 接受的值: | Disabled, Enabled |
伺服器的儲存容量。 最小值為 32 GiB,最大值為 16 TiB。
| 屬性 | 值 |
|---|---|
| 預設值: | 128 |
伺服器的儲存類型。 允許的值是Premium_LRS和PremiumV2_LRS。 預設值為Premium_LRS。 若使用 PremiumV2_LRS,必須設定 --IOPS 和 --吞吐量。
| 屬性 | 值 |
|---|---|
| 接受的值: | PremiumV2_LRS, Premium_LRS |
現有子網的名稱或識別碼。 如果您想使用來自不同資源群組或訂閱的子網路,請提供其資源識別碼而非名稱。
以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。
伺服器的記憶體輸送量為 (MB/秒)。 只有在彈性伺服器使用進階 SSD v2 磁碟時,才能更新此值。
伺服器的計算層。 接受的值:高載、GeneralPurpose、MemoryOptimized。
| 屬性 | 值 |
|---|---|
| 預設值: | GeneralPurpose |
伺服器主要版本。
現有虛擬網路的名稱或識別碼。 如果你想使用來自不同資源群組或訂閱的 vnet,請提供資源識別碼。 名稱必須介於 2 到 64 個字元之間。 名稱的開頭必須是字母或數位、以字母、數位或底線結尾,而且只能包含字母、數位、底線、句號或連字元。
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
啟用或停用高可用性功能。
| 屬性 | 值 |
|---|---|
| 預設值: | Disabled |
| 接受的值: | Disabled, Enabled |
要在其中布建資源的可用性區域。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server delete
刪除彈性伺服器。
az postgres flexible-server delete [--acquire-policy-token]
[--change-reference]
[--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
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server execute
線上到彈性伺服器。
az postgres flexible-server execute --admin-password
--admin-user
--name
[--acquire-policy-token]
[--change-reference]
[--database-name]
[--file-path]
[--querytext]
必要參數
系統管理員的登入密碼。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
系統管理員的登入用戶名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
資料庫的名稱。
要執行的 sql 檔案路徑。
針對彈性伺服器執行的查詢。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server geo-restore
從備份異地還原彈性伺服器。
az postgres flexible-server geo-restore --location
--source-server
[--acquire-policy-token]
[--backup-identity]
[--backup-key]
[--change-reference]
[--geo-redundant-backup {Disabled, Enabled}]
[--identity]
[--ids]
[--key]
[--name]
[--no-wait]
[--private-dns-zone]
[--resource-group]
[--restore-time]
[--subnet]
[--subscription]
[--vnet]
[--yes]
[--zone]
範例
將公用存取伺服器 'testerver' 異地還原至具有公用存取位置 'newLocation' 的新伺服器 'testerverNew'。
az postgres flexible-server geo-restore --resource-group testgroup --name testservernew --source-server testserver --location testlocationnew
利用現有的私有網路資源,將私人存取伺服器「testserver」地理還原為新伺服器「testservernew」。
az postgres flexible-server geo-restore --resource-group testgroup --name testservernew \
--source-server testserver --vnet testvnetnew --subnet testsubnetnew \
--private-dns-zone testDNS.postgres.database.azure.com --location newLocation
將 「testerver」異地還原至目前的時間點,作為不同訂用帳戶/資源群組中的新伺服器 'testerverNew'。 \ 此處 --resource-group 是目標伺服器的資源群組,而 --source-server 必須作為資源識別碼傳遞。 \ 這個資源識別碼可能存在於與 az 帳號設定所使用的訂閱不同的訂閱中。
az postgres flexible-server geo-restore --resource-group testgroup --name testservernew --location testlocationnew \
--source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServer}
必要參數
Location. 值的來源:az account list-locations。 您可以使用 az configure --defaults location=<location>來設定預設位置。
還原來源伺服器的名稱或資源識別碼。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
地理備份使用者身份的名稱或資源識別碼用於資料加密。 身分識別必須位於與備份區域相同的區域中。
地理備份金鑰庫金鑰用於資料加密的資源識別碼。 金鑰必須位於與備份區域相同的區域中。
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
是否啟用異地備援備份。
| 屬性 | 值 |
|---|---|
| 預設值: | Disabled |
| 接受的值: | Disabled, Enabled |
使用者為資料加密所指派的身份名稱或資源識別碼。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資料加密時主要金鑰庫金鑰的資源識別碼。
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
此參數僅適用於擁有私有存取權的伺服器,且在使用 --vnet 或 --子網路時是必須的。 現有私有 DNS 區域的名稱或資源識別碼。 你可以使用同一資源群組、不同資源群組或不同訂閱的私有 DNS 區域。 如果您想使用不同資源群組或訂閱的區域,請提供該資源識別碼。
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
UTC 中還原的時間點(ISO8601格式),例如 2026-03-22T18:20:22+00:00。預設值設為當前時間。
| 屬性 | 值 |
|---|---|
| 預設值: | 2026-06-18T11:14:49+00:00 |
現有子網的名稱或識別碼。 如果您想使用來自不同資源群組或訂閱的子網路,請提供其資源識別碼而非名稱。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
現有虛擬網路的名稱或識別碼。 如果你想使用來自不同資源群組或訂閱的 vnet,請提供資源識別碼。 名稱必須介於 2 到 64 個字元之間。 名稱的開頭必須是字母或數位、以字母、數位或底線結尾,而且只能包含字母、數位、底線、句號或連字元。
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
要在其中布建資源的可用性區域。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server list
列出可用的彈性伺服器。
az postgres flexible-server list [--resource-group]
[--show-cluster]
範例
列出訂用帳戶中的所有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
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
只顯示彈性叢集。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server list-skus
列出指定區域中可用的 SKU。
az postgres flexible-server list-skus --location
[--acquire-policy-token]
[--change-reference]
必要參數
Location. 值的來源:az account list-locations。 您可以使用 az configure --defaults location=<location>來設定預設位置。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server migrate-network
Migrate a 適用於 PostgreSQL 的 Azure 資料庫 server from VNet integration to a Private Link network model.
az postgres flexible-server migrate-network [--acquire-policy-token]
[--change-reference]
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
範例
Migrate a 適用於 PostgreSQL 的 Azure 資料庫 server from VNet integration to a Private Link network model.
az postgres flexible-server migrate-network --resource-group testgroup --name testserver
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server restart
重新啟動彈性伺服器。
az postgres flexible-server restart [--acquire-policy-token]
[--change-reference]
[--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
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
伺服器重新啟動作業的強制或計劃性故障轉移。 允許的值:強制、已規劃。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server restore
從備份還原彈性伺服器。
az postgres flexible-server restore --source-server
[--acquire-policy-token]
[--backup-identity]
[--backup-key]
[--change-reference]
[--geo-redundant-backup {Disabled, Enabled}]
[--identity]
[--ids]
[--key]
[--name]
[--no-wait]
[--private-dns-zone]
[--resource-group]
[--restore-time]
[--storage-type {PremiumV2_LRS}]
[--subnet]
[--subscription]
[--vnet]
[--yes]
[--zone]
範例
將 『testserver』 還原至特定時間點作為新的伺服器 『testserverNew』。
az postgres flexible-server restore --resource-group testgroup --name testserverNew --source-server testserver --restore-time "2026-03-22T18:20:22Z"
將「testserver」還原到當前時間點,作為新伺服器「testservernew」。
az postgres flexible-server restore --resource-group testgroup --name testservernew --source-server testserver
將「testserver」還原到當前時間點,作為一個新伺服器「testservernew」,在另一個資源群組中。 \ 此處 --resource-group 是目標伺服器的資源群組,而 --source-server 必須作為資源識別碼傳遞。
az postgres flexible-server restore --resource-group testgroup --name testservernew \
--source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServer}
將「testserver」還原到當前時間點,作為一個新的伺服器「testservernew」,在另一個訂閱中。 \ 此處 --resource-group 是目標伺服器的資源群組,而 --source-server 必須作為資源識別碼傳遞。 \ 這個資源識別碼可能存在於與 az 帳號設定所使用的訂閱不同的訂閱中。
az postgres flexible-server restore --resource-group testgroup --name testservernew \
--source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServer}
使用高級 SSD v2 磁碟,將「testserver」還原為當前時間點的新伺服器「testservernew」,方法是將儲存類型設為「PremiumV2_LRS」。
az postgres flexible-server restore --resource-group testgroup --name testservernew --source-server testserver --storage-type PremiumV2_LRS
必要參數
還原來源伺服器的名稱或資源識別碼。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
地理備份使用者身份的名稱或資源識別碼用於資料加密。 身分識別必須位於與備份區域相同的區域中。
地理備份金鑰庫金鑰用於資料加密的資源識別碼。 金鑰必須位於與備份區域相同的區域中。
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
是否啟用異地備援備份。
| 屬性 | 值 |
|---|---|
| 預設值: | Disabled |
| 接受的值: | Disabled, Enabled |
使用者為資料加密所指派的身份名稱或資源識別碼。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資料加密時主要金鑰庫金鑰的資源識別碼。
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
此參數僅適用於擁有私有存取權的伺服器,且在使用 --vnet 或 --子網路時是必須的。 現有私有 DNS 區域的名稱或資源識別碼。 你可以使用同一資源群組、不同資源群組或不同訂閱的私有 DNS 區域。 如果您想使用不同資源群組或訂閱的區域,請提供該資源識別碼。
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
UTC 中還原的時間點(ISO8601格式),例如 2026-03-22T18:20:22+00:00。預設值設為當前時間。
| 屬性 | 值 |
|---|---|
| 預設值: | 2026-06-18T11:14:49+00:00 |
新伺服器的儲存類型。 允許的值是PremiumV2_LRS。 預設是新伺服器的儲存類型與來源伺服器相符。
| 屬性 | 值 |
|---|---|
| 接受的值: | PremiumV2_LRS |
現有子網的名稱或識別碼。 如果您想使用來自不同資源群組或訂閱的子網路,請提供其資源識別碼而非名稱。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
現有虛擬網路的名稱或識別碼。 如果你想使用來自不同資源群組或訂閱的 vnet,請提供資源識別碼。 名稱必須介於 2 到 64 個字元之間。 名稱的開頭必須是字母或數位、以字母、數位或底線結尾,而且只能包含字母、數位、底線、句號或連字元。
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
要在其中布建資源的可用性區域。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server revive-dropped
從備份中恢復已卸除的彈性伺服器。
az postgres flexible-server revive-dropped --location
--source-server
[--acquire-policy-token]
[--backup-identity]
[--backup-key]
[--change-reference]
[--geo-redundant-backup {Disabled, Enabled}]
[--identity]
[--ids]
[--key]
[--name]
[--no-wait]
[--private-dns-zone]
[--resource-group]
[--subnet]
[--subscription]
[--vnet]
[--yes]
[--zone]
範例
Revive 將公共存取伺服器 'testserver' 丟棄到新伺服器 'testservernew',位置為 'newlocation' 並有公開存取權限。
az postgres flexible-server revive-dropped --resource-group testgroup --name testservernew --source-server /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver --location testlocationnew
Revive 取消了啟用資料加密的公共存取伺服器「testserver」,改為新伺服器「testservernew」並啟用資料加密。
az postgres flexible-server revive-dropped -l testlocation --resource-group testgroup --name testservernew \
--source-server testserver --key newKeyIdentifier --identity testidentitynew
必要參數
Location. 值的來源:az account list-locations。 您可以使用 az configure --defaults location=<location>來設定預設位置。
還原來源伺服器的名稱或資源識別碼。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
地理備份使用者身份的名稱或資源識別碼用於資料加密。 身分識別必須位於與備份區域相同的區域中。
地理備份金鑰庫金鑰用於資料加密的資源識別碼。 金鑰必須位於與備份區域相同的區域中。
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
是否啟用異地備援備份。
| 屬性 | 值 |
|---|---|
| 預設值: | Disabled |
| 接受的值: | Disabled, Enabled |
使用者為資料加密所指派的身份名稱或資源識別碼。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資料加密時主要金鑰庫金鑰的資源識別碼。
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
此參數僅適用於擁有私有存取權的伺服器,且在使用 --vnet 或 --子網路時是必須的。 現有私有 DNS 區域的名稱或資源識別碼。 你可以使用同一資源群組、不同資源群組或不同訂閱的私有 DNS 區域。 如果您想使用不同資源群組或訂閱的區域,請提供該資源識別碼。
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
現有子網的名稱或識別碼。 如果您想使用來自不同資源群組或訂閱的子網路,請提供其資源識別碼而非名稱。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
現有虛擬網路的名稱或識別碼。 如果你想使用來自不同資源群組或訂閱的 vnet,請提供資源識別碼。 名稱必須介於 2 到 64 個字元之間。 名稱的開頭必須是字母或數位、以字母、數位或底線結尾,而且只能包含字母、數位、底線、句號或連字元。
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
要在其中布建資源的可用性區域。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
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 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server show-connection-string
顯示 PostgreSQL 彈性伺服器資料庫的連接字串。
az postgres flexible-server show-connection-string [--acquire-policy-token]
[--admin-password]
[--admin-user]
[--change-reference]
[--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
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
系統管理員的密碼。 最少8個字元,最多128個字元。 密碼必須包含下列三個類別的字元:英文大寫字母、英文小寫字母、數位和非英數位元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
| 預設值: | {password} |
伺服器的系統管理員用戶名稱。 設定之後,就無法變更。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
| 預設值: | {login} |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
資料庫的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
| 預設值: | {database} |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
顯示 PgBouncer 的連接字串。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
伺服器的名稱。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
| 預設值: | {server} |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server start
啟動彈性伺服器。
az postgres flexible-server start [--acquire-policy-token]
[--change-reference]
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
範例
啟動彈性伺服器。
az postgres flexible-server start --resource-group testgroup --name testserver
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server stop
停止彈性伺服器。
az postgres flexible-server stop [--acquire-policy-token]
[--change-reference]
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
範例
停止彈性伺服器。
az postgres flexible-server stop --resource-group testgroup --name testserver
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿等候長時間執行的作業完成。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server update
更新彈性伺服器。
az postgres flexible-server update [--acquire-policy-token]
[--add]
[--admin-password]
[--allow-same-zone]
[--backup-identity]
[--backup-key]
[--backup-retention]
[--change-reference]
[--force-string]
[--identity]
[--ids]
[--iops]
[--key]
[--maintenance-window]
[--microsoft-entra-auth {Disabled, Enabled}]
[--name]
[--node-count]
[--password-auth {Disabled, Enabled}]
[--performance-tier]
[--private-dns-zone]
[--public-access {Disabled, Enabled}]
[--remove]
[--resource-group]
[--set]
[--sku-name]
[--standby-zone]
[--storage-auto-grow {Disabled, Enabled}]
[--storage-size]
[--subscription]
[--tags]
[--throughput]
[--tier]
[--yes]
[--zonal-resiliency {Disabled, Enabled}]
範例
使用伺服器和資源群組的本機內容來更新彈性伺服器的 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
更新一台彈性伺服器,啟用 Microsoft Entra 認證,支援密碼認證的伺服器
az postgres flexible-server update --resource-group testgroup --name testserver --microsoft-entra-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/{subscriptionId2}/resourceGroups/{resourceGroup2}/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 (operations/sec)。 伺服器必須使用進階 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
藉由相應增加節點計數來更新彈性伺服器的叢集大小。 一定是彈性叢集。
az postgres flexible-server update --resource-group testGroup --name testcluster --node-count 6
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例:--add property.listProperty <key=value, string or JSON string>。
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
| 預設值: | [] |
系統管理員的密碼。 最少8個字元,最多128個字元。 密碼必須包含下列三個類別的字元:英文大寫字母、英文小寫字母、數位和非英數位元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Authentication Arguments |
當多區容量無法使用時,允許主區與待機區在同一區。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
地理備份使用者身份的名稱或資源識別碼用於資料加密。 身分識別必須位於與備份區域相同的區域中。
地理備份金鑰庫金鑰用於資料加密的資源識別碼。 金鑰必須位於與備份區域相同的區域中。
保留備份的天數。 範圍 7 到 35 天。 預設值為 7 天。
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
| 預設值: | False |
使用者為資料加密所指派的身份名稱或資源識別碼。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
要配置給此伺服器的 IOPS 值(operations/sec)。 只有在彈性伺服器使用進階 SSD v2 磁碟時,才能更新此值。
資料加密時主要金鑰庫金鑰的資源識別碼。
指定維護的期間(UTC)。 範例:「Sun:23:30」 以排程在星期日,下午 11:30 UTC。 若要將 設定為預設傳入 「Disabled」。
是否啟用了 Microsoft Entra 認證。
| 屬性 | 值 |
|---|---|
| 接受的值: | Disabled, Enabled |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
彈性叢集的節點數目。
是否啟用密碼驗證。
| 屬性 | 值 |
|---|---|
| 接受的值: | Disabled, Enabled |
伺服器的效能層級。
此參數僅適用於擁有私有存取權的伺服器,且在使用 --vnet 或 --子網路時是必須的。 現有私有 DNS 區域的名稱或資源識別碼。 你可以使用同一資源群組、不同資源群組或不同訂閱的私有 DNS 區域。 如果您想使用不同資源群組或訂閱的區域,請提供該資源識別碼。
啟用或停用伺服器上的公用存取。
| 屬性 | 值 |
|---|---|
| 接受的值: | Disabled, Enabled |
從清單中移除屬性或專案。 範例: --remove property.list <indexToRemove> 或 --remove propertyToRemove。
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
| 預設值: | [] |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
指定要設定的屬性路徑和值,以更新物件。 範例:--set property1.property2=<value>。
| 屬性 | 值 |
|---|---|
| 參數群組: | Generic Update Arguments |
| 預設值: | [] |
計算 SKU 的名稱。 遵循Standard_{VM 名稱}的慣例。 範例:Standard_B1ms。
啟用高可用性時,待命伺服器的可用性區域資訊。
啟用或停用記憶體的自動成長。 預設值為 Disabled。
| 屬性 | 值 |
|---|---|
| 接受的值: | Disabled, Enabled |
伺服器的儲存容量。 最小值為 32 GiB,最大值為 16 TiB。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。
伺服器的記憶體輸送量為 (MB/秒)。 只有在彈性伺服器使用進階 SSD v2 磁碟時,才能更新此值。
伺服器的計算層。 接受的值:高載、GeneralPurpose、MemoryOptimized。
請勿提示確認。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
啟用或停用高可用性功能。
| 屬性 | 值 |
|---|---|
| 接受的值: | Disabled, Enabled |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server upgrade
升級彈性伺服器的主要版本。
az postgres flexible-server upgrade --version
[--acquire-policy-token]
[--change-reference]
[--ids]
[--name]
[--resource-group]
[--subscription]
[--yes]
範例
將伺服器「testserver」升級到 PostgreSQL 主要版本 18。
az postgres flexible-server upgrade -g testgroup -n testserver -v 18
必要參數
伺服器主要版本。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
請勿提示確認。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az postgres flexible-server wait
等候彈性伺服器滿足特定條件。
az postgres flexible-server wait [--acquire-policy-token]
[--change-reference]
[--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--interval]
[--name]
[--resource-group]
[--subscription]
[--timeout]
[--updated]
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
自動取得 Azure 原則 令牌以進行此資源操作。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
相關變更的 ID 是為此資源操作所參考的。
| 屬性 | 值 |
|---|---|
| 參數群組: | Global Policy Arguments |
請等候在 'Succeeded' 使用 'provisioningState' 建立。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
等到條件符合自定義 JMESPath 查詢為止。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
等到刪除為止。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
等候資源存在。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
輪詢間隔以秒為單位。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | 30 |
伺服器的名稱。 名稱只能包含小寫字母、數字及連字號 (-) 字元。 最少 3 個字元,最多 63 個字元。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源群組的名稱。 您可以使用 az configure --defaults group=<name> 來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID 設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
以秒為單位的等候上限。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | 3600 |
等到 provisioningState 更新為 'Succeeded'。
| 屬性 | 值 |
|---|---|
| 參數群組: | Wait Condition Arguments |
| 預設值: | False |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |