Aktualizuje istniejący serwer. Treść żądania może zawierać jedną lub wiele właściwości obecnych w normalnej definicji serwera.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}?api-version=2025-08-01
Parametry identyfikatora URI
| Nazwa |
W |
Wymagane |
Typ |
Opis |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nazwa grupy zasobów. Nazwa jest niewrażliwa na wielkość liter.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
Nazwa serwera.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
Identyfikator subskrypcji docelowej. Wartość musi być identyfikatorem UUID.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Wersja interfejsu API do użycia dla tej operacji.
|
Treść żądania
| Nazwa |
Typ |
Opis |
|
identity
|
UserAssignedIdentity
|
Opisuje tożsamość aplikacji.
|
|
properties.administratorLogin
|
string
|
Nazwa loginu wyznaczonego jako pierwszy administrator oparty na hasłach przypisany do Twojej instancji PostgreSQL. Musi być określona przy pierwszym włączeniu uwierzytelniania opartego na hasłach na serwerze. Raz ustawiona na daną wartość nie może być zmieniona do końca życia serwera. Jeśli wyłączysz uwierzytelnianie oparte na hasłach na serwerze, na którym jest włączone, ta rola oparta na hasłach nie zostanie usunięta.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Hasło przypisane do loginu administratora. Dopóki uwierzytelnianie hasłem jest włączone, hasło to można zmienić w dowolnym momencie.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Właściwości konfiguracji uwierzytelniania serwera.
|
|
properties.availabilityZone
|
string
|
Strefa dostępności serwera.
|
|
properties.backup
|
BackupForPatch
|
Właściwości kopii zapasowej serwera.
|
|
properties.cluster
|
Cluster
|
Właściwości klastra serwera.
|
|
properties.createMode
|
CreateModeForPatch
|
Tryb aktualizacji istniejącego serwera.
|
|
properties.dataEncryption
|
DataEncryption
|
Właściwości szyfrowania danych serwera.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Właściwości wysokiej dostępności serwera.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Właściwości okna obsługi serwera.
|
|
properties.network
|
Network
|
Właściwości sieci serwera. Wymagane tylko wtedy, gdy chcesz, aby serwer był zintegrowany z siecią wirtualną dostarczoną przez klienta.
|
|
properties.replica
|
Replica
|
Odczytywanie właściwości repliki serwera. Wymagane tylko w przypadku, gdy chcesz podwyższyć poziom serwera.
|
|
properties.replicationRole
|
ReplicationRole
|
Rola serwera w zestawie replikacji.
|
|
properties.storage
|
Storage
|
Właściwości magazynu serwera.
|
|
properties.version
|
PostgresMajorVersion
|
Główna wersja silnika bazy danych PostgreSQL.
|
|
sku
|
SkuForPatch
|
Warstwa obliczeniowa i rozmiar serwera.
|
|
tags
|
object
|
Metadane specyficzne dla aplikacji w postaci par klucz-wartość.
|
Odpowiedzi
| Nazwa |
Typ |
Opis |
|
202 Accepted
|
|
Akceptowane.
Nagłówki
- Location: string
- Azure-AsyncOperation: string
|
|
Other Status Codes
|
ErrorResponse
|
Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.
|
Zabezpieczenia
azure_auth
Przepływ OAuth2 w usłudze Microsoft Entra
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
| Nazwa |
Opis |
|
user_impersonation
|
Podszywać się pod Twoje konto użytkownika
|
Przykłady
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Standalone",
"promoteOption": "Forced"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsForcedStandaloneServer.json
*/
/**
* Sample code: Promote a read replica to a standalone server with forced data synchronization. Meaning that it
* doesn't wait for data in the read replica to be synchronized with its source server before it initiates the
* promotion to a standalone server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.STANDALONE)
.withPromoteOption(ReadReplicaPromoteOption.FORCED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_forced_standalone_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Standalone", "promoteOption": "Forced"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json
*/
async function promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Standalone", promoteOption: "Forced" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Standalone",
"promoteOption": "Planned"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsPlannedStandaloneServer.json
*/
/**
* Sample code: Promote a read replica to a standalone server with planned data synchronization. Meaning that it
* waits for data in the read replica to be fully synchronized with its source server before it initiates the
* promotion to a standalone server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.STANDALONE)
.withPromoteOption(ReadReplicaPromoteOption.PLANNED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_planned_standalone_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Standalone", "promoteOption": "Planned"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json
*/
async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Standalone", promoteOption: "Planned" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Switch over a read replica to primary server with forced data synchronization. Meaning that it doesn't wait for data in the read replica to be synchronized with its source server before it initiates the switching of roles between the read replica and the primary server.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Switchover",
"promoteOption": "Forced"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsForcedSwitchover.json
*/
/**
* Sample code: Switch over a read replica to primary server with forced data synchronization. Meaning that it
* doesn't wait for data in the read replica to be synchronized with its source server before it initiates the
* switching of roles between the read replica and the primary server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.SWITCHOVER)
.withPromoteOption(ReadReplicaPromoteOption.FORCED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_forced_switchover.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Switchover", "promoteOption": "Forced"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json
*/
async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Switchover", promoteOption: "Forced" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Switch over a read replica to primary server with planned data synchronization. Meaning that it waits for data in the read replica to be fully synchronized with its source server before it initiates the switching of roles between the read replica and the primary server.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Switchover",
"promoteOption": "Planned"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsPlannedSwitchover.json
*/
/**
* Sample code: Switch over a read replica to primary server with planned data synchronization. Meaning that it
* waits for data in the read replica to be fully synchronized with its source server before it initiates the
* switching of roles between the read replica and the primary server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.SWITCHOVER)
.withPromoteOption(ReadReplicaPromoteOption.PLANNED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_planned_switchover.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Switchover", "promoteOption": "Planned"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json
*/
async function switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Switchover", promoteOption: "Planned" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Update an existing server to upgrade the major version of PostgreSQL database engine.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"createMode": "Update",
"version": "17"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithMajorVersionUpgrade.json
*/
/**
* Sample code: Update an existing server to upgrade the major version of PostgreSQL database engine.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withVersion(PostgresMajorVersion.ONE_SEVEN).withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_major_version_upgrade.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"createMode": "Update", "version": "17"}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json
*/
async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = { createMode: "Update", version: "17" };
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Update an existing server with custom maintenance window.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"createMode": "Update",
"maintenanceWindow": {
"customWindow": "Enabled",
"dayOfWeek": 0,
"startHour": 8,
"startMinute": 0
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindowForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithCustomMaintenanceWindow.json
*/
/**
* Sample code: Update an existing server with custom maintenance window.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithCustomMaintenanceWindow(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withMaintenanceWindow(new MaintenanceWindowForPatch().withCustomWindow("Enabled")
.withStartHour(8).withStartMinute(0).withDayOfWeek(0)).withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_custom_maintenance_window.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"properties": {
"createMode": "Update",
"maintenanceWindow": {"customWindow": "Enabled", "dayOfWeek": 0, "startHour": 8, "startMinute": 0},
}
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json
*/
async function updateAnExistingServerWithCustomMaintenanceWindow() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
createMode: "Update",
maintenanceWindow: {
customWindow: "Enabled",
dayOfWeek: 0,
startHour: 8,
startMinute: 0,
},
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Update an existing server with data encryption based on customer managed key with automatic key version update.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}
},
"type": "UserAssigned"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"dataEncryption": {
"type": "AzureKeyVault",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryptionType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.IdentityType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithDataEncryptionEnabledAutoUpdate.json
*/
/**
* Sample code: Update an existing server with data encryption based on customer managed key with automatic key
* version update.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withIdentity(new UserAssignedIdentity().withUserAssignedIdentities(mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
new UserIdentity(),
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
new UserIdentity())).withType(IdentityType.USER_ASSIGNED))
.withAdministratorLoginPassword("examplenewpassword")
.withBackup(new BackupForPatch().withBackupRetentionDays(20))
.withDataEncryption(new DataEncryption().withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity")
.withGeoBackupKeyUri("fakeTokenPlaceholder")
.withGeoBackupUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity")
.withType(DataEncryptionType.AZURE_KEY_VAULT))
.withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_data_encryption_enabled_auto_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"dataEncryption": {
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"type": "AzureKeyVault",
},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json
*/
async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
backup: { backupRetentionDays: 20 },
createMode: "Update",
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey",
geoBackupUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity":
{},
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity":
{},
},
},
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Update an existing server with data encryption based on customer managed key.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}
},
"type": "UserAssigned"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"dataEncryption": {
"type": "AzureKeyVault",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryptionType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.IdentityType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithDataEncryptionEnabled.json
*/
/**
* Sample code: Update an existing server with data encryption based on customer managed key.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withIdentity(new UserAssignedIdentity().withUserAssignedIdentities(mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
new UserIdentity(),
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
new UserIdentity())).withType(IdentityType.USER_ASSIGNED))
.withAdministratorLoginPassword("examplenewpassword")
.withBackup(new BackupForPatch().withBackupRetentionDays(20))
.withDataEncryption(new DataEncryption().withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity")
.withGeoBackupKeyUri("fakeTokenPlaceholder")
.withGeoBackupUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity")
.withType(DataEncryptionType.AZURE_KEY_VAULT))
.withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_data_encryption_enabled.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"dataEncryption": {
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"type": "AzureKeyVault",
},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json
*/
async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
backup: { backupRetentionDays: 20 },
createMode: "Update",
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI:
"https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
geoBackupUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
primaryKeyURI:
"https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity":
{},
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity":
{},
},
},
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Update an existing server with Microsoft Entra authentication enabled.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"
},
"storage": {
"storageSizeGB": 1024,
"autoGrow": "Disabled",
"tier": "P30"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfigForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.MicrosoftEntraAuth;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PasswordBasedAuth;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithMicrosoftEntraEnabled.json
*/
/**
* Sample code: Update an existing server with Microsoft Entra authentication enabled.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLoginPassword("examplenewpassword")
.withStorage(new Storage().withStorageSizeGB(1024).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P30))
.withBackup(new BackupForPatch().withBackupRetentionDays(20))
.withAuthConfig(new AuthConfigForPatch().withActiveDirectoryAuth(MicrosoftEntraAuth.ENABLED)
.withPasswordAuth(PasswordBasedAuth.ENABLED).withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt"))
.withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_microsoft_entra_enabled.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"properties": {
"administratorLoginPassword": "examplenewpassword",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt",
},
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"storage": {"autoGrow": "Disabled", "storageSizeGB": 1024, "tier": "P30"},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json
*/
async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
authConfig: {
activeDirectoryAuth: "Enabled",
passwordAuth: "Enabled",
tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt",
},
backup: { backupRetentionDays: 20 },
createMode: "Update",
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Update an existing server.
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"storage": {
"storageSizeGB": 1024,
"autoGrow": "Enabled",
"tier": "P30"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json
*/
/**
* Sample code: Update an existing server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
updateAnExistingServer(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLoginPassword("examplenewpassword")
.withStorage(new Storage().withStorageSizeGB(1024).withAutoGrow(StorageAutoGrow.ENABLED)
.withTier(AzureManagedDiskPerformanceTier.P30))
.withBackup(new BackupForPatch().withBackupRetentionDays(20)).withCreateMode(CreateModeForPatch.UPDATE)
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"properties": {
"administratorLoginPassword": "examplenewpassword",
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"storage": {"autoGrow": "Enabled", "storageSizeGB": 1024, "tier": "P30"},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json
*/
async function updateAnExistingServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
backup: { backupRetentionDays: 20 },
createMode: "Update",
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/azureAsyncOperation/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?api-version=2025-06-01-preview
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/eastus/operationResults/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb?api-version=2025-06-01-preview
Definicje
| Nazwa |
Opis |
|
AuthConfigForPatch
|
Właściwości konfiguracji uwierzytelniania serwera.
|
|
AzureManagedDiskPerformanceTier
|
Warstwa magazynowania serwera.
|
|
BackupForPatch
|
Właściwości kopii zapasowej serwera.
|
|
Cluster
|
Właściwości klastra serwera.
|
|
CreateModeForPatch
|
Tryb aktualizacji istniejącego serwera.
|
|
DataEncryption
|
Właściwości szyfrowania danych serwera.
|
|
DataEncryptionType
|
Typ szyfrowania danych używany przez serwer.
|
|
EncryptionKeyStatus
|
Stan klucza używanego przez serwer skonfigurowany z szyfrowaniem danych na podstawie klucza zarządzanego przez klienta do szyfrowania magazynu podstawowego skojarzonego z serwerem.
|
|
ErrorAdditionalInfo
|
Dodatkowe informacje o błędzie zarządzania zasobami.
|
|
ErrorDetail
|
Szczegóły błędu.
|
|
ErrorResponse
|
Odpowiedź na błąd
|
|
GeographicallyRedundantBackup
|
Wskazuje, czy serwer jest skonfigurowany do tworzenia geograficznie nadmiarowych kopii zapasowych.
|
|
HighAvailabilityForPatch
|
Właściwości wysokiej dostępności serwera.
|
|
HighAvailabilityMode
|
Tryb wysokiej dostępności serwera.
|
|
HighAvailabilityState
|
Możliwe stany serwera rezerwowego utworzonego, gdy wysoka dostępność jest ustawiona na SameZone lub ZoneRedundant.
|
|
IdentityType
|
Typy tożsamości skojarzonych z serwerem.
|
|
MaintenanceWindowForPatch
|
Właściwości okna obsługi serwera.
|
|
MicrosoftEntraAuth
|
Wskazuje, czy serwer obsługuje uwierzytelnianie Microsoft Entra.
|
|
Network
|
Właściwości sieci serwera.
|
|
PasswordBasedAuth
|
Wskazuje, czy serwer obsługuje uwierzytelnianie oparte na hasłach.
|
|
PostgresMajorVersion
|
Główna wersja silnika bazy danych PostgreSQL.
|
|
ReadReplicaPromoteMode
|
Typ operacji, która ma zostać zastosowana na replice do odczytu. Ta właściwość to tylko zapis. Autonomiczny oznacza, że replika do odczytu zostanie podniesiona do poziomu serwera autonomicznego i stanie się całkowicie niezależną jednostką od zestawu replikacji. Przełączenie oznacza, że replika do odczytu będzie pełnić role z serwerem podstawowym.
|
|
ReadReplicaPromoteOption
|
Opcja synchronizacji danych, która ma być używana podczas przetwarzania operacji określonej we właściwości promoteMode. Ta właściwość to tylko zapis.
|
|
Replica
|
Właściwości repliki serwera.
|
|
ReplicationRole
|
Rola serwera w zestawie replikacji.
|
|
ReplicationState
|
Wskazuje stan replikacji repliki do odczytu. Ta właściwość jest zwracana tylko wtedy, gdy serwer docelowy jest repliką do odczytu. Możliwe wartości to Active, Broken, Catchup, Provisioning, Reconfigure i Updating
|
|
ServerForPatch
|
Reprezentuje serwer do zaktualizowania.
|
|
ServerPublicNetworkAccessState
|
Wskazuje, czy dostęp do sieci publicznej jest włączony, czy nie. Jest to obsługiwane tylko w przypadku serwerów, które nie są zintegrowane z siecią wirtualną, która jest własnością klienta i jest przez niego udostępniana podczas wdrażania serwera.
|
|
SkuForPatch
|
Informacje o obliczeniach serwera.
|
|
SkuTier
|
Warstwa zasobów obliczeniowych przypisana do serwera.
|
|
Storage
|
Właściwości magazynu serwera.
|
|
StorageAutoGrow
|
Flaga, aby włączyć lub wyłączyć automatyczne zwiększanie rozmiaru pamięci masowej serwera, gdy dostępne miejsce jest bliskie zeru, a warunki pozwalają na automatyczne zwiększanie rozmiaru pamięci masowej.
|
|
StorageType
|
Typ magazynu przypisanego do serwera. Dozwolone wartości to Premium_LRS, PremiumV2_LRS lub UltraSSD_LRS. Jeśli nie zostanie określony, wartość domyślna to Premium_LRS.
|
|
UserAssignedIdentity
|
Tożsamości skojarzone z serwerem.
|
|
UserIdentity
|
Tożsamość zarządzana przypisana przez użytkownika skojarzona z serwerem.
|
AuthConfigForPatch
Objekt
Właściwości konfiguracji uwierzytelniania serwera.
| Nazwa |
Typ |
Opis |
|
activeDirectoryAuth
|
MicrosoftEntraAuth
|
Wskazuje, czy serwer obsługuje uwierzytelnianie Microsoft Entra.
|
|
passwordAuth
|
PasswordBasedAuth
|
Wskazuje, czy serwer obsługuje uwierzytelnianie oparte na hasłach.
|
|
tenantId
|
string
|
Identyfikator dzierżawy delegowanego zasobu.
|
Wyliczenie
Warstwa magazynowania serwera.
| Wartość |
Opis |
|
P1
|
Podstawowy dysk SSD zapewniający minimalną liczbę operacji we/wy na sekundę, idealny do lekkich obciążeń programistycznych lub testowych.
|
|
P2
|
Nieco wyższa liczba operacji we/wy na sekundę dla aplikacji na małą skalę wymagających spójnych małych opóźnień.
|
|
P3
|
Zrównoważona wydajność dla podstawowych obciążeń produkcyjnych z umiarkowaną przepływnością.
|
|
P4
|
Ulepszona liczba operacji we/wy na sekundę dla rozwijających się aplikacji o przewidywalnych potrzebach w zakresie wydajności.
|
|
P6
|
Dysk SSD klasy średniej do stałych obciążeń wymagających niezawodnej przepustowości i opóźnień.
|
|
P10
|
Popularny wybór dla obciążeń produkcyjnych ogólnego przeznaczenia ze skalowalną wydajnością.
|
|
P15
|
Warstwa High IOPS dla wymagających aplikacji z częstymi operacjami odczytu/zapisu.
|
|
P20
|
Punkt wejścia dla wysokowydajnych dysków półprzewodnikowych (SSD), odpowiednich do małych obciążeń intensywnie korzystających z operacji we/wy.
|
|
P30
|
Zrównoważona warstwa dla aplikacji o umiarkowanej przepływności i wrażliwych na opóźnienia.
|
|
P40
|
Zwiększona wydajność dla rosnących obciążeń produkcyjnych ze stałym zapotrzebowaniem na liczbę operacji we/wy na sekundę.
|
|
P50
|
Zoptymalizowany pod kątem aplikacji klasy korporacyjnej wymagających stałej wysokiej przepustowości.
|
|
P60
|
Warstwa o dużej pojemności dla dużych baz danych i obciążeń analitycznych z podwyższonym poziomem liczby operacji we/wy na sekundę.
|
|
P70
|
Zaprojektowany dla systemów o znaczeniu krytycznym wymagających bardzo małych opóźnień i wysokiej współbieżności.
|
|
P80
|
Najwyższej klasy dysk SSD zapewniający maksymalną liczbę operacji we/wy na sekundę i przepustowość, idealny do najbardziej wymagających obciążeń.
|
BackupForPatch
Objekt
Właściwości kopii zapasowej serwera.
| Nazwa |
Typ |
Opis |
|
backupRetentionDays
|
integer
(int32)
|
Dni przechowywania kopii zapasowej serwera.
|
|
earliestRestoreDate
|
string
(date-time)
|
Najwcześniejszy czas punktu przywracania (format ISO8601) dla serwera.
|
|
geoRedundantBackup
|
GeographicallyRedundantBackup
|
Wskazuje, czy serwer jest skonfigurowany do tworzenia geograficznie nadmiarowych kopii zapasowych.
|
Cluster
Objekt
Właściwości klastra serwera.
| Nazwa |
Typ |
Domyślna wartość |
Opis |
|
clusterSize
|
integer
(int32)
|
0
|
Liczba węzłów przypisanych do elastycznego klastra.
|
|
defaultDatabaseName
|
string
|
|
Domyślna nazwa bazy danych dla klastra elastycznego.
|
CreateModeForPatch
Wyliczenie
Tryb aktualizacji istniejącego serwera.
| Wartość |
Opis |
|
Default
|
Jest to odpowiednik "Aktualizacji".
|
|
Update
|
Operacja aktualizuje istniejący serwer.
|
DataEncryption
Objekt
Właściwości szyfrowania danych serwera.
| Nazwa |
Typ |
Opis |
|
geoBackupEncryptionKeyStatus
|
EncryptionKeyStatus
|
Stan klucza używanego przez serwer skonfigurowany z szyfrowaniem danych na podstawie klucza zarządzanego przez klienta do szyfrowania geograficznie nadmiarowego magazynu skojarzonego z serwerem, gdy jest on skonfigurowany do obsługi geograficznie nadmiarowych kopii zapasowych.
|
|
geoBackupKeyURI
|
string
|
Identyfikator tożsamości zarządzanej przypisanej przez użytkownika używanej do uzyskiwania dostępu do klucza w usłudze Azure Key Vault na potrzeby szyfrowania danych magazynu geograficznie nadmiarowego skojarzonego z serwerem skonfigurowanym do obsługi geograficznie nadmiarowych kopii zapasowych.
|
|
geoBackupUserAssignedIdentityId
|
string
|
Identyfikator tożsamości zarządzanej przypisanej przez użytkownika używanej do uzyskiwania dostępu do klucza w usłudze Azure Key Vault na potrzeby szyfrowania danych magazynu geograficznie nadmiarowego skojarzonego z serwerem skonfigurowanym do obsługi geograficznie nadmiarowych kopii zapasowych.
|
|
primaryEncryptionKeyStatus
|
EncryptionKeyStatus
|
Stan klucza używanego przez serwer skonfigurowany z szyfrowaniem danych na podstawie klucza zarządzanego przez klienta do szyfrowania magazynu podstawowego skojarzonego z serwerem.
|
|
primaryKeyURI
|
string
|
Identyfikator URI klucza w usłudze Azure Key Vault używanego do szyfrowania danych magazynu podstawowego skojarzonego z serwerem.
|
|
primaryUserAssignedIdentityId
|
string
|
Identyfikator tożsamości zarządzanej przypisanej przez użytkownika używanej do uzyskiwania dostępu do klucza w usłudze Azure Key Vault na potrzeby szyfrowania danych magazynu podstawowego skojarzonego z serwerem.
|
|
type
|
DataEncryptionType
|
Typ szyfrowania danych używany przez serwer.
|
DataEncryptionType
Wyliczenie
Typ szyfrowania danych używany przez serwer.
| Wartość |
Opis |
|
SystemManaged
|
Szyfrowanie zarządzane przez platformę Azure przy użyciu kluczy zarządzanych przez platformę w celu uproszczenia i zgodności.
|
|
AzureKeyVault
|
Szyfrowanie przy użyciu kluczy zarządzanych przez klienta przechowywanych w usłudze Azure Key Vault w celu zwiększenia kontroli i zabezpieczeń.
|
EncryptionKeyStatus
Wyliczenie
Stan klucza używanego przez serwer skonfigurowany z szyfrowaniem danych na podstawie klucza zarządzanego przez klienta do szyfrowania magazynu podstawowego skojarzonego z serwerem.
| Wartość |
Opis |
|
Valid
|
Klucz jest ważny i może być używany do szyfrowania.
|
|
Invalid
|
Klucz jest nieprawidłowy i nie można go użyć do szyfrowania. Możliwe przyczyny to usunięcie klucza, zmiany uprawnień, wyłączenie klucza, nieobsługiwany typ klucza lub bieżąca data poza okresem ważności powiązanym z kluczem.
|
ErrorAdditionalInfo
Objekt
Dodatkowe informacje o błędzie zarządzania zasobami.
| Nazwa |
Typ |
Opis |
|
info
|
object
|
Dodatkowe informacje.
|
|
type
|
string
|
Dodatkowy typ informacji.
|
ErrorDetail
Objekt
Szczegóły błędu.
| Nazwa |
Typ |
Opis |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Błąd dodatkowe informacje.
|
|
code
|
string
|
Kod błędu.
|
|
details
|
ErrorDetail[]
|
Szczegóły błędu.
|
|
message
|
string
|
Komunikat o błędzie.
|
|
target
|
string
|
Wartość docelowa błędu.
|
ErrorResponse
Objekt
Odpowiedź na błąd
GeographicallyRedundantBackup
Wyliczenie
Wskazuje, czy serwer jest skonfigurowany do tworzenia geograficznie nadmiarowych kopii zapasowych.
| Wartość |
Opis |
|
Enabled
|
Serwer jest skonfigurowany do tworzenia geograficznie nadmiarowych kopii zapasowych.
|
|
Disabled
|
Serwer nie jest skonfigurowany do tworzenia geograficznie nadmiarowych kopii zapasowych.
|
HighAvailabilityForPatch
Objekt
Właściwości wysokiej dostępności serwera.
| Nazwa |
Typ |
Opis |
|
mode
|
HighAvailabilityMode
|
Tryb wysokiej dostępności serwera.
|
|
standbyAvailabilityZone
|
string
|
Strefa dostępności skojarzona z serwerem rezerwowym utworzona, gdy wysoka dostępność jest ustawiona na SameZone lub ZoneRedundant.
|
|
state
|
HighAvailabilityState
|
Możliwe stany serwera rezerwowego utworzonego, gdy wysoka dostępność jest ustawiona na SameZone lub ZoneRedundant.
|
HighAvailabilityMode
Wyliczenie
Tryb wysokiej dostępności serwera.
| Wartość |
Opis |
|
Disabled
|
Wysoka dostępność jest wyłączona dla serwera.
|
|
ZoneRedundant
|
Wysoka dostępność jest włączona dla serwera, a serwer rezerwowy znajduje się w innej strefie dostępności niż serwer podstawowy.
|
|
SameZone
|
Wysoka dostępność jest włączona dla serwera, a serwer rezerwowy znajduje się w tej samej strefie dostępności co serwer podstawowy.
|
HighAvailabilityState
Wyliczenie
Możliwe stany serwera rezerwowego utworzonego, gdy wysoka dostępność jest ustawiona na SameZone lub ZoneRedundant.
| Wartość |
Opis |
|
NotEnabled
|
Wysoka dostępność nie jest włączona dla serwera.
|
|
CreatingStandby
|
Tworzony jest serwer rezerwowy.
|
|
ReplicatingData
|
Dane są replikowane na serwer rezerwowy.
|
|
FailingOver
|
Operacja przełączania awaryjnego na serwer rezerwowy jest w toku.
|
|
Healthy
|
Serwer rezerwowy jest w dobrej kondycji i gotowy do przejęcia w przypadku przejścia w tryb failover.
|
|
RemovingStandby
|
Serwer rezerwowy jest usuwany.
|
IdentityType
Wyliczenie
Typy tożsamości skojarzonych z serwerem.
| Wartość |
Opis |
|
None
|
Do serwera nie jest przypisana żadna tożsamość zarządzana.
|
|
UserAssigned
|
Do serwera jest przypisana co najmniej jedna tożsamość zarządzana dostarczona przez użytkownika.
|
|
SystemAssigned
|
Platforma Azure automatycznie tworzy tożsamość skojarzoną z cyklem życia serwera i zarządza nią.
|
|
SystemAssigned,UserAssigned
|
Do serwera przypisywane są zarówno tożsamości przypisane przez system, jak i przez użytkownika.
|
MaintenanceWindowForPatch
Objekt
Właściwości okna obsługi serwera.
| Nazwa |
Typ |
Opis |
|
customWindow
|
string
|
Wskazuje, czy okno niestandardowe jest włączone, czy wyłączone.
|
|
dayOfWeek
|
integer
(int32)
|
Dzień tygodnia, który ma być używany dla okna konserwacji.
|
|
startHour
|
integer
(int32)
|
Godzina początkowa, która ma być używana dla okna obsługi.
|
|
startMinute
|
integer
(int32)
|
Minuta początkowa używana dla okna obsługi.
|
MicrosoftEntraAuth
Wyliczenie
Wskazuje, czy serwer obsługuje uwierzytelnianie Microsoft Entra.
| Wartość |
Opis |
|
Enabled
|
Serwer obsługuje uwierzytelnianie Microsoft Entra.
|
|
Disabled
|
Serwer nie obsługuje uwierzytelniania Microsoft Entra.
|
Network
Objekt
Właściwości sieci serwera.
| Nazwa |
Typ |
Opis |
|
delegatedSubnetResourceId
|
string
|
Identyfikator zasobu delegowanej podsieci. Wymagane podczas tworzenia nowego serwera, w przypadku, gdy chcesz, aby serwer został zintegrowany z własną siecią wirtualną. W przypadku operacji aktualizacji należy podać tę właściwość tylko wtedy, gdy chcesz zmienić wartość przypisaną do prywatnej strefy DNS.
|
|
privateDnsZoneArmResourceId
|
string
|
Identyfikator prywatnej strefy DNS. Wymagane podczas tworzenia nowego serwera, w przypadku, gdy chcesz, aby serwer został zintegrowany z własną siecią wirtualną. W przypadku operacji aktualizacji należy podać tę właściwość tylko wtedy, gdy chcesz zmienić wartość przypisaną do prywatnej strefy DNS.
|
|
publicNetworkAccess
|
ServerPublicNetworkAccessState
|
Wskazuje, czy dostęp do sieci publicznej jest włączony, czy nie. Jest to obsługiwane tylko w przypadku serwerów, które nie są zintegrowane z siecią wirtualną, która jest własnością klienta i jest przez niego udostępniana podczas wdrażania serwera.
|
PasswordBasedAuth
Wyliczenie
Wskazuje, czy serwer obsługuje uwierzytelnianie oparte na hasłach.
| Wartość |
Opis |
|
Enabled
|
Serwer obsługuje uwierzytelnianie oparte na hasłach.
|
|
Disabled
|
Serwer nie obsługuje uwierzytelniania opartego na hasłach.
|
PostgresMajorVersion
Wyliczenie
Główna wersja silnika bazy danych PostgreSQL.
| Wartość |
Opis |
|
18
|
PostgreSQL 18.
|
|
17
|
PostgreSQL 17.
|
|
16
|
PostgreSQL 16.
|
|
15
|
PostgreSQL 15.
|
|
14
|
PostgreSQL 14.
|
|
13
|
PostgreSQL 13.
|
|
12
|
PostgreSQL 12.
|
|
11
|
PostgreSQL 11.
|
Wyliczenie
Typ operacji, która ma zostać zastosowana na replice do odczytu. Ta właściwość to tylko zapis. Autonomiczny oznacza, że replika do odczytu zostanie podniesiona do poziomu serwera autonomicznego i stanie się całkowicie niezależną jednostką od zestawu replikacji. Przełączenie oznacza, że replika do odczytu będzie pełnić role z serwerem podstawowym.
| Wartość |
Opis |
|
Standalone
|
Odczytana replika stanie się niezależnym serwerem.
|
|
Switchover
|
Replika do odczytu zamieni role z serwerem podstawowym.
|
Wyliczenie
Opcja synchronizacji danych, która ma być używana podczas przetwarzania operacji określonej we właściwości promoteMode. Ta właściwość to tylko zapis.
| Wartość |
Opis |
|
Planned
|
Operacja będzie czekać, aż dane w replice do odczytu zostaną w pełni zsynchronizowane z serwerem źródłowym, zanim zainicjuje operację.
|
|
Forced
|
Operacja nie będzie czekać na zsynchronizowanie danych w replice do odczytu z serwerem źródłowym przed zainicjowaniem operacji.
|
Replica
Objekt
Właściwości repliki serwera.
| Nazwa |
Typ |
Opis |
|
capacity
|
integer
(int32)
|
Maksymalna liczba replik do odczytu dozwolona dla serwera.
|
|
promoteMode
|
ReadReplicaPromoteMode
|
Typ operacji, która ma zostać zastosowana na replice do odczytu. Ta właściwość to tylko zapis. Autonomiczny oznacza, że replika do odczytu zostanie podniesiona do poziomu serwera autonomicznego i stanie się całkowicie niezależną jednostką od zestawu replikacji. Przełączenie oznacza, że replika do odczytu będzie pełnić role z serwerem podstawowym.
|
|
promoteOption
|
ReadReplicaPromoteOption
|
Opcja synchronizacji danych, która ma być używana podczas przetwarzania operacji określonej we właściwości promoteMode. Ta właściwość to tylko zapis.
|
|
replicationState
|
ReplicationState
|
Wskazuje stan replikacji repliki do odczytu. Ta właściwość jest zwracana tylko wtedy, gdy serwer docelowy jest repliką do odczytu. Możliwe wartości to Active, Broken, Catchup, Provisioning, Reconfigure i Updating
|
|
role
|
ReplicationRole
|
Rola serwera w zestawie replikacji.
|
ReplicationRole
Wyliczenie
Rola serwera w zestawie replikacji.
| Wartość |
Opis |
|
None
|
Nie przypisano żadnej roli replikacji; Serwer działa niezależnie.
|
|
Primary
|
Działa jako serwer źródłowy dla replikacji do co najmniej jednej repliki.
|
|
AsyncReplica
|
Odbiera dane asynchronicznie z serwera podstawowego w tym samym regionie.
|
|
GeoAsyncReplica
|
Odbiera dane asynchronicznie z serwera podstawowego w innym regionie w celu zapewnienia nadmiarowości geograficznej.
|
ReplicationState
Wyliczenie
Wskazuje stan replikacji repliki do odczytu. Ta właściwość jest zwracana tylko wtedy, gdy serwer docelowy jest repliką do odczytu. Możliwe wartości to Active, Broken, Catchup, Provisioning, Reconfigure i Updating
| Wartość |
Opis |
|
Active
|
Replika do odczytu jest w pełni zsynchronizowana i aktywnie replikuje dane z serwera podstawowego.
|
|
Catchup
|
Replika do odczytu znajduje się za serwerem podstawowym i obecnie nadrabia zaległości w oczekujących zmianach.
|
|
Provisioning
|
Replika do odczytu jest tworzona i jest w trakcie inicjowania.
|
|
Updating
|
Replika odczytu przechodzi pewne zmiany, może to być zmiana rozmiaru obliczeniowego podwyższania jej do serwera podstawowego.
|
|
Broken
|
Replikacja nie powiodła się lub została przerwana.
|
|
Reconfiguring
|
Replika do odczytu jest ponownie konfigurowana, prawdopodobnie z powodu zmian w źródle lub ustawieniach.
|
ServerForPatch
Objekt
Reprezentuje serwer do zaktualizowania.
| Nazwa |
Typ |
Opis |
|
identity
|
UserAssignedIdentity
|
Opisuje tożsamość aplikacji.
|
|
properties.administratorLogin
|
string
|
Nazwa loginu wyznaczonego jako pierwszy administrator oparty na hasłach przypisany do Twojej instancji PostgreSQL. Musi być określona przy pierwszym włączeniu uwierzytelniania opartego na hasłach na serwerze. Raz ustawiona na daną wartość nie może być zmieniona do końca życia serwera. Jeśli wyłączysz uwierzytelnianie oparte na hasłach na serwerze, na którym jest włączone, ta rola oparta na hasłach nie zostanie usunięta.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Hasło przypisane do loginu administratora. Dopóki uwierzytelnianie hasłem jest włączone, hasło to można zmienić w dowolnym momencie.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Właściwości konfiguracji uwierzytelniania serwera.
|
|
properties.availabilityZone
|
string
|
Strefa dostępności serwera.
|
|
properties.backup
|
BackupForPatch
|
Właściwości kopii zapasowej serwera.
|
|
properties.cluster
|
Cluster
|
Właściwości klastra serwera.
|
|
properties.createMode
|
CreateModeForPatch
|
Tryb aktualizacji istniejącego serwera.
|
|
properties.dataEncryption
|
DataEncryption
|
Właściwości szyfrowania danych serwera.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Właściwości wysokiej dostępności serwera.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Właściwości okna obsługi serwera.
|
|
properties.network
|
Network
|
Właściwości sieci serwera. Wymagane tylko wtedy, gdy chcesz, aby serwer był zintegrowany z siecią wirtualną dostarczoną przez klienta.
|
|
properties.replica
|
Replica
|
Odczytywanie właściwości repliki serwera. Wymagane tylko w przypadku, gdy chcesz podwyższyć poziom serwera.
|
|
properties.replicationRole
|
ReplicationRole
|
Rola serwera w zestawie replikacji.
|
|
properties.storage
|
Storage
|
Właściwości magazynu serwera.
|
|
properties.version
|
PostgresMajorVersion
|
Główna wersja silnika bazy danych PostgreSQL.
|
|
sku
|
SkuForPatch
|
Warstwa obliczeniowa i rozmiar serwera.
|
|
tags
|
object
|
Metadane specyficzne dla aplikacji w postaci par klucz-wartość.
|
ServerPublicNetworkAccessState
Wyliczenie
Wskazuje, czy dostęp do sieci publicznej jest włączony, czy nie. Jest to obsługiwane tylko w przypadku serwerów, które nie są zintegrowane z siecią wirtualną, która jest własnością klienta i jest przez niego udostępniana podczas wdrażania serwera.
| Wartość |
Opis |
|
Enabled
|
Dostęp do sieci publicznej jest włączony. Dzięki temu dostęp do serwera może być uzyskiwany z publicznego Internetu, pod warunkiem, że istnieje niezbędna reguła zapory, która zezwala na ruch przychodzący pochodzący od klienta łączącego. Jest to zgodne z użyciem prywatnych punktów końcowych do nawiązywania połączenia z tym serwerem.
|
|
Disabled
|
Dostęp do sieci publicznej jest wyłączony. Oznacza to, że nie można uzyskać dostępu do serwera z publicznego Internetu, ale tylko za pośrednictwem prywatnych punktów końcowych.
|
SkuForPatch
Objekt
Informacje o obliczeniach serwera.
| Nazwa |
Typ |
Opis |
|
name
|
string
|
Nazwa, pod którą jest znany dany rozmiar obliczeniowy przypisany do serwera.
|
|
tier
|
SkuTier
|
Warstwa zasobów obliczeniowych przypisana do serwera.
|
SkuTier
Wyliczenie
Warstwa zasobów obliczeniowych przypisana do serwera.
| Wartość |
Opis |
|
Burstable
|
Ekonomiczna warstwa do rzadkiego użycia procesora CPU, idealna do tworzenia i testowania obciążeń o niskich wymaganiach dotyczących wydajności.
|
|
GeneralPurpose
|
Zrównoważone zasoby obliczeniowe i pamięć dla większości obciążeń, oferujące skalowalną wydajność i przepustowość we/wy.
|
|
MemoryOptimized
|
Wysoki stosunek pamięci do rdzenia dla wymagających obciążeń wymagających szybkiego przetwarzania w pamięci i wysokiej współbieżności.
|
Storage
Objekt
Właściwości magazynu serwera.
| Nazwa |
Typ |
Opis |
|
autoGrow
|
StorageAutoGrow
|
Flaga, aby włączyć lub wyłączyć automatyczne zwiększanie rozmiaru pamięci masowej serwera, gdy dostępne miejsce jest bliskie zeru, a warunki pozwalają na automatyczne zwiększanie rozmiaru pamięci masowej.
|
|
iops
|
integer
(int32)
|
Maksymalna liczba operacji we/wy na sekundę obsługiwana przez magazyn. Wymagane, gdy typ magazynu to PremiumV2_LRS lub UltraSSD_LRS.
|
|
storageSizeGB
|
integer
(int32)
|
Rozmiar magazynu przypisanego do serwera.
|
|
throughput
|
integer
(int32)
|
Maksymalna przepływność obsługiwana dla magazynu. Wymagane, gdy typ magazynu to PremiumV2_LRS lub UltraSSD_LRS.
|
|
tier
|
AzureManagedDiskPerformanceTier
|
Warstwa magazynowania serwera.
|
|
type
|
StorageType
|
Typ magazynu przypisanego do serwera. Dozwolone wartości to Premium_LRS, PremiumV2_LRS lub UltraSSD_LRS. Jeśli nie zostanie określony, wartość domyślna to Premium_LRS.
|
StorageAutoGrow
Wyliczenie
Flaga, aby włączyć lub wyłączyć automatyczne zwiększanie rozmiaru pamięci masowej serwera, gdy dostępne miejsce jest bliskie zeru, a warunki pozwalają na automatyczne zwiększanie rozmiaru pamięci masowej.
| Wartość |
Opis |
|
Enabled
|
Serwer powinien automatycznie zwiększać rozmiar pamięci masowej, gdy dostępna przestrzeń jest bliska zeru, a warunki pozwalają na automatyczne zwiększanie rozmiaru pamięci masowej.
|
|
Disabled
|
Serwer nie powinien automatycznie zwiększać rozmiaru pamięci masowej, gdy dostępna przestrzeń jest bliska zeru.
|
StorageType
Wyliczenie
Typ magazynu przypisanego do serwera. Dozwolone wartości to Premium_LRS, PremiumV2_LRS lub UltraSSD_LRS. Jeśli nie zostanie określony, wartość domyślna to Premium_LRS.
| Wartość |
Opis |
|
Premium_LRS
|
Magazyn oparty na dyskach półprzewodnikowych (SSD) w warstwie Standardowa zapewnia stałą wydajność dla obciążeń ogólnego przeznaczenia.
|
|
PremiumV2_LRS
|
Pamięć masowa SSD nowej generacji o zwiększonej skalowalności i wydajności dla wymagających obciążeń korporacyjnych.
|
|
UltraSSD_LRS
|
Wysokiej klasy pamięć masowa SSD (Solid State Disk) zaprojektowana z myślą o aplikacjach wrażliwych na ekstremalną liczbę operacji we/wy na sekundę i opóźnienia.
|
UserAssignedIdentity
Objekt
Tożsamości skojarzone z serwerem.
| Nazwa |
Typ |
Opis |
|
principalId
|
string
|
Identyfikator obiektu jednostki usługi skojarzonej z tożsamością zarządzaną przypisaną przez użytkownika.
|
|
tenantId
|
string
|
Identyfikator dzierżawcy serwera.
|
|
type
|
IdentityType
|
Typy tożsamości skojarzonych z serwerem.
|
|
userAssignedIdentities
|
<string,
UserIdentity>
|
Mapa tożsamości zarządzanych przypisanych przez użytkownika.
|
UserIdentity
Objekt
Tożsamość zarządzana przypisana przez użytkownika skojarzona z serwerem.
| Nazwa |
Typ |
Opis |
|
clientId
|
string
|
Identyfikator klienta jednostki usługi skojarzonej z tożsamością zarządzaną przypisaną przez użytkownika.
|
|
principalId
|
string
|
Identyfikator obiektu jednostki usługi skojarzonej z tożsamością zarządzaną przypisaną przez użytkownika.
|