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.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
|
|
Zaakceptowano operację zasobu.
Nagłówki
- Azure-AsyncOperation: string
- Location: string
- Retry-After: integer
|
|
Other Status Codes
|
ErrorResponse
|
Nieoczekiwana odpowiedź na błąd.
|
Zabezpieczenia
azure_auth
Przepływ OAuth2 w usłudze Azure Active Directory.
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresów
| Nazwa |
Opis |
|
user_impersonation
|
Podszywać się pod Twoje konto użytkownika
|
Przykłady
Przykładowe zapytanie
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json
func ExampleServersClient_BeginUpdate_promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesntWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
Replica: &armpostgresqlflexibleservers.Replica{
PromoteMode: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteModeStandalone),
PromoteOption: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteOptionForced),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json
func ExampleServersClient_BeginUpdate_promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
Replica: &armpostgresqlflexibleservers.Replica{
PromoteMode: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteModeStandalone),
PromoteOption: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteOptionPlanned),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json
func ExampleServersClient_BeginUpdate_switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesntWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
Replica: &armpostgresqlflexibleservers.Replica{
PromoteMode: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteModeSwitchover),
PromoteOption: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteOptionForced),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json
func ExampleServersClient_BeginUpdate_switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
Replica: &armpostgresqlflexibleservers.Replica{
PromoteMode: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteModeSwitchover),
PromoteOption: to.Ptr(armpostgresqlflexibleservers.ReadReplicaPromoteOptionPlanned),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json
func ExampleServersClient_BeginUpdate_updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeForPatchUpdate),
Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSeventeen),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json
func ExampleServersClient_BeginUpdate_updateAnExistingServerWithCustomMaintenanceWindow() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeForPatchUpdate),
MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindowForPatch{
CustomWindow: to.Ptr("Enabled"),
DayOfWeek: to.Ptr[int32](0),
StartHour: to.Ptr[int32](8),
StartMinute: to.Ptr[int32](0),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"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": {
"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"
}
},
"sku": {
"name": "Standard_D8s_v3",
"tier": "GeneralPurpose"
}
}
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json
func ExampleServersClient_BeginUpdate_updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/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: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
AdministratorLoginPassword: to.Ptr("examplenewpassword"),
Backup: &armpostgresqlflexibleservers.BackupForPatch{
BackupRetentionDays: to.Ptr[int32](20),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeForPatchUpdate),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr("https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey"),
GeoBackupUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"),
PrimaryKeyURI: to.Ptr("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
},
},
SKU: &armpostgresqlflexibleservers.SKUForPatch{
Name: to.Ptr("Standard_D8s_v3"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"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": {
"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"
}
},
"sku": {
"name": "Standard_D8s_v3",
"tier": "GeneralPurpose"
}
}
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json
func ExampleServersClient_BeginUpdate_updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/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: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
AdministratorLoginPassword: to.Ptr("examplenewpassword"),
Backup: &armpostgresqlflexibleservers.BackupForPatch{
BackupRetentionDays: to.Ptr[int32](20),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeForPatchUpdate),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr("https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"),
GeoBackupUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"),
PrimaryKeyURI: to.Ptr("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
},
},
SKU: &armpostgresqlflexibleservers.SKUForPatch{
Name: to.Ptr("Standard_D8s_v3"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"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"
}
}
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json
func ExampleServersClient_BeginUpdate_updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
AdministratorLoginPassword: to.Ptr("examplenewpassword"),
AuthConfig: &armpostgresqlflexibleservers.AuthConfigForPatch{
ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.MicrosoftEntraAuthEnabled),
PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordBasedAuthEnabled),
TenantID: to.Ptr("tttttt-tttt-tttt-tttt-tttttttttttt"),
},
Backup: &armpostgresqlflexibleservers.BackupForPatch{
BackupRetentionDays: to.Ptr[int32](20),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeForPatchUpdate),
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
StorageSizeGB: to.Ptr[int32](1024),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP30),
},
},
SKU: &armpostgresqlflexibleservers.SKUForPatch{
Name: to.Ptr("Standard_D8s_v3"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 zapytanie
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"administratorLoginPassword": "examplenewpassword",
"backup": {
"backupRetentionDays": 20
},
"createMode": "Update",
"storage": {
"autoGrow": "Enabled",
"storageSizeGB": 1024,
"tier": "P30"
}
},
"sku": {
"name": "Standard_D8s_v3",
"tier": "GeneralPurpose"
}
}
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
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json
func ExampleServersClient_BeginUpdate_updateAnExistingServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.ServerForPatch{
Properties: &armpostgresqlflexibleservers.ServerPropertiesForPatch{
AdministratorLoginPassword: to.Ptr("examplenewpassword"),
Backup: &armpostgresqlflexibleservers.BackupForPatch{
BackupRetentionDays: to.Ptr[int32](20),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeForPatchUpdate),
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowEnabled),
StorageSizeGB: to.Ptr[int32](1024),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP30),
},
},
SKU: &armpostgresqlflexibleservers.SKUForPatch{
Name: to.Ptr("Standard_D8s_v3"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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.
|
|
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.
|
|
PostgreSqlFlexibleServerHighAvailabilityMode
|
Tryby wysokiej dostępności obsługiwane dla tych obliczeń.
|
|
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.
|
|
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
Sprzeciwiać się
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
|
|
|
P2
|
|
|
P3
|
|
|
P4
|
|
|
P6
|
|
|
P10
|
|
|
P15
|
|
|
P20
|
|
|
P30
|
|
|
P40
|
|
|
P50
|
|
|
P60
|
|
|
P70
|
|
|
P80
|
|
BackupForPatch
Sprzeciwiać się
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
Sprzeciwiać się
Właściwości klastra serwera.
| Nazwa |
Typ |
Wartość domyślna |
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
|
|
|
Update
|
|
DataEncryption
Sprzeciwiać się
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
|
|
|
AzureKeyVault
|
|
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
|
|
|
Invalid
|
|
ErrorAdditionalInfo
Sprzeciwiać się
Dodatkowe informacje o błędzie zarządzania zasobami.
| Nazwa |
Typ |
Opis |
|
info
|
object
|
Dodatkowe informacje.
|
|
type
|
string
|
Dodatkowy typ informacji.
|
ErrorDetail
Sprzeciwiać się
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
Sprzeciwiać się
Odpowiedź na błąd
GeographicallyRedundantBackup
Wyliczenie
Wskazuje, czy serwer jest skonfigurowany do tworzenia geograficznie nadmiarowych kopii zapasowych.
| Wartość |
Opis |
|
Enabled
|
|
|
Disabled
|
|
HighAvailabilityForPatch
Sprzeciwiać się
Właściwości wysokiej dostępności serwera.
| Nazwa |
Typ |
Opis |
|
mode
|
PostgreSqlFlexibleServerHighAvailabilityMode
|
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.
|
HighAvailabilityState
Wyliczenie
Możliwe stany serwera rezerwowego utworzonego, gdy wysoka dostępność jest ustawiona na SameZone lub ZoneRedundant.
| Wartość |
Opis |
|
NotEnabled
|
|
|
CreatingStandby
|
|
|
ReplicatingData
|
|
|
FailingOver
|
|
|
Healthy
|
|
|
RemovingStandby
|
|
IdentityType
Wyliczenie
Typy tożsamości skojarzonych z serwerem.
| Wartość |
Opis |
|
None
|
|
|
UserAssigned
|
|
|
SystemAssigned
|
|
|
SystemAssigned,UserAssigned
|
|
MaintenanceWindowForPatch
Sprzeciwiać się
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
|
|
|
Disabled
|
|
Network
Sprzeciwiać się
Właściwości sieci serwera.
| Nazwa |
Typ |
Opis |
|
delegatedSubnetResourceId
|
string
(arm-id)
|
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
(arm-id)
|
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
|
|
|
Disabled
|
|
PostgresMajorVersion
Wyliczenie
Główna wersja silnika bazy danych PostgreSQL.
| Wartość |
Opis |
|
18
|
|
|
17
|
|
|
16
|
|
|
15
|
|
|
14
|
|
|
13
|
|
|
12
|
|
|
11
|
|
PostgreSqlFlexibleServerHighAvailabilityMode
Wyliczenie
Tryby wysokiej dostępności obsługiwane dla tych obliczeń.
| Wartość |
Opis |
|
Disabled
|
|
|
ZoneRedundant
|
|
|
SameZone
|
|
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
Sprzeciwiać się
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
|
|
|
Primary
|
|
|
AsyncReplica
|
|
|
GeoAsyncReplica
|
|
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
|
Serwer repliki odczytu jest w pełni zsynchronizowany i aktywnie replikuje dane z serwera głównego.
|
|
Catchup
|
Serwer repliki odczytu znajduje się za serwerem głównym i obecnie nadrabia oczekujące zmiany.
|
|
Provisioning
|
Serwer replik odczytu jest tworzony i jest w trakcie inicjalizacji.
|
|
Updating
|
Serwer repliki odczytu przechodzi pewne zmiany, może zmieniać rozmiar obliczeniowy i promować go na serwer główny.
|
|
Broken
|
Replikacja nie powiodła się lub została przerwana.
|
|
Reconfiguring
|
Serwer replik odczytu jest rekonfigurowany, prawdopodobnie z powodu zmian w źródle lub ustawieniach.
|
ServerForPatch
Sprzeciwiać się
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.
| Wartość |
Opis |
|
Enabled
|
|
|
Disabled
|
|
SkuForPatch
Sprzeciwiać się
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
|
|
|
GeneralPurpose
|
|
|
MemoryOptimized
|
|
Storage
Sprzeciwiać się
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
|
|
|
Disabled
|
|
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
|
|
|
PremiumV2_LRS
|
|
|
UltraSSD_LRS
|
|
UserAssignedIdentity
Sprzeciwiać się
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
Sprzeciwiać się
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.
|