Atualiza um servidor existente. O corpo da solicitação pode conter uma ou várias das propriedades presentes na definição normal do servidor.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}?api-version=2025-08-01
Parâmetros de URI
| Nome |
Em |
Obrigatório |
Tipo |
Description |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
O nome do grupo de recursos. O nome não diferencia maiúsculas de minúsculas.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
O nome do servidor.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
A ID da assinatura de destino. O valor deve ser uma UUID.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
A versão da API a ser usada para esta operação.
|
Corpo da solicitação
| Nome |
Tipo |
Description |
|
identity
|
UserAssignedIdentity
|
Descreve a identidade do aplicativo.
|
|
properties.administratorLogin
|
string
|
Nome do logon designado como o primeiro administrador baseado em senha atribuído à sua instância do PostgreSQL. Deve ser especificado na primeira vez que você habilitar a autenticação baseada em senha em um servidor. Uma vez definido para um determinado valor, ele não pode ser alterado pelo resto da vida útil de um servidor. Se você desabilitar a autenticação baseada em senha em um servidor que a habilitou, essa função baseada em senha não será excluída.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Senha atribuída ao login do administrador. Desde que a autenticação de senha esteja habilitada, essa senha pode ser alterada a qualquer momento.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Propriedades de configuração de autenticação de um servidor.
|
|
properties.availabilityZone
|
string
|
Zona de disponibilidade de um servidor.
|
|
properties.backup
|
BackupForPatch
|
Propriedades de backup de um servidor.
|
|
properties.cluster
|
Cluster
|
Propriedades de cluster de um servidor.
|
|
properties.createMode
|
CreateModeForPatch
|
Modo de atualização de um servidor existente.
|
|
properties.dataEncryption
|
DataEncryption
|
Propriedades de criptografia de dados de um servidor.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Propriedades de alta disponibilidade de um servidor.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Propriedades da janela de manutenção de um servidor.
|
|
properties.network
|
Network
|
Propriedades de rede de um servidor. Necessário apenas se você quiser que seu servidor seja integrado a uma rede virtual fornecida pelo cliente.
|
|
properties.replica
|
Replica
|
Propriedades de réplica de leitura de um servidor. Obrigatório apenas no caso de você querer promover um servidor.
|
|
properties.replicationRole
|
ReplicationRole
|
Função do servidor em um conjunto de replicação.
|
|
properties.storage
|
Storage
|
Propriedades de armazenamento de um servidor.
|
|
properties.version
|
PostgresMajorVersion
|
Versão principal do mecanismo de banco de dados PostgreSQL.
|
|
sku
|
SkuForPatch
|
Camada de computação e tamanho de um servidor.
|
|
tags
|
object
|
Os metadados específicos a um aplicativo na forma de pares chave-valor.
|
Respostas
| Nome |
Tipo |
Description |
|
202 Accepted
|
|
Aceitado.
Cabeçalhos
- Location: string
- Azure-AsyncOperation: string
|
|
Other Status Codes
|
ErrorResponse
|
Resposta de erro que descreve por que a operação falhou.
|
Segurança
azure_auth
Fluxo do Microsoft Entra OAuth2
Tipo:
oauth2
Flow:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Escopos
| Nome |
Description |
|
user_impersonation
|
Personificar sua conta de usuário
|
Exemplos
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Standalone",
"promoteOption": "Forced"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsForcedStandaloneServer.json
*/
/**
* Sample code: Promote a read replica to a standalone server with forced data synchronization. Meaning that it
* doesn't wait for data in the read replica to be synchronized with its source server before it initiates the
* promotion to a standalone server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.STANDALONE)
.withPromoteOption(ReadReplicaPromoteOption.FORCED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_forced_standalone_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Standalone", "promoteOption": "Forced"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json
*/
async function promoteAReadReplicaToAStandaloneServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Standalone", promoteOption: "Forced" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Standalone",
"promoteOption": "Planned"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsPlannedStandaloneServer.json
*/
/**
* Sample code: Promote a read replica to a standalone server with planned data synchronization. Meaning that it
* waits for data in the read replica to be fully synchronized with its source server before it initiates the
* promotion to a standalone server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.STANDALONE)
.withPromoteOption(ReadReplicaPromoteOption.PLANNED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_planned_standalone_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Standalone", "promoteOption": "Planned"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json
*/
async function promoteAReadReplicaToAStandaloneServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesThePromotionToAStandaloneServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Standalone", promoteOption: "Planned" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Switchover",
"promoteOption": "Forced"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsForcedSwitchover.json
*/
/**
* Sample code: Switch over a read replica to primary server with forced data synchronization. Meaning that it
* doesn't wait for data in the read replica to be synchronized with its source server before it initiates the
* switching of roles between the read replica and the primary server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.SWITCHOVER)
.withPromoteOption(ReadReplicaPromoteOption.FORCED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_forced_switchover.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Switchover", "promoteOption": "Forced"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json
*/
async function switchOverAReadReplicaToPrimaryServerWithForcedDataSynchronizationMeaningThatItDoesnTWaitForDataInTheReadReplicaToBeSynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Switchover", promoteOption: "Forced" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"replica": {
"promoteMode": "Switchover",
"promoteOption": "Planned"
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ReadReplicaPromoteOption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Replica;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersPromoteReplicaAsPlannedSwitchover.json
*/
/**
* Sample code: Switch over a read replica to primary server with planned data synchronization. Meaning that it
* waits for data in the read replica to be fully synchronized with its source server before it initiates the
* switching of roles between the read replica and the primary server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withReplica(new Replica().withPromoteMode(ReadReplicaPromoteMode.SWITCHOVER)
.withPromoteOption(ReadReplicaPromoteOption.PLANNED)).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_promote_replica_as_planned_switchover.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"replica": {"promoteMode": "Switchover", "promoteOption": "Planned"}}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json
*/
async function switchOverAReadReplicaToPrimaryServerWithPlannedDataSynchronizationMeaningThatItWaitsForDataInTheReadReplicaToBeFullySynchronizedWithItsSourceServerBeforeItInitiatesTheSwitchingOfRolesBetweenTheReadReplicaAndThePrimaryServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
replica: { promoteMode: "Switchover", promoteOption: "Planned" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"createMode": "Update",
"version": "17"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithMajorVersionUpgrade.json
*/
/**
* Sample code: Update an existing server to upgrade the major version of PostgreSQL database engine.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSQLDatabaseEngine(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withVersion(PostgresMajorVersion.ONE_SEVEN).withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_major_version_upgrade.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={"properties": {"createMode": "Update", "version": "17"}},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json
*/
async function updateAnExistingServerToUpgradeTheMajorVersionOfPostgreSqlDatabaseEngine() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = { createMode: "Update", version: "17" };
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"properties": {
"createMode": "Update",
"maintenanceWindow": {
"customWindow": "Enabled",
"dayOfWeek": 0,
"startHour": 8,
"startMinute": 0
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindowForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithCustomMaintenanceWindow.json
*/
/**
* Sample code: Update an existing server with custom maintenance window.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithCustomMaintenanceWindow(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withMaintenanceWindow(new MaintenanceWindowForPatch().withCustomWindow("Enabled")
.withStartHour(8).withStartMinute(0).withDayOfWeek(0)).withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_custom_maintenance_window.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"properties": {
"createMode": "Update",
"maintenanceWindow": {"customWindow": "Enabled", "dayOfWeek": 0, "startHour": 8, "startMinute": 0},
}
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json
*/
async function updateAnExistingServerWithCustomMaintenanceWindow() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
createMode: "Update",
maintenanceWindow: {
customWindow: "Enabled",
dayOfWeek: 0,
startHour: 8,
startMinute: 0,
},
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}
},
"type": "UserAssigned"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"dataEncryption": {
"type": "AzureKeyVault",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryptionType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.IdentityType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithDataEncryptionEnabledAutoUpdate.json
*/
/**
* Sample code: Update an existing server with data encryption based on customer managed key with automatic key
* version update.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withIdentity(new UserAssignedIdentity().withUserAssignedIdentities(mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
new UserIdentity(),
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
new UserIdentity())).withType(IdentityType.USER_ASSIGNED))
.withAdministratorLoginPassword("examplenewpassword")
.withBackup(new BackupForPatch().withBackupRetentionDays(20))
.withDataEncryption(new DataEncryption().withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity")
.withGeoBackupKeyUri("fakeTokenPlaceholder")
.withGeoBackupUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity")
.withType(DataEncryptionType.AZURE_KEY_VAULT))
.withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_data_encryption_enabled_auto_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"dataEncryption": {
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"type": "AzureKeyVault",
},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json
*/
async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
backup: { backupRetentionDays: 20 },
createMode: "Update",
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI: "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey",
geoBackupUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity":
{},
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity":
{},
},
},
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}
},
"type": "UserAssigned"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"dataEncryption": {
"type": "AzureKeyVault",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryptionType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.IdentityType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithDataEncryptionEnabled.json
*/
/**
* Sample code: Update an existing server with data encryption based on customer managed key.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withIdentity(new UserAssignedIdentity().withUserAssignedIdentities(mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
new UserIdentity(),
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
new UserIdentity())).withType(IdentityType.USER_ASSIGNED))
.withAdministratorLoginPassword("examplenewpassword")
.withBackup(new BackupForPatch().withBackupRetentionDays(20))
.withDataEncryption(new DataEncryption().withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity")
.withGeoBackupKeyUri("fakeTokenPlaceholder")
.withGeoBackupUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity")
.withType(DataEncryptionType.AZURE_KEY_VAULT))
.withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_data_encryption_enabled.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"dataEncryption": {
"geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"type": "AzureKeyVault",
},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json
*/
async function updateAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
backup: { backupRetentionDays: 20 },
createMode: "Update",
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI:
"https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
geoBackupUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
primaryKeyURI:
"https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplegeoredundantidentity":
{},
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity":
{},
},
},
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"
},
"storage": {
"storageSizeGB": 1024,
"autoGrow": "Disabled",
"tier": "P30"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfigForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.MicrosoftEntraAuth;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PasswordBasedAuth;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersUpdateWithMicrosoftEntraEnabled.json
*/
/**
* Sample code: Update an existing server with Microsoft Entra authentication enabled.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLoginPassword("examplenewpassword")
.withStorage(new Storage().withStorageSizeGB(1024).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P30))
.withBackup(new BackupForPatch().withBackupRetentionDays(20))
.withAuthConfig(new AuthConfigForPatch().withActiveDirectoryAuth(MicrosoftEntraAuth.ENABLED)
.withPasswordAuth(PasswordBasedAuth.ENABLED).withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt"))
.withCreateMode(CreateModeForPatch.UPDATE).apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update_with_microsoft_entra_enabled.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"properties": {
"administratorLoginPassword": "examplenewpassword",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt",
},
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"storage": {"autoGrow": "Disabled", "storageSizeGB": 1024, "tier": "P30"},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json
*/
async function updateAnExistingServerWithMicrosoftEntraAuthenticationEnabled() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
authConfig: {
activeDirectoryAuth: "Enabled",
passwordAuth: "Enabled",
tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt",
},
backup: { backupRetentionDays: 20 },
createMode: "Update",
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 1024, tier: "P30" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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.
Solicitação de exemplo
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D8s_v3"
},
"properties": {
"administratorLoginPassword": "examplenewpassword",
"createMode": "Update",
"storage": {
"storageSizeGB": 1024,
"autoGrow": "Enabled",
"tier": "P30"
},
"backup": {
"backupRetentionDays": 20
}
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Server;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuForPatch;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json
*/
/**
* Sample code: Update an existing server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
updateAnExistingServer(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
Server resource = manager.servers()
.getByResourceGroupWithResponse("exampleresourcegroup", "exampleserver", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withSku(new SkuForPatch().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLoginPassword("examplenewpassword")
.withStorage(new Storage().withStorageSizeGB(1024).withAutoGrow(StorageAutoGrow.ENABLED)
.withTier(AzureManagedDiskPerformanceTier.P30))
.withBackup(new BackupForPatch().withBackupRetentionDays(20)).withCreateMode(CreateModeForPatch.UPDATE)
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-postgresqlflexibleservers
# USAGE
python servers_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"properties": {
"administratorLoginPassword": "examplenewpassword",
"backup": {"backupRetentionDays": 20},
"createMode": "Update",
"storage": {"autoGrow": "Enabled", "storageSizeGB": 1024, "tier": "P30"},
},
"sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one or multiple of the properties present in the normal server definition.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json
*/
async function updateAnExistingServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "exampleresourcegroup";
const serverName = "exampleserver";
const parameters = {
administratorLoginPassword: "examplenewpassword",
backup: { backupRetentionDays: 20 },
createMode: "Update",
sku: { name: "Standard_D8s_v3", tier: "GeneralPurpose" },
storage: { autoGrow: "Enabled", storageSizeGB: 1024, tier: "P30" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta de exemplo
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
Definições
| Nome |
Description |
|
AuthConfigForPatch
|
Propriedades de configuração de autenticação de um servidor.
|
|
AzureManagedDiskPerformanceTier
|
Camada de armazenamento de um servidor.
|
|
BackupForPatch
|
Propriedades de backup de um servidor.
|
|
Cluster
|
Propriedades de cluster de um servidor.
|
|
CreateModeForPatch
|
Modo de atualização de um servidor existente.
|
|
DataEncryption
|
Propriedades de criptografia de dados de um servidor.
|
|
DataEncryptionType
|
Tipo de criptografia de dados usado por um servidor.
|
|
EncryptionKeyStatus
|
Status da chave usada por um servidor configurado com criptografia de dados com base na chave gerenciada pelo cliente, para criptografar o armazenamento primário associado ao servidor.
|
|
ErrorAdditionalInfo
|
As informações adicionais do erro de gerenciamento de recursos.
|
|
ErrorDetail
|
O detalhe do erro.
|
|
ErrorResponse
|
Resposta de erro
|
|
GeographicallyRedundantBackup
|
Indica se o servidor está configurado para criar backups com redundância geográfica.
|
|
HighAvailabilityForPatch
|
Propriedades de alta disponibilidade de um servidor.
|
|
HighAvailabilityMode
|
Modo de alta disponibilidade para um servidor.
|
|
HighAvailabilityState
|
Possíveis estados do servidor em espera criados quando a alta disponibilidade é definida como SameZone ou ZoneRedundant.
|
|
IdentityType
|
Tipos de identidades associadas a um servidor.
|
|
MaintenanceWindowForPatch
|
Propriedades da janela de manutenção de um servidor.
|
|
MicrosoftEntraAuth
|
Indica se o servidor dá suporte à autenticação do Microsoft Entra.
|
|
Network
|
Propriedades de rede de um servidor.
|
|
PasswordBasedAuth
|
Indica se o servidor oferece suporte à autenticação baseada em senha.
|
|
PostgresMajorVersion
|
Versão principal do mecanismo de banco de dados PostgreSQL.
|
|
ReadReplicaPromoteMode
|
Tipo de operação a ser aplicada na réplica de leitura. Essa propriedade é somente gravação. Autônomo significa que a réplica de leitura será promovida a um servidor autônomo e se tornará uma entidade completamente independente do conjunto de replicação. Alternância significa que a réplica de leitura terá funções com o servidor primário.
|
|
ReadReplicaPromoteOption
|
Opção de sincronização de dados a ser usada ao processar a operação especificada na propriedade promoteMode. Essa propriedade é somente gravação.
|
|
Replica
|
Propriedades de réplica de um servidor.
|
|
ReplicationRole
|
Função do servidor em um conjunto de replicação.
|
|
ReplicationState
|
Indica o estado de replicação de uma réplica de leitura. Essa propriedade é retornada somente quando o servidor de destino é uma réplica de leitura. Os valores possíveis são Ativo, Quebrado, Catchup, Provisionamento, Reconfiguração e Atualização
|
|
ServerForPatch
|
Representa um servidor a ser atualizado.
|
|
ServerPublicNetworkAccessState
|
Indica se o acesso à rede pública está habilitado ou não. Isso só tem suporte para servidores que não estão integrados a uma rede virtual que pertence e é fornecida pelo cliente quando o servidor é implantado.
|
|
SkuForPatch
|
Compute as informações de um servidor.
|
|
SkuTier
|
Camada da computação atribuída a um servidor.
|
|
Storage
|
Propriedades de armazenamento de um servidor.
|
|
StorageAutoGrow
|
Sinalizador para habilitar ou desabilitar o crescimento automático do tamanho do armazenamento de um servidor quando o espaço disponível estiver próximo de zero e as condições permitirem o aumento automático do tamanho do armazenamento.
|
|
StorageType
|
Tipo de armazenamento atribuído a um servidor. Os valores permitidos são Premium_LRS, PremiumV2_LRS ou UltraSSD_LRS. Se não for especificado, o padrão será Premium_LRS.
|
|
UserAssignedIdentity
|
Identidades associadas a um servidor.
|
|
UserIdentity
|
Identidade gerenciada atribuída pelo usuário associada a um servidor.
|
AuthConfigForPatch
Objeto
Propriedades de configuração de autenticação de um servidor.
| Nome |
Tipo |
Description |
|
activeDirectoryAuth
|
MicrosoftEntraAuth
|
Indica se o servidor dá suporte à autenticação do Microsoft Entra.
|
|
passwordAuth
|
PasswordBasedAuth
|
Indica se o servidor oferece suporte à autenticação baseada em senha.
|
|
tenantId
|
string
|
Identificador do locatário do recurso delegado.
|
Enumeração
Camada de armazenamento de um servidor.
| Valor |
Description |
|
P1
|
SSD de nível básico para IOPS mínimo, ideal para cargas de trabalho leves de desenvolvimento ou teste.
|
|
P2
|
IOPS um pouco mais alto para aplicativos de pequena escala que precisam de baixa latência consistente.
|
|
P3
|
Desempenho equilibrado para cargas de trabalho de produção básicas com taxa de transferência moderada.
|
|
P4
|
IOPS aprimorado para aplicativos em crescimento com necessidades de desempenho previsíveis.
|
|
P6
|
SSD de nível intermediário para cargas de trabalho estáveis que exigem taxa de transferência e latência confiáveis.
|
|
P10
|
Escolha popular para cargas de trabalho de produção de uso geral com desempenho escalável.
|
|
P15
|
Camada de IOPS alta para aplicativos exigentes com operações frequentes de leitura/gravação.
|
|
P20
|
Ponto de entrada para discos de estado sólido (SSDs) de alto desempenho, adequado para cargas de trabalho intensivas de E/S de pequena escala.
|
|
P30
|
Camada balanceada para taxa de transferência moderada e aplicativos sensíveis à latência.
|
|
P40
|
Desempenho aprimorado para cargas de trabalho de produção crescentes com demandas consistentes de IOPS.
|
|
P50
|
Otimizado para aplicativos de nível empresarial que precisam de alta taxa de transferência sustentada.
|
|
P60
|
Camada de alta capacidade para grandes bancos de dados e cargas de trabalho de análise com IOPS elevada.
|
|
P70
|
Projetado para sistemas de missão crítica que exigem latência ultrabaixa e alta simultaneidade.
|
|
P80
|
SSD de primeira linha para IOPS e taxa de transferência máximas, ideal para as cargas de trabalho mais exigentes.
|
BackupForPatch
Objeto
Propriedades de backup de um servidor.
| Nome |
Tipo |
Description |
|
backupRetentionDays
|
integer
(int32)
|
Dias de retenção de backup para o servidor.
|
|
earliestRestoreDate
|
string
(date-time)
|
Hora do ponto de restauração mais antiga (formato ISO8601) para um servidor.
|
|
geoRedundantBackup
|
GeographicallyRedundantBackup
|
Indica se o servidor está configurado para criar backups com redundância geográfica.
|
Cluster
Objeto
Propriedades de cluster de um servidor.
| Nome |
Tipo |
Valor padrão |
Description |
|
clusterSize
|
integer
(int32)
|
0
|
Número de nós atribuídos ao cluster elástico.
|
|
defaultDatabaseName
|
string
|
|
Nome do banco de dados padrão para o cluster elástico.
|
CreateModeForPatch
Enumeração
Modo de atualização de um servidor existente.
| Valor |
Description |
|
Default
|
É equivalente a 'Atualizar'.
|
|
Update
|
A operação atualiza um servidor existente.
|
DataEncryption
Objeto
Propriedades de criptografia de dados de um servidor.
| Nome |
Tipo |
Description |
|
geoBackupEncryptionKeyStatus
|
EncryptionKeyStatus
|
Status da chave usada por um servidor configurado com criptografia de dados com base na chave gerenciada pelo cliente, para criptografar o armazenamento com redundância geográfica associado ao servidor quando ele é configurado para dar suporte a backups com redundância geográfica.
|
|
geoBackupKeyURI
|
string
|
Identificador da identidade gerenciada atribuída pelo usuário usada para acessar a chave no Azure Key Vault para criptografia de dados do armazenamento com redundância geográfica associado a um servidor configurado para dar suporte a backups com redundância geográfica.
|
|
geoBackupUserAssignedIdentityId
|
string
|
Identificador da identidade gerenciada atribuída pelo usuário usada para acessar a chave no Azure Key Vault para criptografia de dados do armazenamento com redundância geográfica associado a um servidor configurado para dar suporte a backups com redundância geográfica.
|
|
primaryEncryptionKeyStatus
|
EncryptionKeyStatus
|
Status da chave usada por um servidor configurado com criptografia de dados com base na chave gerenciada pelo cliente, para criptografar o armazenamento primário associado ao servidor.
|
|
primaryKeyURI
|
string
|
URI da chave no Azure Key Vault usada para criptografia de dados do armazenamento primário associado a um servidor.
|
|
primaryUserAssignedIdentityId
|
string
|
Identificador da identidade gerenciada atribuída pelo usuário usada para acessar a chave no Azure Key Vault para criptografia de dados do armazenamento primário associado a um servidor.
|
|
type
|
DataEncryptionType
|
Tipo de criptografia de dados usado por um servidor.
|
DataEncryptionType
Enumeração
Tipo de criptografia de dados usado por um servidor.
| Valor |
Description |
|
SystemManaged
|
Criptografia gerenciada pelo Azure usando chaves gerenciadas pela plataforma para simplicidade e conformidade.
|
|
AzureKeyVault
|
Criptografia usando chaves gerenciadas pelo cliente armazenadas no Azure Key Vault para controle e segurança aprimorados.
|
EncryptionKeyStatus
Enumeração
Status da chave usada por um servidor configurado com criptografia de dados com base na chave gerenciada pelo cliente, para criptografar o armazenamento primário associado ao servidor.
| Valor |
Description |
|
Valid
|
A chave é válida e pode ser usada para criptografia.
|
|
Invalid
|
A chave é inválida e não pode ser usada para criptografia. As possíveis causas incluem exclusão de chave, alterações de permissão, chave desabilitada, tipo de chave não suportado ou data atual fora do período de validade associado à chave.
|
ErrorAdditionalInfo
Objeto
As informações adicionais do erro de gerenciamento de recursos.
| Nome |
Tipo |
Description |
|
info
|
object
|
As informações adicionais.
|
|
type
|
string
|
O tipo de informação adicional.
|
ErrorDetail
Objeto
O detalhe do erro.
| Nome |
Tipo |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
As informações adicionais do erro.
|
|
code
|
string
|
O código do erro.
|
|
details
|
ErrorDetail[]
|
Os detalhes do erro.
|
|
message
|
string
|
A mensagem de erro.
|
|
target
|
string
|
O destino do erro.
|
ErrorResponse
Objeto
Resposta de erro
| Nome |
Tipo |
Description |
|
error
|
ErrorDetail
|
O objeto de erro.
|
GeographicallyRedundantBackup
Enumeração
Indica se o servidor está configurado para criar backups com redundância geográfica.
| Valor |
Description |
|
Enabled
|
O servidor está configurado para criar backups com redundância geográfica.
|
|
Disabled
|
O servidor não está configurado para criar backups com redundância geográfica.
|
HighAvailabilityForPatch
Objeto
Propriedades de alta disponibilidade de um servidor.
| Nome |
Tipo |
Description |
|
mode
|
HighAvailabilityMode
|
Modo de alta disponibilidade para um servidor.
|
|
standbyAvailabilityZone
|
string
|
Zona de disponibilidade associada ao servidor em espera criado quando a alta disponibilidade é definida como SameZone ou ZoneRedundant.
|
|
state
|
HighAvailabilityState
|
Possíveis estados do servidor em espera criados quando a alta disponibilidade é definida como SameZone ou ZoneRedundant.
|
HighAvailabilityMode
Enumeração
Modo de alta disponibilidade para um servidor.
| Valor |
Description |
|
Disabled
|
A alta disponibilidade está desabilitada para o servidor.
|
|
ZoneRedundant
|
A alta disponibilidade é habilitada para o servidor, com o servidor em espera em uma zona de disponibilidade diferente da principal.
|
|
SameZone
|
A alta disponibilidade é habilitada para o servidor, com o servidor em espera na mesma zona de disponibilidade que o primário.
|
HighAvailabilityState
Enumeração
Possíveis estados do servidor em espera criados quando a alta disponibilidade é definida como SameZone ou ZoneRedundant.
| Valor |
Description |
|
NotEnabled
|
A alta disponibilidade não está habilitada para o servidor.
|
|
CreatingStandby
|
O servidor em espera está sendo criado.
|
|
ReplicatingData
|
Os dados estão sendo replicados para o servidor em espera.
|
|
FailingOver
|
A operação de failover para o servidor em espera está em andamento.
|
|
Healthy
|
O servidor em espera está íntegro e pronto para assumir o controle em caso de failover.
|
|
RemovingStandby
|
O servidor em espera está sendo removido.
|
IdentityType
Enumeração
Tipos de identidades associadas a um servidor.
| Valor |
Description |
|
None
|
Nenhuma identidade gerenciada é atribuída ao servidor.
|
|
UserAssigned
|
Uma ou mais identidades gerenciadas fornecidas pelo usuário são atribuídas ao servidor.
|
|
SystemAssigned
|
O Azure cria e gerencia automaticamente a identidade associada ao ciclo de vida do servidor.
|
|
SystemAssigned,UserAssigned
|
As identidades atribuídas pelo sistema e pelo usuário são atribuídas ao servidor.
|
MaintenanceWindowForPatch
Objeto
Propriedades da janela de manutenção de um servidor.
| Nome |
Tipo |
Description |
|
customWindow
|
string
|
Indica se a janela personalizada está habilitada ou desabilitada.
|
|
dayOfWeek
|
integer
(int32)
|
Dia da semana a ser usado para janela de manutenção.
|
|
startHour
|
integer
(int32)
|
Hora de início a ser usada para janela de manutenção.
|
|
startMinute
|
integer
(int32)
|
Minuto de início a ser usado para janela de manutenção.
|
MicrosoftEntraAuth
Enumeração
Indica se o servidor dá suporte à autenticação do Microsoft Entra.
| Valor |
Description |
|
Enabled
|
O servidor oferece suporte à autenticação do Microsoft Entra.
|
|
Disabled
|
O servidor não dá suporte à autenticação do Microsoft Entra.
|
Network
Objeto
Propriedades de rede de um servidor.
| Nome |
Tipo |
Description |
|
delegatedSubnetResourceId
|
string
|
Identificador de recurso da sub-rede delegada. Necessário durante a criação de um novo servidor, caso você queira que o servidor seja integrado à sua própria rede virtual. Para uma operação de atualização, você só precisa fornecer essa propriedade se quiser alterar o valor atribuído para a zona DNS privada.
|
|
privateDnsZoneArmResourceId
|
string
|
Identificador da zona DNS privada. Necessário durante a criação de um novo servidor, caso você queira que o servidor seja integrado à sua própria rede virtual. Para uma operação de atualização, você só precisa fornecer essa propriedade se quiser alterar o valor atribuído para a zona DNS privada.
|
|
publicNetworkAccess
|
ServerPublicNetworkAccessState
|
Indica se o acesso à rede pública está habilitado ou não. Isso só tem suporte para servidores que não estão integrados a uma rede virtual que pertence e é fornecida pelo cliente quando o servidor é implantado.
|
PasswordBasedAuth
Enumeração
Indica se o servidor oferece suporte à autenticação baseada em senha.
| Valor |
Description |
|
Enabled
|
O servidor suporta autenticação baseada em senha.
|
|
Disabled
|
O servidor não dá suporte à autenticação baseada em senha.
|
PostgresMajorVersion
Enumeração
Versão principal do mecanismo de banco de dados PostgreSQL.
| Valor |
Description |
|
18
|
PostgreSQL 18.
|
|
17
|
PostgreSQL 17.
|
|
16
|
PostgreSQL 16.
|
|
15
|
PostgreSQL 15.
|
|
14
|
PostgreSQL 14.
|
|
13
|
PostgreSQL 13.
|
|
12
|
PostgreSQL 12.
|
|
11
|
PostgreSQL 11.
|
Enumeração
Tipo de operação a ser aplicada na réplica de leitura. Essa propriedade é somente gravação. Autônomo significa que a réplica de leitura será promovida a um servidor autônomo e se tornará uma entidade completamente independente do conjunto de replicação. Alternância significa que a réplica de leitura terá funções com o servidor primário.
| Valor |
Description |
|
Standalone
|
A réplica de leitura se tornará um servidor independente.
|
|
Switchover
|
A réplica de leitura trocará funções com o servidor primário.
|
Enumeração
Opção de sincronização de dados a ser usada ao processar a operação especificada na propriedade promoteMode. Essa propriedade é somente gravação.
| Valor |
Description |
|
Planned
|
A operação aguardará que os dados na réplica de leitura sejam totalmente sincronizados com seu servidor de origem, antes de iniciar a operação.
|
|
Forced
|
A operação não aguardará que os dados na réplica de leitura sejam sincronizados com seu servidor de origem antes de iniciar a operação.
|
Replica
Objeto
Propriedades de réplica de um servidor.
| Nome |
Tipo |
Description |
|
capacity
|
integer
(int32)
|
Número máximo de réplicas de leitura permitidas para um servidor.
|
|
promoteMode
|
ReadReplicaPromoteMode
|
Tipo de operação a ser aplicada na réplica de leitura. Essa propriedade é somente gravação. Autônomo significa que a réplica de leitura será promovida a um servidor autônomo e se tornará uma entidade completamente independente do conjunto de replicação. Alternância significa que a réplica de leitura terá funções com o servidor primário.
|
|
promoteOption
|
ReadReplicaPromoteOption
|
Opção de sincronização de dados a ser usada ao processar a operação especificada na propriedade promoteMode. Essa propriedade é somente gravação.
|
|
replicationState
|
ReplicationState
|
Indica o estado de replicação de uma réplica de leitura. Essa propriedade é retornada somente quando o servidor de destino é uma réplica de leitura. Os valores possíveis são Ativo, Quebrado, Catchup, Provisionamento, Reconfiguração e Atualização
|
|
role
|
ReplicationRole
|
Função do servidor em um conjunto de replicação.
|
ReplicationRole
Enumeração
Função do servidor em um conjunto de replicação.
| Valor |
Description |
|
None
|
Nenhuma função de replicação atribuída; O servidor opera de forma independente.
|
|
Primary
|
Atua como o servidor de origem para replicação para uma ou mais réplicas.
|
|
AsyncReplica
|
Recebe dados de forma assíncrona de um servidor primário na mesma região.
|
|
GeoAsyncReplica
|
Recebe dados de forma assíncrona de um servidor primário em uma região diferente para redundância geográfica.
|
ReplicationState
Enumeração
Indica o estado de replicação de uma réplica de leitura. Essa propriedade é retornada somente quando o servidor de destino é uma réplica de leitura. Os valores possíveis são Ativo, Quebrado, Catchup, Provisionamento, Reconfiguração e Atualização
| Valor |
Description |
|
Active
|
A réplica de leitura é totalmente sincronizada e replica ativamente os dados do servidor primário.
|
|
Catchup
|
A réplica de leitura está atrás do servidor primário e está atualmente acompanhando as alterações pendentes.
|
|
Provisioning
|
A réplica de leitura está sendo criada e está em processo de inicialização.
|
|
Updating
|
A réplica de leitura está passando por algumas alterações, pode estar alterando o tamanho da computação ou promovendo-a para o servidor primário.
|
|
Broken
|
A replicação falhou ou foi interrompida.
|
|
Reconfiguring
|
A réplica de leitura está sendo reconfigurada, possivelmente devido a alterações na origem ou nas configurações.
|
ServerForPatch
Objeto
Representa um servidor a ser atualizado.
| Nome |
Tipo |
Description |
|
identity
|
UserAssignedIdentity
|
Descreve a identidade do aplicativo.
|
|
properties.administratorLogin
|
string
|
Nome do logon designado como o primeiro administrador baseado em senha atribuído à sua instância do PostgreSQL. Deve ser especificado na primeira vez que você habilitar a autenticação baseada em senha em um servidor. Uma vez definido para um determinado valor, ele não pode ser alterado pelo resto da vida útil de um servidor. Se você desabilitar a autenticação baseada em senha em um servidor que a habilitou, essa função baseada em senha não será excluída.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Senha atribuída ao login do administrador. Desde que a autenticação de senha esteja habilitada, essa senha pode ser alterada a qualquer momento.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Propriedades de configuração de autenticação de um servidor.
|
|
properties.availabilityZone
|
string
|
Zona de disponibilidade de um servidor.
|
|
properties.backup
|
BackupForPatch
|
Propriedades de backup de um servidor.
|
|
properties.cluster
|
Cluster
|
Propriedades de cluster de um servidor.
|
|
properties.createMode
|
CreateModeForPatch
|
Modo de atualização de um servidor existente.
|
|
properties.dataEncryption
|
DataEncryption
|
Propriedades de criptografia de dados de um servidor.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Propriedades de alta disponibilidade de um servidor.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Propriedades da janela de manutenção de um servidor.
|
|
properties.network
|
Network
|
Propriedades de rede de um servidor. Necessário apenas se você quiser que seu servidor seja integrado a uma rede virtual fornecida pelo cliente.
|
|
properties.replica
|
Replica
|
Propriedades de réplica de leitura de um servidor. Obrigatório apenas no caso de você querer promover um servidor.
|
|
properties.replicationRole
|
ReplicationRole
|
Função do servidor em um conjunto de replicação.
|
|
properties.storage
|
Storage
|
Propriedades de armazenamento de um servidor.
|
|
properties.version
|
PostgresMajorVersion
|
Versão principal do mecanismo de banco de dados PostgreSQL.
|
|
sku
|
SkuForPatch
|
Camada de computação e tamanho de um servidor.
|
|
tags
|
object
|
Os metadados específicos a um aplicativo na forma de pares chave-valor.
|
ServerPublicNetworkAccessState
Enumeração
Indica se o acesso à rede pública está habilitado ou não. Isso só tem suporte para servidores que não estão integrados a uma rede virtual que pertence e é fornecida pelo cliente quando o servidor é implantado.
| Valor |
Description |
|
Enabled
|
O acesso à rede pública está habilitado. Isso permite que o servidor seja acessado da Internet pública, desde que a regra de firewall necessária que permita o tráfego de entrada originado do cliente de conexão esteja em vigor. Isso é compatível com o uso de pontos de extremidade privados para se conectar a esse servidor.
|
|
Disabled
|
O acesso à rede pública está desabilitado. Isso significa que o servidor não pode ser acessado pela Internet pública, mas apenas por meio de pontos de extremidade privados.
|
SkuForPatch
Objeto
Compute as informações de um servidor.
| Nome |
Tipo |
Description |
|
name
|
string
|
Nome pelo qual é conhecido um determinado tamanho de computação atribuído a um servidor.
|
|
tier
|
SkuTier
|
Camada da computação atribuída a um servidor.
|
SkuTier
Enumeração
Camada da computação atribuída a um servidor.
| Valor |
Description |
|
Burstable
|
Camada econômica para uso pouco frequente da CPU, ideal para cargas de trabalho de desenvolvimento e teste com requisitos de baixo desempenho.
|
|
GeneralPurpose
|
Computação e memória balanceadas para a maioria das cargas de trabalho, oferecendo desempenho escalável e taxa de transferência de E/S.
|
|
MemoryOptimized
|
Alta taxa de memória para núcleo para cargas de trabalho exigentes que precisam de processamento rápido na memória e alta simultaneidade.
|
Storage
Objeto
Propriedades de armazenamento de um servidor.
| Nome |
Tipo |
Description |
|
autoGrow
|
StorageAutoGrow
|
Sinalizador para habilitar ou desabilitar o crescimento automático do tamanho do armazenamento de um servidor quando o espaço disponível estiver próximo de zero e as condições permitirem o aumento automático do tamanho do armazenamento.
|
|
iops
|
integer
(int32)
|
Máximo de IOPS com suporte para armazenamento. Obrigatório quando o tipo de armazenamento é PremiumV2_LRS ou UltraSSD_LRS.
|
|
storageSizeGB
|
integer
(int32)
|
Tamanho do armazenamento atribuído a um servidor.
|
|
throughput
|
integer
(int32)
|
Taxa de transferência máxima com suporte para armazenamento. Obrigatório quando o tipo de armazenamento é PremiumV2_LRS ou UltraSSD_LRS.
|
|
tier
|
AzureManagedDiskPerformanceTier
|
Camada de armazenamento de um servidor.
|
|
type
|
StorageType
|
Tipo de armazenamento atribuído a um servidor. Os valores permitidos são Premium_LRS, PremiumV2_LRS ou UltraSSD_LRS. Se não for especificado, o padrão será Premium_LRS.
|
StorageAutoGrow
Enumeração
Sinalizador para habilitar ou desabilitar o crescimento automático do tamanho do armazenamento de um servidor quando o espaço disponível estiver próximo de zero e as condições permitirem o aumento automático do tamanho do armazenamento.
| Valor |
Description |
|
Enabled
|
O servidor deve aumentar automaticamente o tamanho do armazenamento quando o espaço disponível estiver próximo de zero e as condições permitirem o aumento automático do tamanho do armazenamento.
|
|
Disabled
|
O servidor não deve aumentar automaticamente o tamanho do armazenamento quando o espaço disponível estiver próximo de zero.
|
StorageType
Enumeração
Tipo de armazenamento atribuído a um servidor. Os valores permitidos são Premium_LRS, PremiumV2_LRS ou UltraSSD_LRS. Se não for especificado, o padrão será Premium_LRS.
| Valor |
Description |
|
Premium_LRS
|
Armazenamento baseado em SSD (Solid State Disk) padrão que oferece desempenho consistente para cargas de trabalho de uso geral.
|
|
PremiumV2_LRS
|
Armazenamento em disco de estado sólido (SSD) de última geração com escalabilidade e desempenho aprimorados para cargas de trabalho corporativas exigentes.
|
|
UltraSSD_LRS
|
Armazenamento de disco de estado sólido (SSD) de última geração projetado para IOPS extremo e aplicativos sensíveis à latência.
|
UserAssignedIdentity
Objeto
Identidades associadas a um servidor.
| Nome |
Tipo |
Description |
|
principalId
|
string
|
Identificador do objeto da entidade de serviço associada à identidade gerenciada atribuída pelo usuário.
|
|
tenantId
|
string
|
Identificador do locatário de um servidor.
|
|
type
|
IdentityType
|
Tipos de identidades associadas a um servidor.
|
|
userAssignedIdentities
|
<string,
UserIdentity>
|
Mapa de identidades gerenciadas atribuídas pelo usuário.
|
UserIdentity
Objeto
Identidade gerenciada atribuída pelo usuário associada a um servidor.
| Nome |
Tipo |
Description |
|
clientId
|
string
|
Identificador do cliente da entidade de serviço associada à identidade gerenciada atribuída pelo usuário.
|
|
principalId
|
string
|
Identificador do objeto da entidade de serviço associada à identidade gerenciada atribuída pelo usuário.
|