Memperbarui server yang ada. Isi permintaan dapat berisi satu atau beberapa properti yang ada dalam definisi server normal.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}?api-version=2025-08-01
Parameter URI
| Nama |
Dalam |
Diperlukan |
Jenis |
Deskripsi |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nama grup sumber daya. Nama tidak sensitif terhadap penggunaan huruf besar atau kecil.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
Nama server.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
ID langganan target. Nilainya harus sebuah UUID.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Versi API yang digunakan untuk operasi ini.
|
Isi Permintaan
| Nama |
Jenis |
Deskripsi |
|
identity
|
UserAssignedIdentity
|
Menjelaskan identitas aplikasi.
|
|
properties.administratorLogin
|
string
|
Nama login yang ditunjuk sebagai administrator berbasis kata sandi pertama yang ditetapkan ke instance PostgreSQL Anda. Harus ditentukan saat pertama kali Anda mengaktifkan autentikasi berbasis kata sandi di server. Setelah diatur ke nilai tertentu, itu tidak dapat diubah selama sisa masa pakai server. Jika Anda menonaktifkan autentikasi berbasis kata sandi di server yang mengaktifkannya, peran berbasis kata sandi ini tidak akan dihapus.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Kata sandi yang ditetapkan untuk login administrator. Selama otentikasi kata sandi diaktifkan, kata sandi ini dapat diubah kapan saja.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Properti konfigurasi autentikasi server.
|
|
properties.availabilityZone
|
string
|
Zona ketersediaan server.
|
|
properties.backup
|
BackupForPatch
|
Properti cadangan server.
|
|
properties.cluster
|
Cluster
|
Properti kluster server.
|
|
properties.createMode
|
CreateModeForPatch
|
Mode pembaruan server yang ada.
|
|
properties.dataEncryption
|
DataEncryption
|
Properti enkripsi data server.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Properti ketersediaan tinggi server.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Properti jendela pemeliharaan server.
|
|
properties.network
|
Network
|
Properti jaringan server. Hanya diperlukan jika Anda ingin server Anda diintegrasikan ke dalam jaringan virtual yang disediakan oleh pelanggan.
|
|
properties.replica
|
Replica
|
Baca properti replika server. Diperlukan hanya jika Anda ingin mempromosikan server.
|
|
properties.replicationRole
|
ReplicationRole
|
Peran server dalam kumpulan replikasi.
|
|
properties.storage
|
Storage
|
Properti penyimpanan server.
|
|
properties.version
|
PostgresMajorVersion
|
Versi utama mesin database PostgreSQL.
|
|
sku
|
SkuForPatch
|
Tingkat komputasi dan ukuran server.
|
|
tags
|
object
|
Metadata khusus aplikasi dalam bentuk pasangan kunci-nilai.
|
Respons
| Nama |
Jenis |
Deskripsi |
|
202 Accepted
|
|
Accepted.
Header
- Location: string
- Azure-AsyncOperation: string
|
|
Other Status Codes
|
ErrorResponse
|
Respons kesalahan yang menjelaskan mengapa operasi gagal.
|
Keamanan
azure_auth
Aliran Microsoft Entra OAuth2
Jenis:
oauth2
Alur:
implicit
URL Otorisasi:
https://login.microsoftonline.com/common/oauth2/authorize
Cakupan
| Nama |
Deskripsi |
|
user_impersonation
|
meniru identitas akun pengguna Anda
|
Contoh
Permintaan sampel
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
Respon sampel
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
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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.
Permintaan sampel
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
Respon sampel
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
Definisi
| Nama |
Deskripsi |
|
AuthConfigForPatch
|
Properti konfigurasi autentikasi server.
|
|
AzureManagedDiskPerformanceTier
|
Tingkat penyimpanan server.
|
|
BackupForPatch
|
Properti cadangan server.
|
|
Cluster
|
Properti kluster server.
|
|
CreateModeForPatch
|
Mode pembaruan server yang ada.
|
|
DataEncryption
|
Properti enkripsi data server.
|
|
DataEncryptionType
|
Jenis enkripsi data yang digunakan oleh server.
|
|
EncryptionKeyStatus
|
Status kunci yang digunakan oleh server yang dikonfigurasi dengan enkripsi data berdasarkan kunci yang dikelola pelanggan, untuk mengenkripsi penyimpanan utama yang terkait dengan server.
|
|
ErrorAdditionalInfo
|
Info tambahan kesalahan manajemen sumber daya.
|
|
ErrorDetail
|
Detail kesalahan.
|
|
ErrorResponse
|
Tanggapan kesalahan
|
|
GeographicallyRedundantBackup
|
Menunjukkan apakah server dikonfigurasi untuk membuat cadangan yang berlebihan secara geografis.
|
|
HighAvailabilityForPatch
|
Properti ketersediaan tinggi server.
|
|
HighAvailabilityMode
|
Mode ketersediaan tinggi untuk server.
|
|
HighAvailabilityState
|
Kemungkinan status server siaga yang dibuat saat ketersediaan tinggi diatur ke SameZone atau ZoneRedundant.
|
|
IdentityType
|
Jenis identitas yang terkait dengan server.
|
|
MaintenanceWindowForPatch
|
Properti jendela pemeliharaan server.
|
|
MicrosoftEntraAuth
|
Menunjukkan apakah server mendukung autentikasi Microsoft Entra.
|
|
Network
|
Properti jaringan server.
|
|
PasswordBasedAuth
|
Menunjukkan apakah server mendukung autentikasi berbasis kata sandi.
|
|
PostgresMajorVersion
|
Versi utama mesin database PostgreSQL.
|
|
ReadReplicaPromoteMode
|
Jenis operasi yang akan diterapkan pada replika baca. Properti ini hanya menulis saja. Mandiri berarti replika baca akan dipromosikan ke server mandiri, dan akan menjadi entitas yang sepenuhnya independen dari kumpulan replikasi. Peralihan berarti replika baca akan berperan dengan server utama.
|
|
ReadReplicaPromoteOption
|
Opsi sinkronisasi data untuk digunakan saat memproses operasi yang ditentukan dalam properti promoteMode. Properti ini hanya menulis saja.
|
|
Replica
|
Properti replika server.
|
|
ReplicationRole
|
Peran server dalam kumpulan replikasi.
|
|
ReplicationState
|
Menunjukkan status replikasi replika baca. Properti ini dikembalikan hanya ketika server target adalah replika baca. Nilai yang mungkin adalah Aktif, Rusak, Mengejar Ketinggalan, Penyediaan, Mengkonfigurasi Ulang, dan Memperbarui
|
|
ServerForPatch
|
Mewakili server yang akan diperbarui.
|
|
ServerPublicNetworkAccessState
|
Menunjukkan apakah akses jaringan publik diaktifkan atau tidak. Hal ini hanya didukung untuk server yang tidak terintegrasi ke dalam jaringan virtual yang dimiliki dan disediakan oleh pelanggan saat server di-deploy.
|
|
SkuForPatch
|
Menghitung informasi server.
|
|
SkuTier
|
Tingkat komputasi yang ditetapkan ke server.
|
|
Storage
|
Properti penyimpanan server.
|
|
StorageAutoGrow
|
Tandai untuk mengaktifkan atau menonaktifkan pertumbuhan otomatis ukuran penyimpanan server saat ruang yang tersedia mendekati nol dan kondisi memungkinkan pertumbuhan ukuran penyimpanan secara otomatis.
|
|
StorageType
|
Jenis penyimpanan yang ditetapkan ke server. Nilai yang diizinkan adalah Premium_LRS, PremiumV2_LRS, atau UltraSSD_LRS. Jika tidak ditentukan, defaultnya akan Premium_LRS.
|
|
UserAssignedIdentity
|
Identitas yang terkait dengan server.
|
|
UserIdentity
|
Identitas terkelola yang ditetapkan pengguna yang terkait dengan server.
|
AuthConfigForPatch
Objek
Properti konfigurasi autentikasi server.
| Nama |
Jenis |
Deskripsi |
|
activeDirectoryAuth
|
MicrosoftEntraAuth
|
Menunjukkan apakah server mendukung autentikasi Microsoft Entra.
|
|
passwordAuth
|
PasswordBasedAuth
|
Menunjukkan apakah server mendukung autentikasi berbasis kata sandi.
|
|
tenantId
|
string
|
Pengidentifikasi penyewa sumber daya yang didelegasikan.
|
Enumerasi
Tingkat penyimpanan server.
| Nilai |
Deskripsi |
|
P1
|
SSD entry-level untuk IOPS minimal, ideal untuk pengembangan ringan atau beban kerja pengujian.
|
|
P2
|
IOPS yang sedikit lebih tinggi untuk aplikasi skala kecil yang membutuhkan latensi rendah yang konsisten.
|
|
P3
|
Performa seimbang untuk beban kerja produksi dasar dengan throughput sedang.
|
|
P4
|
IOPS yang disempurnakan untuk aplikasi yang berkembang dengan kebutuhan performa yang dapat diprediksi.
|
|
P6
|
SSD tingkat menengah untuk beban kerja stabil yang membutuhkan throughput dan latensi yang andal.
|
|
P10
|
Pilihan populer untuk beban kerja produksi tujuan umum dengan performa yang dapat diskalakan.
|
|
P15
|
Tingkat IOPS tinggi untuk aplikasi yang menuntut dengan operasi baca/tulis yang sering.
|
|
P20
|
Titik masuk untuk Solid State Disk (SSD) berkinerja tinggi, cocok untuk beban kerja intensif I/O skala kecil.
|
|
P30
|
Tingkat seimbang untuk throughput sedang dan aplikasi sensitif latensi.
|
|
P40
|
Performa yang ditingkatkan untuk beban kerja produksi yang terus meningkat dengan tuntutan IOPS yang konsisten.
|
|
P50
|
Dioptimalkan untuk aplikasi tingkat perusahaan yang membutuhkan throughput tinggi yang berkelanjutan.
|
|
P60
|
Tingkat kapasitas tinggi untuk database besar dan beban kerja analitik dengan IOPS yang ditingkatkan.
|
|
P70
|
Dirancang untuk sistem misi penting yang membutuhkan latensi sangat rendah dan konkurensi tinggi.
|
|
P80
|
SSD tingkat atas untuk IOPS dan throughput maksimum, ideal untuk beban kerja yang paling menuntut.
|
BackupForPatch
Objek
Properti cadangan server.
| Nama |
Jenis |
Deskripsi |
|
backupRetentionDays
|
integer
(int32)
|
Hari retensi cadangan untuk server.
|
|
earliestRestoreDate
|
string
(date-time)
|
Waktu titik pemulihan paling awal (format ISO8601) untuk server.
|
|
geoRedundantBackup
|
GeographicallyRedundantBackup
|
Menunjukkan apakah server dikonfigurasi untuk membuat cadangan yang berlebihan secara geografis.
|
Cluster
Objek
Properti kluster server.
| Nama |
Jenis |
Nilai default |
Deskripsi |
|
clusterSize
|
integer
(int32)
|
0
|
Jumlah simpul yang ditetapkan ke kluster elastis.
|
|
defaultDatabaseName
|
string
|
|
Nama database default untuk kluster elastis.
|
CreateModeForPatch
Enumerasi
Mode pembaruan server yang ada.
| Nilai |
Deskripsi |
|
Default
|
Ini setara dengan 'Update'.
|
|
Update
|
Operasi memperbarui server yang ada.
|
DataEncryption
Objek
Properti enkripsi data server.
| Nama |
Jenis |
Deskripsi |
|
geoBackupEncryptionKeyStatus
|
EncryptionKeyStatus
|
Status kunci yang digunakan oleh server yang dikonfigurasi dengan enkripsi data berdasarkan kunci yang dikelola pelanggan, untuk mengenkripsi penyimpanan redundan secara geografis yang terkait dengan server saat dikonfigurasi untuk mendukung pencadangan yang berlebihan secara geografis.
|
|
geoBackupKeyURI
|
string
|
Pengidentifikasi identitas terkelola yang ditetapkan pengguna yang digunakan untuk mengakses kunci di Azure Key Vault untuk enkripsi data penyimpanan redundan secara geografis yang terkait dengan server yang dikonfigurasi untuk mendukung pencadangan redundan secara geografis.
|
|
geoBackupUserAssignedIdentityId
|
string
|
Pengidentifikasi identitas terkelola yang ditetapkan pengguna yang digunakan untuk mengakses kunci di Azure Key Vault untuk enkripsi data penyimpanan redundan secara geografis yang terkait dengan server yang dikonfigurasi untuk mendukung pencadangan redundan secara geografis.
|
|
primaryEncryptionKeyStatus
|
EncryptionKeyStatus
|
Status kunci yang digunakan oleh server yang dikonfigurasi dengan enkripsi data berdasarkan kunci yang dikelola pelanggan, untuk mengenkripsi penyimpanan utama yang terkait dengan server.
|
|
primaryKeyURI
|
string
|
URI kunci di Azure Key Vault yang digunakan untuk enkripsi data penyimpanan utama yang terkait dengan server.
|
|
primaryUserAssignedIdentityId
|
string
|
Pengidentifikasi identitas terkelola yang ditetapkan pengguna yang digunakan untuk mengakses kunci di Azure Key Vault untuk enkripsi data penyimpanan utama yang terkait dengan server.
|
|
type
|
DataEncryptionType
|
Jenis enkripsi data yang digunakan oleh server.
|
DataEncryptionType
Enumerasi
Jenis enkripsi data yang digunakan oleh server.
| Nilai |
Deskripsi |
|
SystemManaged
|
Enkripsi dikelola oleh Azure menggunakan kunci terkelola platform untuk kesederhanaan dan kepatuhan.
|
|
AzureKeyVault
|
Enkripsi menggunakan kunci yang dikelola pelanggan yang disimpan di Azure Key Vault untuk kontrol dan keamanan yang ditingkatkan.
|
EncryptionKeyStatus
Enumerasi
Status kunci yang digunakan oleh server yang dikonfigurasi dengan enkripsi data berdasarkan kunci yang dikelola pelanggan, untuk mengenkripsi penyimpanan utama yang terkait dengan server.
| Nilai |
Deskripsi |
|
Valid
|
Kunci valid dan dapat digunakan untuk enkripsi.
|
|
Invalid
|
Kunci tidak valid dan tidak dapat digunakan untuk enkripsi. Kemungkinan penyebabnya termasuk penghapusan kunci, perubahan izin, kunci dinonaktifkan, jenis kunci tidak didukung, atau tanggal saat ini berada di luar masa berlaku yang terkait dengan kunci.
|
ErrorAdditionalInfo
Objek
Info tambahan kesalahan manajemen sumber daya.
| Nama |
Jenis |
Deskripsi |
|
info
|
object
|
Info tambahan.
|
|
type
|
string
|
Jenis info tambahan.
|
ErrorDetail
Objek
Detail kesalahan.
| Nama |
Jenis |
Deskripsi |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Info tambahan kesalahan.
|
|
code
|
string
|
Kode kesalahan.
|
|
details
|
ErrorDetail[]
|
Detail kesalahan.
|
|
message
|
string
|
Pesan kesalahan.
|
|
target
|
string
|
Target kesalahan.
|
ErrorResponse
Objek
Tanggapan kesalahan
| Nama |
Jenis |
Deskripsi |
|
error
|
ErrorDetail
|
Objek kesalahan.
|
GeographicallyRedundantBackup
Enumerasi
Menunjukkan apakah server dikonfigurasi untuk membuat cadangan yang berlebihan secara geografis.
| Nilai |
Deskripsi |
|
Enabled
|
Server dikonfigurasi untuk membuat cadangan yang berlebihan secara geografis.
|
|
Disabled
|
Server tidak dikonfigurasi untuk membuat cadangan yang berlebihan secara geografis.
|
HighAvailabilityForPatch
Objek
Properti ketersediaan tinggi server.
| Nama |
Jenis |
Deskripsi |
|
mode
|
HighAvailabilityMode
|
Mode ketersediaan tinggi untuk server.
|
|
standbyAvailabilityZone
|
string
|
Zona ketersediaan yang terkait dengan server siaga yang dibuat saat ketersediaan tinggi diatur ke SameZone atau ZoneRedundant.
|
|
state
|
HighAvailabilityState
|
Kemungkinan status server siaga yang dibuat saat ketersediaan tinggi diatur ke SameZone atau ZoneRedundant.
|
HighAvailabilityMode
Enumerasi
Mode ketersediaan tinggi untuk server.
| Nilai |
Deskripsi |
|
Disabled
|
Ketersediaan tinggi dinonaktifkan untuk server.
|
|
ZoneRedundant
|
Ketersediaan tinggi diaktifkan untuk server, dengan server siaga di zona ketersediaan yang berbeda dari yang utama.
|
|
SameZone
|
Ketersediaan tinggi diaktifkan untuk server, dengan server siaga di zona ketersediaan yang sama dengan yang utama.
|
HighAvailabilityState
Enumerasi
Kemungkinan status server siaga yang dibuat saat ketersediaan tinggi diatur ke SameZone atau ZoneRedundant.
| Nilai |
Deskripsi |
|
NotEnabled
|
Ketersediaan tinggi tidak diaktifkan untuk server.
|
|
CreatingStandby
|
Server siaga sedang dibuat.
|
|
ReplicatingData
|
Data sedang direplikasi ke server siaga.
|
|
FailingOver
|
Operasi failover ke server siaga sedang berlangsung.
|
|
Healthy
|
Server siaga sehat dan siap untuk mengambil alih jika terjadi failover.
|
|
RemovingStandby
|
Server siaga sedang dihapus.
|
IdentityType
Enumerasi
Jenis identitas yang terkait dengan server.
| Nilai |
Deskripsi |
|
None
|
Tidak ada identitas terkelola yang ditetapkan ke server.
|
|
UserAssigned
|
Satu atau beberapa identitas terkelola yang disediakan oleh pengguna ditetapkan ke server.
|
|
SystemAssigned
|
Azure secara otomatis membuat dan mengelola identitas yang terkait dengan siklus hidup server.
|
|
SystemAssigned,UserAssigned
|
Identitas yang ditetapkan sistem dan yang ditetapkan pengguna ditetapkan ke server.
|
MaintenanceWindowForPatch
Objek
Properti jendela pemeliharaan server.
| Nama |
Jenis |
Deskripsi |
|
customWindow
|
string
|
Menunjukkan apakah jendela kustom diaktifkan atau dinonaktifkan.
|
|
dayOfWeek
|
integer
(int32)
|
Hari dalam seminggu untuk digunakan untuk jendela pemeliharaan.
|
|
startHour
|
integer
(int32)
|
Jam mulai untuk digunakan untuk jendela pemeliharaan.
|
|
startMinute
|
integer
(int32)
|
Menit mulai untuk digunakan untuk jendela pemeliharaan.
|
MicrosoftEntraAuth
Enumerasi
Menunjukkan apakah server mendukung autentikasi Microsoft Entra.
| Nilai |
Deskripsi |
|
Enabled
|
Server mendukung autentikasi Microsoft Entra.
|
|
Disabled
|
Server tidak mendukung autentikasi Microsoft Entra.
|
Network
Objek
Properti jaringan server.
| Nama |
Jenis |
Deskripsi |
|
delegatedSubnetResourceId
|
string
|
Pengidentifikasi sumber daya subnet yang didelegasikan. Diperlukan selama pembuatan server baru, jika Anda ingin server diintegrasikan ke dalam jaringan virtual Anda sendiri. Untuk operasi pembaruan, Anda hanya perlu memberikan properti ini jika ingin mengubah nilai yang ditetapkan untuk zona DNS privat.
|
|
privateDnsZoneArmResourceId
|
string
|
Pengidentifikasi zona DNS privat. Diperlukan selama pembuatan server baru, jika Anda ingin server diintegrasikan ke dalam jaringan virtual Anda sendiri. Untuk operasi pembaruan, Anda hanya perlu memberikan properti ini jika ingin mengubah nilai yang ditetapkan untuk zona DNS privat.
|
|
publicNetworkAccess
|
ServerPublicNetworkAccessState
|
Menunjukkan apakah akses jaringan publik diaktifkan atau tidak. Hal ini hanya didukung untuk server yang tidak terintegrasi ke dalam jaringan virtual yang dimiliki dan disediakan oleh pelanggan saat server di-deploy.
|
PasswordBasedAuth
Enumerasi
Menunjukkan apakah server mendukung autentikasi berbasis kata sandi.
| Nilai |
Deskripsi |
|
Enabled
|
Server mendukung autentikasi berbasis kata sandi.
|
|
Disabled
|
Server tidak mendukung autentikasi berbasis kata sandi.
|
PostgresMajorVersion
Enumerasi
Versi utama mesin database PostgreSQL.
| Nilai |
Deskripsi |
|
18
|
PostgreSQL 18.
|
|
17
|
PostgreSQL 17.
|
|
16
|
PostgreSQL 16.
|
|
15
|
PostgreSQL 15.
|
|
14
|
PostgreSQL 14.
|
|
13
|
PostgreSQL 13.
|
|
12
|
PostgreSQL 12.
|
|
11
|
PostgreSQL 11.
|
Enumerasi
Jenis operasi yang akan diterapkan pada replika baca. Properti ini hanya menulis saja. Mandiri berarti replika baca akan dipromosikan ke server mandiri, dan akan menjadi entitas yang sepenuhnya independen dari kumpulan replikasi. Peralihan berarti replika baca akan berperan dengan server utama.
| Nilai |
Deskripsi |
|
Standalone
|
Replika baca akan menjadi server independen.
|
|
Switchover
|
Replika baca akan menukar peran dengan server utama.
|
Enumerasi
Opsi sinkronisasi data untuk digunakan saat memproses operasi yang ditentukan dalam properti promoteMode. Properti ini hanya menulis saja.
| Nilai |
Deskripsi |
|
Planned
|
Operasi akan menunggu data dalam replika baca untuk sepenuhnya disinkronkan dengan server sumbernya, sebelum memulai operasi.
|
|
Forced
|
Operasi tidak akan menunggu data dalam replika baca disinkronkan dengan server sumbernya, sebelum memulai operasi.
|
Replica
Objek
Properti replika server.
| Nama |
Jenis |
Deskripsi |
|
capacity
|
integer
(int32)
|
Jumlah maksimum replika baca yang diizinkan untuk server.
|
|
promoteMode
|
ReadReplicaPromoteMode
|
Jenis operasi yang akan diterapkan pada replika baca. Properti ini hanya menulis saja. Mandiri berarti replika baca akan dipromosikan ke server mandiri, dan akan menjadi entitas yang sepenuhnya independen dari kumpulan replikasi. Peralihan berarti replika baca akan berperan dengan server utama.
|
|
promoteOption
|
ReadReplicaPromoteOption
|
Opsi sinkronisasi data untuk digunakan saat memproses operasi yang ditentukan dalam properti promoteMode. Properti ini hanya menulis saja.
|
|
replicationState
|
ReplicationState
|
Menunjukkan status replikasi replika baca. Properti ini dikembalikan hanya ketika server target adalah replika baca. Nilai yang mungkin adalah Aktif, Rusak, Mengejar Ketinggalan, Penyediaan, Mengkonfigurasi Ulang, dan Memperbarui
|
|
role
|
ReplicationRole
|
Peran server dalam kumpulan replikasi.
|
ReplicationRole
Enumerasi
Peran server dalam kumpulan replikasi.
| Nilai |
Deskripsi |
|
None
|
Tidak ada peran replikasi yang ditetapkan; Server beroperasi secara independen.
|
|
Primary
|
Bertindak sebagai server sumber untuk replikasi ke satu atau beberapa replika.
|
|
AsyncReplica
|
Menerima data secara asinkron dari server utama dalam wilayah yang sama.
|
|
GeoAsyncReplica
|
Menerima data secara asinkron dari server utama di wilayah yang berbeda untuk redundansi geografis.
|
ReplicationState
Enumerasi
Menunjukkan status replikasi replika baca. Properti ini dikembalikan hanya ketika server target adalah replika baca. Nilai yang mungkin adalah Aktif, Rusak, Mengejar Ketinggalan, Penyediaan, Mengkonfigurasi Ulang, dan Memperbarui
| Nilai |
Deskripsi |
|
Active
|
Replika baca sepenuhnya disinkronkan dan secara aktif mereplikasi data dari server utama.
|
|
Catchup
|
Replika baca berada di belakang server utama dan saat ini mengejar perubahan yang tertunda.
|
|
Provisioning
|
Replika baca sedang dibuat dan sedang dalam proses inisialisasi.
|
|
Updating
|
Replika baca sedang mengalami beberapa perubahan, dapat mengubah ukuran komputasi atau mempromosikannya ke server utama.
|
|
Broken
|
Replikasi telah gagal atau terganggu.
|
|
Reconfiguring
|
Replika baca sedang dikonfigurasi ulang, mungkin karena perubahan sumber atau pengaturan.
|
ServerForPatch
Objek
Mewakili server yang akan diperbarui.
| Nama |
Jenis |
Deskripsi |
|
identity
|
UserAssignedIdentity
|
Menjelaskan identitas aplikasi.
|
|
properties.administratorLogin
|
string
|
Nama login yang ditunjuk sebagai administrator berbasis kata sandi pertama yang ditetapkan ke instance PostgreSQL Anda. Harus ditentukan saat pertama kali Anda mengaktifkan autentikasi berbasis kata sandi di server. Setelah diatur ke nilai tertentu, itu tidak dapat diubah selama sisa masa pakai server. Jika Anda menonaktifkan autentikasi berbasis kata sandi di server yang mengaktifkannya, peran berbasis kata sandi ini tidak akan dihapus.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Kata sandi yang ditetapkan untuk login administrator. Selama otentikasi kata sandi diaktifkan, kata sandi ini dapat diubah kapan saja.
|
|
properties.authConfig
|
AuthConfigForPatch
|
Properti konfigurasi autentikasi server.
|
|
properties.availabilityZone
|
string
|
Zona ketersediaan server.
|
|
properties.backup
|
BackupForPatch
|
Properti cadangan server.
|
|
properties.cluster
|
Cluster
|
Properti kluster server.
|
|
properties.createMode
|
CreateModeForPatch
|
Mode pembaruan server yang ada.
|
|
properties.dataEncryption
|
DataEncryption
|
Properti enkripsi data server.
|
|
properties.highAvailability
|
HighAvailabilityForPatch
|
Properti ketersediaan tinggi server.
|
|
properties.maintenanceWindow
|
MaintenanceWindowForPatch
|
Properti jendela pemeliharaan server.
|
|
properties.network
|
Network
|
Properti jaringan server. Hanya diperlukan jika Anda ingin server Anda diintegrasikan ke dalam jaringan virtual yang disediakan oleh pelanggan.
|
|
properties.replica
|
Replica
|
Baca properti replika server. Diperlukan hanya jika Anda ingin mempromosikan server.
|
|
properties.replicationRole
|
ReplicationRole
|
Peran server dalam kumpulan replikasi.
|
|
properties.storage
|
Storage
|
Properti penyimpanan server.
|
|
properties.version
|
PostgresMajorVersion
|
Versi utama mesin database PostgreSQL.
|
|
sku
|
SkuForPatch
|
Tingkat komputasi dan ukuran server.
|
|
tags
|
object
|
Metadata khusus aplikasi dalam bentuk pasangan kunci-nilai.
|
ServerPublicNetworkAccessState
Enumerasi
Menunjukkan apakah akses jaringan publik diaktifkan atau tidak. Hal ini hanya didukung untuk server yang tidak terintegrasi ke dalam jaringan virtual yang dimiliki dan disediakan oleh pelanggan saat server di-deploy.
| Nilai |
Deskripsi |
|
Enabled
|
Akses jaringan publik diaktifkan. Ini memungkinkan server diakses dari internet publik, asalkan aturan firewall yang diperlukan yang memungkinkan lalu lintas masuk yang berasal dari klien yang terhubung tersedia. Ini kompatibel dengan penggunaan titik akhir privat untuk terhubung ke server ini.
|
|
Disabled
|
Akses jaringan publik dinonaktifkan. Ini berarti server tidak dapat diakses dari internet publik, tetapi hanya melalui titik akhir pribadi.
|
SkuForPatch
Objek
Menghitung informasi server.
| Nama |
Jenis |
Deskripsi |
|
name
|
string
|
Nama yang digunakan untuk mengetahui ukuran komputasi tertentu yang ditetapkan ke server.
|
|
tier
|
SkuTier
|
Tingkat komputasi yang ditetapkan ke server.
|
SkuTier
Enumerasi
Tingkat komputasi yang ditetapkan ke server.
| Nilai |
Deskripsi |
|
Burstable
|
Tingkat hemat biaya untuk penggunaan CPU yang jarang, ideal untuk pengembangan dan pengujian beban kerja dengan persyaratan performa rendah.
|
|
GeneralPurpose
|
Komputasi dan memori yang seimbang untuk sebagian besar beban kerja, menawarkan performa yang dapat diskalakan dan throughput I/O.
|
|
MemoryOptimized
|
Rasio memori terhadap inti yang tinggi untuk beban kerja yang menuntut yang membutuhkan pemrosesan dalam memori yang cepat dan konkurensi tinggi.
|
Storage
Objek
Properti penyimpanan server.
| Nama |
Jenis |
Deskripsi |
|
autoGrow
|
StorageAutoGrow
|
Tandai untuk mengaktifkan atau menonaktifkan pertumbuhan otomatis ukuran penyimpanan server saat ruang yang tersedia mendekati nol dan kondisi memungkinkan pertumbuhan ukuran penyimpanan secara otomatis.
|
|
iops
|
integer
(int32)
|
IOPS maksimum yang didukung untuk penyimpanan. Diperlukan ketika jenis penyimpanan PremiumV2_LRS atau UltraSSD_LRS.
|
|
storageSizeGB
|
integer
(int32)
|
Ukuran penyimpanan yang ditetapkan ke server.
|
|
throughput
|
integer
(int32)
|
Throughput maksimum didukung untuk penyimpanan. Diperlukan ketika jenis penyimpanan PremiumV2_LRS atau UltraSSD_LRS.
|
|
tier
|
AzureManagedDiskPerformanceTier
|
Tingkat penyimpanan server.
|
|
type
|
StorageType
|
Jenis penyimpanan yang ditetapkan ke server. Nilai yang diizinkan adalah Premium_LRS, PremiumV2_LRS, atau UltraSSD_LRS. Jika tidak ditentukan, defaultnya akan Premium_LRS.
|
StorageAutoGrow
Enumerasi
Tandai untuk mengaktifkan atau menonaktifkan pertumbuhan otomatis ukuran penyimpanan server saat ruang yang tersedia mendekati nol dan kondisi memungkinkan pertumbuhan ukuran penyimpanan secara otomatis.
| Nilai |
Deskripsi |
|
Enabled
|
Server akan secara otomatis meningkatkan ukuran penyimpanan ketika ruang yang tersedia mendekati nol dan kondisi memungkinkan untuk meningkatkan ukuran penyimpanan secara otomatis.
|
|
Disabled
|
Server tidak boleh secara otomatis meningkatkan ukuran penyimpanan saat ruang yang tersedia mendekati nol.
|
StorageType
Enumerasi
Jenis penyimpanan yang ditetapkan ke server. Nilai yang diizinkan adalah Premium_LRS, PremiumV2_LRS, atau UltraSSD_LRS. Jika tidak ditentukan, defaultnya akan Premium_LRS.
| Nilai |
Deskripsi |
|
Premium_LRS
|
Penyimpanan yang didukung Standard Solid State Disk (SSD) yang menawarkan performa yang konsisten untuk beban kerja tujuan umum.
|
|
PremiumV2_LRS
|
Penyimpanan Solid State Disk (SSD) generasi berikutnya dengan skalabilitas dan kinerja yang ditingkatkan untuk beban kerja perusahaan yang menuntut.
|
|
UltraSSD_LRS
|
Penyimpanan Solid State Disk (SSD) kelas atas yang dirancang untuk IOPS ekstrem dan aplikasi sensitif latensi.
|
UserAssignedIdentity
Objek
Identitas yang terkait dengan server.
| Nama |
Jenis |
Deskripsi |
|
principalId
|
string
|
Pengidentifikasi objek perwakilan layanan yang terkait dengan identitas terkelola yang ditetapkan pengguna.
|
|
tenantId
|
string
|
Pengidentifikasi penyewa server.
|
|
type
|
IdentityType
|
Jenis identitas yang terkait dengan server.
|
|
userAssignedIdentities
|
<string,
UserIdentity>
|
Peta identitas terkelola yang ditetapkan pengguna.
|
UserIdentity
Objek
Identitas terkelola yang ditetapkan pengguna yang terkait dengan server.
| Nama |
Jenis |
Deskripsi |
|
clientId
|
string
|
Pengidentifikasi klien perwakilan layanan yang terkait dengan identitas terkelola yang ditetapkan pengguna.
|
|
principalId
|
string
|
Pengidentifikasi objek perwakilan layanan yang terkait dengan identitas terkelola yang ditetapkan pengguna.
|