Обновляет существующий сервер. Тело запроса может содержать одно или несколько свойств, присутствующих в обычном определении сервера.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}?api-version=2025-08-01
Параметры URI
| Имя |
В |
Обязательно |
Тип |
Описание |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Имя группы ресурсов. Имя не зависит от регистра.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
Имени сервера.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
Идентификатор целевой подписки. Значение должно быть Универсальным Уникальным Идентификатором (UUID).
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Версия API, используемая для данной операции.
|
Текст запроса
| Имя |
Тип |
Описание |
|
identity
|
UserAssignedIdentity
|
Описывает удостоверение приложения.
|
|
properties.administratorLogin
|
string
|
Имя пользователя, назначенного в качестве первого администратора на основе пароля, назначенного вашему экземпляру PostgreSQL. Необходимо указать при первом включении аутентификации на основе пароля на сервере. После установки заданного значения оно не может быть изменено до конца срока службы сервера. Если вы отключите аутентификацию на основе пароля на сервере, на котором она включена, эта роль на основе пароля не будет удалена.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Пароль присваивается логину администратора. Если аутентификация по паролю включена, этот пароль можно изменить в любое время.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Свойства конфигурации аутентификации сервера.
|
|
properties.availabilityZone
|
string
|
Зона доступности сервера.
|
|
properties.backup
|
BackupForPatch
|
Свойства резервного копирования сервера.
|
|
properties.cluster
|
Cluster
|
Свойства кластера сервера.
|
|
properties.createMode
|
CreateModeForPatch
|
Режим обновления существующего сервера.
|
|
properties.dataEncryption
|
DataEncryption
|
Свойства шифрования данных сервера.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Свойства высокого уровня доступности сервера.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Свойства периода обслуживания сервера.
|
|
properties.network
|
Network
|
Сетевые свойства сервера. Требуется только в том случае, если вы хотите, чтобы ваш сервер был интегрирован в виртуальную сеть, предоставленную клиентом.
|
|
properties.replica
|
Replica
|
Чтение свойств реплики сервера. Требуется только в том случае, если вы хотите раскрутить сервер.
|
|
properties.replicationRole
|
ReplicationRole
|
Роль сервера в наборе репликации.
|
|
properties.storage
|
Storage
|
Свойства хранилища сервера.
|
|
properties.version
|
PostgresMajorVersion
|
Основная версия ядра СУБД PostgreSQL.
|
|
sku
|
SkuForPatch
|
Уровень вычислений и размер сервера.
|
|
tags
|
object
|
Метаданные, относящиеся к приложению, в виде пар "ключ-значение".
|
Ответы
| Имя |
Тип |
Описание |
|
202 Accepted
|
|
Accepted.
Заголовки
- Location: string
- Azure-AsyncOperation: string
|
|
Other Status Codes
|
ErrorResponse
|
Ответ на ошибку, описывающий причину сбоя операции.
|
Безопасность
azure_auth
Microsoft Entra OAuth2 Flow
Тип:
oauth2
Flow:
implicit
URL-адрес авторизации:
https://login.microsoftonline.com/common/oauth2/authorize
Области
| Имя |
Описание |
|
user_impersonation
|
Выдача себя за свою учетную запись пользователя
|
Примеры
Образец запроса
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
Пример ответа
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
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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
Определения
| Имя |
Описание |
|
AuthConfigForPatch
|
Свойства конфигурации аутентификации сервера.
|
|
AzureManagedDiskPerformanceTier
|
Уровень хранения сервера.
|
|
BackupForPatch
|
Свойства резервного копирования сервера.
|
|
Cluster
|
Свойства кластера сервера.
|
|
CreateModeForPatch
|
Режим обновления существующего сервера.
|
|
DataEncryption
|
Свойства шифрования данных сервера.
|
|
DataEncryptionType
|
Тип шифрования данных, используемый сервером.
|
|
EncryptionKeyStatus
|
Состояние ключа, используемого сервером, настроенным с шифрованием данных на основе ключа, управляемого клиентом, для шифрования основного хранилища, связанного с сервером.
|
|
ErrorAdditionalInfo
|
Ошибка управления ресурсами дополнительная информация.
|
|
ErrorDetail
|
Детали ошибки.
|
|
ErrorResponse
|
Ответ на ошибку
|
|
GeographicallyRedundantBackup
|
Указывает, настроен ли сервер для создания географически избыточных резервных копий.
|
|
HighAvailabilityForPatch
|
Свойства высокого уровня доступности сервера.
|
|
HighAvailabilityMode
|
Режим высокой доступности для сервера.
|
|
HighAvailabilityState
|
Возможные состояния резервного сервера, созданного, когда для высокого уровня доступности задано значение SameZone или ZoneRedundant.
|
|
IdentityType
|
Типы удостоверений, связанных с сервером.
|
|
MaintenanceWindowForPatch
|
Свойства периода обслуживания сервера.
|
|
MicrosoftEntraAuth
|
Указывает, поддерживает ли сервер проверку подлинности Microsoft Entra.
|
|
Network
|
Сетевые свойства сервера.
|
|
PasswordBasedAuth
|
Указывает, поддерживает ли сервер аутентификацию на основе пароля.
|
|
PostgresMajorVersion
|
Основная версия ядра СУБД PostgreSQL.
|
|
ReadReplicaPromoteMode
|
Тип операции, применяемой к реплике чтения. Это свойство доступно только для записи. Автономность означает, что реплика чтения будет преобразована в автономный сервер и станет полностью независимой сущностью от набора репликации. Переключение означает, что реплика чтения будет выполнять роли с основным сервером.
|
|
ReadReplicaPromoteOption
|
Опция синхронизации данных для использования при обработке операции, указанной в свойстве promoteMode. Это свойство доступно только для записи.
|
|
Replica
|
Свойства реплики сервера.
|
|
ReplicationRole
|
Роль сервера в наборе репликации.
|
|
ReplicationState
|
Указывает состояние репликации реплики чтения. Это свойство возвращается только в том случае, если целевой сервер является репликой для чтения. Возможные значения: Активно, Сломано, Догоняющее, Инициализировано, Реконфигурация и Обновление
|
|
ServerForPatch
|
Представляет сервер для обновления.
|
|
ServerPublicNetworkAccessState
|
Указывает, включен ли доступ к общедоступной сети. Это поддерживается только для серверов, которые не интегрированы в виртуальную сеть, принадлежащую клиенту и предоставленную им на момент развертывания сервера.
|
|
SkuForPatch
|
Вычислительная информация сервера.
|
|
SkuTier
|
Уровень вычислительных ресурсов, назначенный серверу.
|
|
Storage
|
Свойства хранилища сервера.
|
|
StorageAutoGrow
|
Флаг для включения или отключения автоматического увеличения размера хранилища сервера, когда доступное пространство приближается к нулю и условия позволяют автоматически увеличивать размер хранилища.
|
|
StorageType
|
Тип хранилища, назначенного серверу. Допустимые значения: Premium_LRS, PremiumV2_LRS или UltraSSD_LRS. Если не указано, по умолчанию используется значение Premium_LRS.
|
|
UserAssignedIdentity
|
Удостоверения, связанные с сервером.
|
|
UserIdentity
|
Назначаемое пользователем управляемое удостоверение, связанное с сервером.
|
AuthConfigForPatch
Объект
Свойства конфигурации аутентификации сервера.
| Имя |
Тип |
Описание |
|
activeDirectoryAuth
|
MicrosoftEntraAuth
|
Указывает, поддерживает ли сервер проверку подлинности Microsoft Entra.
|
|
passwordAuth
|
PasswordBasedAuth
|
Указывает, поддерживает ли сервер аутентификацию на основе пароля.
|
|
tenantId
|
string
|
Идентификатор владельца делегированного ресурса.
|
Перечисление
Уровень хранения сервера.
| Значение |
Описание |
|
P1
|
Твердотельный накопитель начального уровня для минимального количества операций ввода-вывода в секунду, идеально подходит для небольших рабочих нагрузок разработки или тестирования.
|
|
P2
|
Немного более высокое количество операций ввода-вывода в секунду для небольших приложений, требующих стабильно низкой задержки.
|
|
P3
|
Сбалансированная производительность для основных производственных рабочих нагрузок с умеренной пропускной способностью.
|
|
P4
|
Улучшенные операции ввода-вывода в секунду для растущих приложений с предсказуемыми потребностями в производительности.
|
|
P6
|
Твердотельный накопитель среднего уровня для стабильных рабочих нагрузок, требующих надежной пропускной способности и задержки.
|
|
P10
|
Популярный выбор для производственных рабочих нагрузок общего назначения с масштабируемой производительностью.
|
|
P15
|
Высокий уровень операций ввода-вывода в секунду для ресурсоемких приложений с частыми операциями чтения и записи.
|
|
P20
|
Точка входа для высокопроизводительных твердотельных накопителей (SSD), подходящих для небольших рабочих нагрузок с интенсивным вводом-выводом.
|
|
P30
|
Сбалансированный уровень для приложений с умеренной пропускной способностью и задержкой.
|
|
P40
|
Повышенная производительность для растущих производственных рабочих нагрузок с постоянными требованиями к операциям ввода-вывода в секунду.
|
|
P50
|
Оптимизировано для приложений корпоративного уровня, требующих стабильно высокой пропускной способности.
|
|
P60
|
Уровень высокой емкости для больших баз данных и аналитических рабочих нагрузок с повышенным количеством операций ввода-вывода в секунду.
|
|
P70
|
Предназначен для критически важных систем, требующих сверхнизкой задержки и высокого параллелизма.
|
|
P80
|
Высокопроизводительный твердотельный накопитель для максимального количества операций ввода-вывода в секунду и пропускной способности, идеально подходящий для самых требовательных рабочих нагрузок.
|
BackupForPatch
Объект
Свойства резервного копирования сервера.
| Имя |
Тип |
Описание |
|
backupRetentionDays
|
integer
(int32)
|
Дни хранения резервных копий для сервера.
|
|
earliestRestoreDate
|
string
(date-time)
|
Самое раннее время точки восстановления (формат ISO8601) для сервера.
|
|
geoRedundantBackup
|
GeographicallyRedundantBackup
|
Указывает, настроен ли сервер для создания географически избыточных резервных копий.
|
Cluster
Объект
Свойства кластера сервера.
| Имя |
Тип |
Default value |
Описание |
|
clusterSize
|
integer
(int32)
|
0
|
Количество узлов, назначенных эластичному кластеру.
|
|
defaultDatabaseName
|
string
|
|
Имя базы данных по умолчанию для эластичного кластера.
|
CreateModeForPatch
Перечисление
Режим обновления существующего сервера.
| Значение |
Описание |
|
Default
|
Это эквивалентно «Обновлению».
|
|
Update
|
Операция обновляет существующий сервер.
|
DataEncryption
Объект
Свойства шифрования данных сервера.
| Имя |
Тип |
Описание |
|
geoBackupEncryptionKeyStatus
|
EncryptionKeyStatus
|
Состояние ключа, используемого сервером, настроенным с шифрованием данных на основе ключа, управляемого клиентом, для шифрования географически избыточного хранилища, связанного с сервером, когда он настроен на поддержку географически избыточных резервных копий.
|
|
geoBackupKeyURI
|
string
|
Идентификатор назначенного пользователем управляемого удостоверения, используемого для доступа к ключу в Azure Key Vault для шифрования данных географически избыточного хранилища, связанного с сервером, настроенным на поддержку географически избыточных резервных копий.
|
|
geoBackupUserAssignedIdentityId
|
string
|
Идентификатор назначенного пользователем управляемого удостоверения, используемого для доступа к ключу в Azure Key Vault для шифрования данных географически избыточного хранилища, связанного с сервером, настроенным на поддержку географически избыточных резервных копий.
|
|
primaryEncryptionKeyStatus
|
EncryptionKeyStatus
|
Состояние ключа, используемого сервером, настроенным с шифрованием данных на основе ключа, управляемого клиентом, для шифрования основного хранилища, связанного с сервером.
|
|
primaryKeyURI
|
string
|
URI ключа в Azure Key Vault, используемого для шифрования данных основного хранилища, связанного с сервером.
|
|
primaryUserAssignedIdentityId
|
string
|
Идентификатор назначенного пользователю управляемого удостоверения, используемого для доступа к ключу в Azure Key Vault для шифрования данных основного хранилища, связанного с сервером.
|
|
type
|
DataEncryptionType
|
Тип шифрования данных, используемый сервером.
|
DataEncryptionType
Перечисление
Тип шифрования данных, используемый сервером.
| Значение |
Описание |
|
SystemManaged
|
Шифрование управляется Azure с использованием ключей, управляемых платформой, для простоты и соответствия требованиям.
|
|
AzureKeyVault
|
Шифрование с помощью управляемых клиентом ключей, хранящихся в Azure Key Vault, для улучшенного контроля и безопасности.
|
EncryptionKeyStatus
Перечисление
Состояние ключа, используемого сервером, настроенным с шифрованием данных на основе ключа, управляемого клиентом, для шифрования основного хранилища, связанного с сервером.
| Значение |
Описание |
|
Valid
|
Ключ действителен и может быть использован для шифрования.
|
|
Invalid
|
Ключ недействителен и не может быть использован для шифрования. Возможные причины включают удаление ключа, изменение разрешений, отключение ключа, неподдержку типа ключа или выход текущей даты за пределы срока действия, связанного с ключом.
|
ErrorAdditionalInfo
Объект
Ошибка управления ресурсами дополнительная информация.
| Имя |
Тип |
Описание |
|
info
|
object
|
Дополнительная информация.
|
|
type
|
string
|
Тип дополнительной информации.
|
ErrorDetail
Объект
Детали ошибки.
| Имя |
Тип |
Описание |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Ошибка дополнительная информация.
|
|
code
|
string
|
Код ошибки.
|
|
details
|
ErrorDetail[]
|
Сведения об ошибке.
|
|
message
|
string
|
Сообщение об ошибке.
|
|
target
|
string
|
Цель ошибки.
|
ErrorResponse
Объект
Ответ на ошибку
GeographicallyRedundantBackup
Перечисление
Указывает, настроен ли сервер для создания географически избыточных резервных копий.
| Значение |
Описание |
|
Enabled
|
Сервер настроен на создание географически избыточных резервных копий.
|
|
Disabled
|
Сервер не настроен на создание географически избыточных резервных копий.
|
HighAvailabilityForPatch
Объект
Свойства высокого уровня доступности сервера.
| Имя |
Тип |
Описание |
|
mode
|
HighAvailabilityMode
|
Режим высокой доступности для сервера.
|
|
standbyAvailabilityZone
|
string
|
Зона доступности, связанная с резервным сервером, созданная, когда для высокого уровня доступности задано значение SameZone или ZoneRedundant.
|
|
state
|
HighAvailabilityState
|
Возможные состояния резервного сервера, созданного, когда для высокого уровня доступности задано значение SameZone или ZoneRedundant.
|
HighAvailabilityMode
Перечисление
Режим высокой доступности для сервера.
| Значение |
Описание |
|
Disabled
|
Высокий уровень доступности для сервера отключен.
|
|
ZoneRedundant
|
Высокий уровень доступности включен для сервера, при этом резервный сервер находится в зоне, отличной от зоны доступности основного.
|
|
SameZone
|
Для сервера включен высокий уровень доступности, при этом резервный сервер находится в той же зоне доступности, что и основной.
|
HighAvailabilityState
Перечисление
Возможные состояния резервного сервера, созданного, когда для высокого уровня доступности задано значение SameZone или ZoneRedundant.
| Значение |
Описание |
|
NotEnabled
|
Высокий уровень доступности для сервера не включен.
|
|
CreatingStandby
|
Создается резервный сервер.
|
|
ReplicatingData
|
Данные реплицируются на резервный сервер.
|
|
FailingOver
|
Выполняется операция аварийного переключения на резервный сервер.
|
|
Healthy
|
Резервный сервер работоспособен и готов взять на себя управление в случае отработки отказа.
|
|
RemovingStandby
|
Резервный сервер удаляется.
|
IdentityType
Перечисление
Типы удостоверений, связанных с сервером.
| Значение |
Описание |
|
None
|
Управляемое удостоверение серверу не назначается.
|
|
UserAssigned
|
Серверу назначается одно или несколько управляемых удостоверений, предоставленных пользователем.
|
|
SystemAssigned
|
Azure автоматически создает удостоверение, связанное с жизненным циклом сервера, и управляет им.
|
|
SystemAssigned,UserAssigned
|
Серверу назначаются как системные, так и пользовательские удостоверения.
|
MaintenanceWindowForPatch
Объект
Свойства периода обслуживания сервера.
| Имя |
Тип |
Описание |
|
customWindow
|
string
|
Указывает, включено или отключено пользовательское окно.
|
|
dayOfWeek
|
integer
(int32)
|
День недели, используемый для технического окна.
|
|
startHour
|
integer
(int32)
|
Стартовый час будет использоваться для окна технического обслуживания.
|
|
startMinute
|
integer
(int32)
|
Начальная минута должна быть использована для технического окна.
|
MicrosoftEntraAuth
Перечисление
Указывает, поддерживает ли сервер проверку подлинности Microsoft Entra.
| Значение |
Описание |
|
Enabled
|
Сервер поддерживает проверку подлинности Microsoft Entra.
|
|
Disabled
|
Сервер не поддерживает проверку подлинности Microsoft Entra.
|
Network
Объект
Сетевые свойства сервера.
| Имя |
Тип |
Описание |
|
delegatedSubnetResourceId
|
string
|
Идентификатор ресурса делегированной подсети. Требуется при создании нового сервера, в случае, если вы хотите, чтобы сервер был интегрирован в вашу собственную виртуальную сеть. Для операции обновления необходимо указать это свойство только в том случае, если вы хотите изменить значение, назначенное для частной зоны DNS.
|
|
privateDnsZoneArmResourceId
|
string
|
Идентификатор частной зоны DNS. Требуется при создании нового сервера, в случае, если вы хотите, чтобы сервер был интегрирован в вашу собственную виртуальную сеть. Для операции обновления необходимо указать это свойство только в том случае, если вы хотите изменить значение, назначенное для частной зоны DNS.
|
|
publicNetworkAccess
|
ServerPublicNetworkAccessState
|
Указывает, включен ли доступ к общедоступной сети. Это поддерживается только для серверов, которые не интегрированы в виртуальную сеть, принадлежащую клиенту и предоставленную им на момент развертывания сервера.
|
PasswordBasedAuth
Перечисление
Указывает, поддерживает ли сервер аутентификацию на основе пароля.
| Значение |
Описание |
|
Enabled
|
Сервер поддерживает аутентификацию на основе пароля.
|
|
Disabled
|
Сервер не поддерживает аутентификацию на основе пароля.
|
PostgresMajorVersion
Перечисление
Основная версия ядра СУБД PostgreSQL.
| Значение |
Описание |
|
18
|
PostgreSQL 18.
|
|
17
|
PostgreSQL 17.
|
|
16
|
PostgreSQL 16.
|
|
15
|
PostgreSQL 15.
|
|
14
|
PostgreSQL 14.
|
|
13
|
PostgreSQL 13.
|
|
12
|
PostgreSQL 12.
|
|
11
|
PostgreSQL 11.
|
Перечисление
Тип операции, применяемой к реплике чтения. Это свойство доступно только для записи. Автономность означает, что реплика чтения будет преобразована в автономный сервер и станет полностью независимой сущностью от набора репликации. Переключение означает, что реплика чтения будет выполнять роли с основным сервером.
| Значение |
Описание |
|
Standalone
|
Реплика чтения станет независимым сервером.
|
|
Switchover
|
Реплика чтения поменяется ролями с основным сервером.
|
Перечисление
Опция синхронизации данных для использования при обработке операции, указанной в свойстве promoteMode. Это свойство доступно только для записи.
| Значение |
Описание |
|
Planned
|
Операция будет ожидать, пока данные в реплике чтения будут полностью синхронизированы с исходным сервером, прежде чем она начнет операцию.
|
|
Forced
|
Операция не будет ждать, пока данные в реплике чтения будут синхронизированы с исходным сервером, прежде чем она инициирует операцию.
|
Replica
Объект
Свойства реплики сервера.
| Имя |
Тип |
Описание |
|
capacity
|
integer
(int32)
|
Максимальное количество реплик чтения, разрешенное для сервера.
|
|
promoteMode
|
ReadReplicaPromoteMode
|
Тип операции, применяемой к реплике чтения. Это свойство доступно только для записи. Автономность означает, что реплика чтения будет преобразована в автономный сервер и станет полностью независимой сущностью от набора репликации. Переключение означает, что реплика чтения будет выполнять роли с основным сервером.
|
|
promoteOption
|
ReadReplicaPromoteOption
|
Опция синхронизации данных для использования при обработке операции, указанной в свойстве promoteMode. Это свойство доступно только для записи.
|
|
replicationState
|
ReplicationState
|
Указывает состояние репликации реплики чтения. Это свойство возвращается только в том случае, если целевой сервер является репликой для чтения. Возможные значения: Активно, Сломано, Догоняющее, Инициализировано, Реконфигурация и Обновление
|
|
role
|
ReplicationRole
|
Роль сервера в наборе репликации.
|
ReplicationRole
Перечисление
Роль сервера в наборе репликации.
| Значение |
Описание |
|
None
|
Роль репликации не назначена; Сервер работает автономно.
|
|
Primary
|
Выступает в качестве исходного сервера для репликации на одну или несколько реплик.
|
|
AsyncReplica
|
Асинхронно получает данные с основного сервера в том же регионе.
|
|
GeoAsyncReplica
|
Асинхронно получает данные с основного сервера в другом регионе для обеспечения географической избыточности.
|
ReplicationState
Перечисление
Указывает состояние репликации реплики чтения. Это свойство возвращается только в том случае, если целевой сервер является репликой для чтения. Возможные значения: Активно, Сломано, Догоняющее, Инициализировано, Реконфигурация и Обновление
| Значение |
Описание |
|
Active
|
Реплика чтения — это полностью синхронизированная и активно реплицирующая данные с основного сервера.
|
|
Catchup
|
Реплика чтения находится за основным сервером и в настоящее время догоняет ожидающие изменения.
|
|
Provisioning
|
Реплика чтения создается и находится в процессе инициализации.
|
|
Updating
|
Реплика чтения претерпевает некоторые изменения, это может быть изменение объема вычислительных ресурсов или повышение ее до основного сервера.
|
|
Broken
|
Репликация завершилась сбоем или была прервана.
|
|
Reconfiguring
|
Реплика чтения перенастраивается, возможно, из-за изменений в источнике или настройках.
|
ServerForPatch
Объект
Представляет сервер для обновления.
| Имя |
Тип |
Описание |
|
identity
|
UserAssignedIdentity
|
Описывает удостоверение приложения.
|
|
properties.administratorLogin
|
string
|
Имя пользователя, назначенного в качестве первого администратора на основе пароля, назначенного вашему экземпляру PostgreSQL. Необходимо указать при первом включении аутентификации на основе пароля на сервере. После установки заданного значения оно не может быть изменено до конца срока службы сервера. Если вы отключите аутентификацию на основе пароля на сервере, на котором она включена, эта роль на основе пароля не будет удалена.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Пароль присваивается логину администратора. Если аутентификация по паролю включена, этот пароль можно изменить в любое время.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Свойства конфигурации аутентификации сервера.
|
|
properties.availabilityZone
|
string
|
Зона доступности сервера.
|
|
properties.backup
|
BackupForPatch
|
Свойства резервного копирования сервера.
|
|
properties.cluster
|
Cluster
|
Свойства кластера сервера.
|
|
properties.createMode
|
CreateModeForPatch
|
Режим обновления существующего сервера.
|
|
properties.dataEncryption
|
DataEncryption
|
Свойства шифрования данных сервера.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Свойства высокого уровня доступности сервера.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Свойства периода обслуживания сервера.
|
|
properties.network
|
Network
|
Сетевые свойства сервера. Требуется только в том случае, если вы хотите, чтобы ваш сервер был интегрирован в виртуальную сеть, предоставленную клиентом.
|
|
properties.replica
|
Replica
|
Чтение свойств реплики сервера. Требуется только в том случае, если вы хотите раскрутить сервер.
|
|
properties.replicationRole
|
ReplicationRole
|
Роль сервера в наборе репликации.
|
|
properties.storage
|
Storage
|
Свойства хранилища сервера.
|
|
properties.version
|
PostgresMajorVersion
|
Основная версия ядра СУБД PostgreSQL.
|
|
sku
|
SkuForPatch
|
Уровень вычислений и размер сервера.
|
|
tags
|
object
|
Метаданные, относящиеся к приложению, в виде пар "ключ-значение".
|
ServerPublicNetworkAccessState
Перечисление
Указывает, включен ли доступ к общедоступной сети. Это поддерживается только для серверов, которые не интегрированы в виртуальную сеть, принадлежащую клиенту и предоставленную им на момент развертывания сервера.
| Значение |
Описание |
|
Enabled
|
Доступ к публичной сети разрешен. Это позволяет получить доступ к серверу из общедоступного Интернета при условии наличия необходимого правила брандмауэра, разрешающего входящий трафик от подключающегося клиента. Это совместимо с использованием частных конечных точек для подключения к этому серверу.
|
|
Disabled
|
Доступ к общедоступной сети отключен. Это означает, что доступ к серверу невозможен из общедоступного Интернета, а только через частные конечные точки.
|
SkuForPatch
Объект
Вычислительная информация сервера.
| Имя |
Тип |
Описание |
|
name
|
string
|
Имя, под которым известен заданный объем вычислительных ресурсов, назначенный серверу.
|
|
tier
|
SkuTier
|
Уровень вычислительных ресурсов, назначенный серверу.
|
SkuTier
Перечисление
Уровень вычислительных ресурсов, назначенный серверу.
| Значение |
Описание |
|
Burstable
|
Экономичный уровень для нечастого использования процессора, идеально подходит для разработки и тестирования рабочих нагрузок с низкими требованиями к производительности.
|
|
GeneralPurpose
|
Сбалансированные вычислительные ресурсы и память для большинства рабочих нагрузок, обеспечивающие масштабируемую производительность и пропускную способность ввода-вывода.
|
|
MemoryOptimized
|
Высокое соотношение памяти и ядер для ресурсоемких рабочих нагрузок, требующих быстрой обработки в памяти и высокого параллелизма.
|
Storage
Объект
Свойства хранилища сервера.
| Имя |
Тип |
Описание |
|
autoGrow
|
StorageAutoGrow
|
Флаг для включения или отключения автоматического увеличения размера хранилища сервера, когда доступное пространство приближается к нулю и условия позволяют автоматически увеличивать размер хранилища.
|
|
iops
|
integer
(int32)
|
Максимальное количество операций ввода-вывода в секунду, поддерживаемое для хранения. Требуется, если тип хранилища PremiumV2_LRS или UltraSSD_LRS.
|
|
storageSizeGB
|
integer
(int32)
|
Размер хранилища, назначенного серверу.
|
|
throughput
|
integer
(int32)
|
Максимальная поддерживаемая пропускная способность для хранилища. Требуется, если тип хранилища PremiumV2_LRS или UltraSSD_LRS.
|
|
tier
|
AzureManagedDiskPerformanceTier
|
Уровень хранения сервера.
|
|
type
|
StorageType
|
Тип хранилища, назначенного серверу. Допустимые значения: Premium_LRS, PremiumV2_LRS или UltraSSD_LRS. Если не указано, по умолчанию используется значение Premium_LRS.
|
StorageAutoGrow
Перечисление
Флаг для включения или отключения автоматического увеличения размера хранилища сервера, когда доступное пространство приближается к нулю и условия позволяют автоматически увеличивать размер хранилища.
| Значение |
Описание |
|
Enabled
|
Сервер должен автоматически увеличивать размер хранилища, когда доступное пространство приближается к нулю и условия позволяют автоматически увеличивать размер хранилища.
|
|
Disabled
|
Сервер не должен автоматически увеличивать размер хранилища, когда доступное пространство приближается к нулю.
|
StorageType
Перечисление
Тип хранилища, назначенного серверу. Допустимые значения: Premium_LRS, PremiumV2_LRS или UltraSSD_LRS. Если не указано, по умолчанию используется значение Premium_LRS.
| Значение |
Описание |
|
Premium_LRS
|
Стандартное хранилище на твердотельном накопителе (SSD) обеспечивает стабильную производительность для рабочих нагрузок общего назначения.
|
|
PremiumV2_LRS
|
Твердотельные накопители (SSD) нового поколения с улучшенной масштабируемостью и производительностью для ресурсоемких корпоративных рабочих нагрузок.
|
|
UltraSSD_LRS
|
Высокопроизводительные твердотельные накопители (SSD), предназначенные для экстремальных операций ввода-вывода в секунду и приложений, чувствительных к задержкам.
|
UserAssignedIdentity
Объект
Удостоверения, связанные с сервером.
| Имя |
Тип |
Описание |
|
principalId
|
string
|
Идентификатор объекта субъекта-службы, связанного с управляемым удостоверением, назначенным пользователем.
|
|
tenantId
|
string
|
Идентификатор арендатора сервера.
|
|
type
|
IdentityType
|
Типы удостоверений, связанных с сервером.
|
|
userAssignedIdentities
|
<string,
UserIdentity>
|
Карта управляемых удостоверений, назначенных пользователями.
|
UserIdentity
Объект
Назначаемое пользователем управляемое удостоверение, связанное с сервером.
| Имя |
Тип |
Описание |
|
clientId
|
string
|
Идентификатор клиента субъекта-службы, связанного с управляемым удостоверением, назначенным пользователем.
|
|
principalId
|
string
|
Идентификатор объекта субъекта-службы, связанного с управляемым удостоверением, назначенным пользователем.
|