Erstellt einen neuen Server.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}?api-version=2025-08-01
URI-Parameter
| Name |
In |
Erforderlich |
Typ |
Beschreibung |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Der Name der Ressourcengruppe. Bei dem Namen wird die Groß-/Kleinschreibung nicht beachtet.
|
|
serverName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
Name des Servers
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
Die ID des Zielabonnements. Der Wert muss eine UUID sein.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Hierbei handelt es sich um die für diesen Vorgang zu verwendende API-Version.
|
Anforderungstext
| Name |
Erforderlich |
Typ |
Beschreibung |
|
location
|
True
|
string
|
Der geografische Standort, an dem sich die Ressource befindet
|
|
identity
|
|
UserAssignedIdentity
|
Benutzerseitig zugewiesene verwaltete Identitäten, die dem Server zugewiesen sind.
|
|
properties.administratorLogin
|
|
string
|
Name des Anmeldenamens, der als erster kennwortbasierter Administrator festgelegt ist, der Ihrer PostgreSQL-Instanz zugewiesen ist. Muss angegeben werden, wenn Sie die kennwortbasierte Authentifizierung zum ersten Mal auf einem Server aktivieren. Sobald er auf einen bestimmten Wert festgelegt ist, kann er für den Rest der Lebensdauer eines Servers nicht mehr geändert werden. Wenn Sie die kennwortbasierte Authentifizierung auf einem Server deaktivieren, auf dem sie aktiviert war, wird diese kennwortbasierte Rolle nicht gelöscht.
|
|
properties.administratorLoginPassword
|
|
string
(password)
|
Passwort, das dem Administrator-Login zugewiesen ist. Solange die Passwortauthentifizierung aktiviert ist, kann dieses Passwort jederzeit geändert werden.
|
|
properties.authConfig
|
|
AuthConfig
|
Authentifizierungskonfigurationseigenschaften eines Servers.
|
|
properties.availabilityZone
|
|
string
|
Verfügbarkeitszone eines Servers.
|
|
properties.backup
|
|
Backup
|
Sicherungseigenschaften eines Servers.
|
|
properties.cluster
|
|
Cluster
|
Clustereigenschaften eines Servers.
|
|
properties.createMode
|
|
CreateMode
|
Erstellungsmodus eines neuen Servers.
|
|
properties.dataEncryption
|
|
DataEncryption
|
Datenverschlüsselungseigenschaften eines Servers.
|
|
properties.highAvailability
|
|
HighAvailability
|
Eigenschaften mit hoher Verfügbarkeit eines Servers.
|
|
properties.maintenanceWindow
|
|
MaintenanceWindow
|
Wartungsfenstereigenschaften eines Servers.
|
|
properties.network
|
|
Network
|
Netzwerkeigenschaften eines Servers. Nur erforderlich, wenn der Server in ein vom Kunden bereitgestelltes virtuelles Netzwerk integriert werden soll.
|
|
properties.pointInTimeUTC
|
|
string
(date-time)
|
Erstellungszeit (in ISO8601 Format) der Sicherung, die Sie auf dem neuen Server wiederherstellen möchten. Dies ist erforderlich, wenn 'createMode' 'PointInTimeRestore', 'GeoRestore' oder 'ReviveDropped' ist.
|
|
properties.replica
|
|
Replica
|
Lesen Sie die Replikateigenschaften eines Servers. Nur erforderlich, wenn Sie einen Server heraufstufen möchten.
|
|
properties.replicationRole
|
|
ReplicationRole
|
Rolle des Servers in einer Replikationsgruppe.
|
|
properties.sourceServerResourceId
|
|
string
(arm-id)
|
Kennung des Servers, der als Quelle des neuen Servers verwendet werden soll. Erforderlich, wenn 'createMode' 'PointInTimeRestore', 'GeoRestore', 'Replica' oder 'ReviveDropped' ist. Diese Eigenschaft wird nur zurückgegeben, wenn es sich bei dem Zielserver um ein Lesereplikat handelt.
|
|
properties.storage
|
|
Storage
|
Speichereigenschaften eines Servers.
|
|
properties.version
|
|
PostgresMajorVersion
|
Hauptversion der PostgreSQL-Datenbank-Engine.
|
|
sku
|
|
Sku
|
Computeebene und -größe eines Servers.
|
|
tags
|
|
object
|
Ressourcentags.
|
Antworten
| Name |
Typ |
Beschreibung |
|
202 Accepted
|
|
Ressourcenvorgang akzeptiert.
Header
- Azure-AsyncOperation: string
- Location: string
- Retry-After: integer
|
|
Other Status Codes
|
ErrorResponse
|
Unerwartete Fehlerantwort.
|
Sicherheit
azure_auth
Azure Active Directory OAuth2 Flow.
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
| Name |
Beschreibung |
|
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
Create a new elastic cluster.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"location": "eastus",
"properties": {
"administratorLogin": "examplelogin",
"administratorLoginPassword": "examplepassword",
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"cluster": {
"clusterSize": 2,
"defaultDatabaseName": "clusterdb"
},
"createMode": "Create",
"highAvailability": {
"mode": "Disabled"
},
"network": {
"publicNetworkAccess": "Disabled"
},
"storage": {
"autoGrow": "Disabled",
"storageSizeGB": 256,
"tier": "P15"
},
"version": "16"
},
"sku": {
"name": "Standard_D4ds_v5",
"tier": "GeneralPurpose"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Cluster;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.GeographicallyRedundantBackup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Network;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPublicNetworkAccessState;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
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 CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersClusterCreate.json
*/
/**
* Sample code: Create a new elastic cluster.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
createANewElasticCluster(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withSku(new Sku().withName("Standard_D4ds_v5").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLogin("examplelogin").withAdministratorLoginPassword("examplepassword")
.withVersion(PostgresMajorVersion.ONE_SIX)
.withStorage(new Storage().withStorageSizeGB(256).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P15))
.withBackup(
new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeographicallyRedundantBackup.DISABLED))
.withNetwork(new Network().withPublicNetworkAccess(ServerPublicNetworkAccessState.DISABLED))
.withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.fromString("Disabled")))
.withCreateMode(CreateMode.CREATE)
.withCluster(new Cluster().withClusterSize(2).withDefaultDatabaseName("clusterdb")).create();
}
// 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_cluster_create.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_create_or_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"location": "eastus",
"properties": {
"administratorLogin": "examplelogin",
"administratorLoginPassword": "examplepassword",
"backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"},
"cluster": {"clusterSize": 2, "defaultDatabaseName": "clusterdb"},
"createMode": "Create",
"highAvailability": {"mode": "Disabled"},
"network": {"publicNetworkAccess": "Disabled"},
"storage": {"autoGrow": "Disabled", "storageSizeGB": 256, "tier": "P15"},
"version": "16",
},
"sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json
func ExampleServersClient_BeginCreateOrUpdate_createANewElasticCluster() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("examplelogin"),
AdministratorLoginPassword: to.Ptr("examplepassword"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeographicallyRedundantBackupDisabled),
},
Cluster: &armpostgresqlflexibleservers.Cluster{
ClusterSize: to.Ptr[int32](2),
DefaultDatabaseName: to.Ptr("clusterdb"),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityMode("Disabled")),
},
Network: &armpostgresqlflexibleservers.Network{
PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateDisabled),
},
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
StorageSizeGB: to.Ptr[int32](256),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP15),
},
Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSixteen),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4ds_v5"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json
*/
async function createANewElasticCluster() {
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 = {
administratorLogin: "examplelogin",
administratorLoginPassword: "examplepassword",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" },
cluster: { clusterSize: 2, defaultDatabaseName: "clusterdb" },
createMode: "Create",
highAvailability: { mode: "Disabled" },
location: "eastus",
network: { publicNetworkAccess: "Disabled" },
sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 256, tier: "P15" },
version: "16",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Sku = new PostgreSqlFlexibleServerSku("Standard_D4ds_v5", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
AdministratorLogin = "examplelogin",
AdministratorLoginPassword = "examplepassword",
Version = PostgreSqlFlexibleServerVersion.Sixteen,
Storage = new PostgreSqlFlexibleServerStorage
{
StorageSizeInGB = 256,
AutoGrow = StorageAutoGrow.Disabled,
Tier = PostgreSqlManagedDiskPerformanceTier.P15,
},
Backup = new PostgreSqlFlexibleServerBackupProperties
{
BackupRetentionDays = 7,
GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Disabled,
},
Network = new PostgreSqlFlexibleServerNetwork
{
PublicNetworkAccess = PostgreSqlFlexibleServerPublicNetworkAccessState.Disabled,
},
HighAvailability = new PostgreSqlFlexibleServerHighAvailability
{
Mode = PostgreSqlFlexibleServerHighAvailabilityMode.Disabled,
},
CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
Cluster = new PostgreSqlFlexibleServerClusterProperties
{
ClusterSize = 2,
DefaultDatabaseName = "clusterdb",
},
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server in Microsoft owned virtual network with zone redundant high availability.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Enabled"
},
"createMode": "Create",
"highAvailability": {
"mode": "ZoneRedundant"
},
"network": {
"publicNetworkAccess": "Enabled"
},
"storage": {
"autoGrow": "Disabled",
"storageSizeGB": 512,
"tier": "P20"
},
"version": "17"
},
"sku": {
"name": "Standard_D4ds_v5",
"tier": "GeneralPurpose"
},
"tags": {
"InCustomerVnet": "false",
"InMicrosoftVnet": "true"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.GeographicallyRedundantBackup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Network;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPublicNetworkAccessState;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
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 CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json
*/
/**
* Sample code: Create a new server in Microsoft owned virtual network with zone redundant high availability.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withTags(mapOf("InCustomerVnet", "false", "InMicrosoftVnet", "true"))
.withSku(new Sku().withName("Standard_D4ds_v5").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLogin("exampleadministratorlogin").withAdministratorLoginPassword("examplepassword")
.withVersion(PostgresMajorVersion.ONE_SEVEN)
.withStorage(new Storage().withStorageSizeGB(512).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P20))
.withBackup(
new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeographicallyRedundantBackup.ENABLED))
.withNetwork(new Network().withPublicNetworkAccess(ServerPublicNetworkAccessState.ENABLED))
.withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT))
.withAvailabilityZone("1").withCreateMode(CreateMode.CREATE).create();
}
// 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_create_in_microsoft_owned_virtual_network_with_zone_redundant_high_availability.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_create_or_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Enabled"},
"createMode": "Create",
"highAvailability": {"mode": "ZoneRedundant"},
"network": {"publicNetworkAccess": "Enabled"},
"storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"},
"version": "17",
},
"sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"},
"tags": {"InCustomerVnet": "false", "InMicrosoftVnet": "true"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Tags: map[string]*string{
"InCustomerVnet": to.Ptr("false"),
"InMicrosoftVnet": to.Ptr("true"),
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("exampleadministratorlogin"),
AdministratorLoginPassword: to.Ptr("examplepassword"),
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeographicallyRedundantBackupEnabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
},
Network: &armpostgresqlflexibleservers.Network{
PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled),
},
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
StorageSizeGB: to.Ptr[int32](512),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP20),
},
Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSeventeen),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4ds_v5"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json
*/
async function createANewServerInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability() {
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 = {
administratorLogin: "exampleadministratorlogin",
administratorLoginPassword: "examplepassword",
availabilityZone: "1",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" },
createMode: "Create",
highAvailability: { mode: "ZoneRedundant" },
location: "eastus",
network: { publicNetworkAccess: "Enabled" },
sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" },
tags: { inCustomerVnet: "false", inMicrosoftVnet: "true" },
version: "17",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Sku = new PostgreSqlFlexibleServerSku("Standard_D4ds_v5", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
AdministratorLogin = "exampleadministratorlogin",
AdministratorLoginPassword = "examplepassword",
Version = PostgreSqlFlexibleServerVersion.Seventeen,
Storage = new PostgreSqlFlexibleServerStorage
{
StorageSizeInGB = 512,
AutoGrow = StorageAutoGrow.Disabled,
Tier = PostgreSqlManagedDiskPerformanceTier.P20,
},
Backup = new PostgreSqlFlexibleServerBackupProperties
{
BackupRetentionDays = 7,
GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Enabled,
},
Network = new PostgreSqlFlexibleServerNetwork
{
PublicNetworkAccess = PostgreSqlFlexibleServerPublicNetworkAccessState.Enabled,
},
HighAvailability = new PostgreSqlFlexibleServerHighAvailability
{
Mode = PostgreSqlFlexibleServerHighAvailabilityMode.ZoneRedundant,
},
AvailabilityZone = "1",
CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
Tags =
{
["InCustomerVnet"] = "false",
["InMicrosoftVnet"] = "true"
},
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server in your own virtual network with same zone high availability.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Enabled"
},
"createMode": "Create",
"highAvailability": {
"mode": "SameZone"
},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database"
},
"storage": {
"autoGrow": "Disabled",
"storageSizeGB": 512,
"tier": "P20"
},
"version": "17"
},
"sku": {
"name": "Standard_D4ds_v5",
"tier": "GeneralPurpose"
},
"tags": {
"InCustomerVnet": "true",
"InMicrosoftVnet": "false"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.GeographicallyRedundantBackup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Network;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
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 CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json
*/
/**
* Sample code: Create a new server in your own virtual network with same zone high availability.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withTags(mapOf("InCustomerVnet", "true", "InMicrosoftVnet", "false"))
.withSku(new Sku().withName("Standard_D4ds_v5").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLogin("exampleadministratorlogin").withAdministratorLoginPassword("examplepassword")
.withVersion(PostgresMajorVersion.ONE_SEVEN)
.withStorage(new Storage().withStorageSizeGB(512).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P20))
.withBackup(
new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeographicallyRedundantBackup.ENABLED))
.withNetwork(new Network().withDelegatedSubnetResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet")
.withPrivateDnsZoneArmResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database"))
.withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.SAME_ZONE))
.withAvailabilityZone("1").withCreateMode(CreateMode.CREATE).create();
}
// 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_create_in_your_own_virtual_network_with_same_zone_high_availability.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_create_or_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Enabled"},
"createMode": "Create",
"highAvailability": {"mode": "SameZone"},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database",
},
"storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"},
"version": "17",
},
"sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"},
"tags": {"InCustomerVnet": "true", "InMicrosoftVnet": "false"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Tags: map[string]*string{
"InCustomerVnet": to.Ptr("true"),
"InMicrosoftVnet": to.Ptr("false"),
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("exampleadministratorlogin"),
AdministratorLoginPassword: to.Ptr("examplepassword"),
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeographicallyRedundantBackupEnabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeSameZone),
},
Network: &armpostgresqlflexibleservers.Network{
DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database"),
},
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
StorageSizeGB: to.Ptr[int32](512),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP20),
},
Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSeventeen),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4ds_v5"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json
*/
async function createANewServerInYourOwnVirtualNetworkWithSameZoneHighAvailability() {
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 = {
administratorLogin: "exampleadministratorlogin",
administratorLoginPassword: "examplepassword",
availabilityZone: "1",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Enabled" },
createMode: "Create",
highAvailability: { mode: "SameZone" },
location: "eastus",
network: {
delegatedSubnetResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
privateDnsZoneArmResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database",
},
sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" },
tags: { inCustomerVnet: "true", inMicrosoftVnet: "false" },
version: "17",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Sku = new PostgreSqlFlexibleServerSku("Standard_D4ds_v5", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
AdministratorLogin = "exampleadministratorlogin",
AdministratorLoginPassword = "examplepassword",
Version = PostgreSqlFlexibleServerVersion.Seventeen,
Storage = new PostgreSqlFlexibleServerStorage
{
StorageSizeInGB = 512,
AutoGrow = StorageAutoGrow.Disabled,
Tier = PostgreSqlManagedDiskPerformanceTier.P20,
},
Backup = new PostgreSqlFlexibleServerBackupProperties
{
BackupRetentionDays = 7,
GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Enabled,
},
Network = new PostgreSqlFlexibleServerNetwork
{
DelegatedSubnetResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDnsZoneArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database"),
},
HighAvailability = new PostgreSqlFlexibleServerHighAvailability
{
Mode = PostgreSqlFlexibleServerHighAvailabilityMode.SameZone,
},
AvailabilityZone = "1",
CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
Tags =
{
["InCustomerVnet"] = "true",
["InMicrosoftVnet"] = "false"
},
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server using a backup of a server that was deleted or dropped recently.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"location": "eastus",
"properties": {
"createMode": "ReviveDropped",
"pointInTimeUTC": "2025-06-01T18:30:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateReviveDropped.json
*/
/**
* Sample code: Create a new server using a backup of a server that was deleted or dropped recently.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver")
.withPointInTimeUtc(OffsetDateTime.parse("2025-06-01T18:30:22.123456Z"))
.withCreateMode(CreateMode.REVIVE_DROPPED).create();
}
// 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_create_revive_dropped.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_create_or_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"location": "eastus",
"properties": {
"createMode": "ReviveDropped",
"pointInTimeUTC": "2025-06-01T18:30:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver",
},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeReviveDropped),
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T18:30:22.123Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json
*/
async function createANewServerUsingABackupOfAServerThatWasDeletedOrDroppedRecently() {
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: "ReviveDropped",
location: "eastus",
pointInTimeUTC: new Date("2025-06-01T18:30:22.123456Z"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver"),
PointInTimeUtc = DateTimeOffset.Parse("2025-06-01T18:30:22.123456Z"),
CreateMode = PostgreSqlFlexibleServerCreateMode.ReviveDropped,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server using a point in time restore of a backup of an existing server.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"location": "eastus",
"properties": {
"createMode": "PointInTimeRestore",
"pointInTimeUTC": "2025-06-01T18:35:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreatePointInTimeRestore.json
*/
/**
* Sample code: Create a new server using a point in time restore of a backup of an existing server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver")
.withPointInTimeUtc(OffsetDateTime.parse("2025-06-01T18:35:22.123456Z"))
.withCreateMode(CreateMode.POINT_IN_TIME_RESTORE).create();
}
// 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_create_point_in_time_restore.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_create_or_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"location": "eastus",
"properties": {
"createMode": "PointInTimeRestore",
"pointInTimeUTC": "2025-06-01T18:35:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModePointInTimeRestore),
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T18:35:22.123Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json
*/
async function createANewServerUsingAPointInTimeRestoreOfABackupOfAnExistingServer() {
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: "PointInTimeRestore",
location: "eastus",
pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
PointInTimeUtc = DateTimeOffset.Parse("2025-06-01T18:35:22.123456Z"),
CreateMode = PostgreSqlFlexibleServerCreateMode.PointInTimeRestore,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server using a restore of a geographically redundant backup of an existing server, with data encryption based on customer managed key with automatic key version update.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}
}
},
"location": "eastus",
"properties": {
"createMode": "GeoRestore",
"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"
},
"pointInTimeUTC": "2025-06-01T18:35:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
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.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json
*/
/**
* Sample code: Create a new server using a restore of a geographically redundant backup of 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
createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.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))
.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))
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver")
.withPointInTimeUtc(OffsetDateTime.parse("2025-06-01T18:35:22.123456Z"))
.withCreateMode(CreateMode.GEO_RESTORE).create();
}
// 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_create_geo_restore_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_create_or_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": {},
},
},
"location": "eastus",
"properties": {
"createMode": "GeoRestore",
"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",
},
"pointInTimeUTC": "2025-06-01T18:35:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeGeoRestore),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr("https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey"),
GeoBackupUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"),
PrimaryKeyURI: to.Ptr("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
},
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T18:35:22.123Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json
*/
async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() {
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: "GeoRestore",
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":
{},
},
},
location: "eastus",
pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
{
UserAssignedIdentities =
{
["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"] = new UserAssignedIdentity(),
["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"] = new UserAssignedIdentity()
},
},
DataEncryption = new PostgreSqlFlexibleServerDataEncryption
{
PrimaryKeyUri = new Uri("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey"),
PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
GeoBackupKeyUri = new Uri("https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey"),
GeoBackupUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
},
SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
PointInTimeUtc = DateTimeOffset.Parse("2025-06-01T18:35:22.123456Z"),
CreateMode = PostgreSqlFlexibleServerCreateMode.GeoRestore,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server using a restore of a geographically redundant backup of an existing server, with data encryption based on customer managed key.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}
}
},
"location": "eastus",
"properties": {
"createMode": "GeoRestore",
"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"
},
"pointInTimeUTC": "2025-06-01T18:35:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
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.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateGeoRestoreWithDataEncryptionEnabled.json
*/
/**
* Sample code: Create a new server using a restore of a geographically redundant backup of an existing server, with
* data encryption based on customer managed key.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.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))
.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))
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver")
.withPointInTimeUtc(OffsetDateTime.parse("2025-06-01T18:35:22.123456Z"))
.withCreateMode(CreateMode.GEO_RESTORE).create();
}
// 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_create_geo_restore_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_create_or_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": {},
},
},
"location": "eastus",
"properties": {
"createMode": "GeoRestore",
"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",
},
"pointInTimeUTC": "2025-06-01T18:35:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {},
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeGeoRestore),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr("https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"),
GeoBackupUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"),
PrimaryKeyURI: to.Ptr("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
},
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T18:35:22.123Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json
*/
async function createANewServerUsingARestoreOfAGeographicallyRedundantBackupOfAnExistingServerWithDataEncryptionBasedOnCustomerManagedKey() {
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: "GeoRestore",
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":
{},
},
},
location: "eastus",
pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
{
UserAssignedIdentities =
{
["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity"] = new UserAssignedIdentity(),
["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"] = new UserAssignedIdentity()
},
},
DataEncryption = new PostgreSqlFlexibleServerDataEncryption
{
PrimaryKeyUri = new Uri("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
GeoBackupKeyUri = new Uri("https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"),
GeoBackupUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity",
KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
},
SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
PointInTimeUtc = DateTimeOffset.Parse("2025-06-01T18:35:22.123456Z"),
CreateMode = PostgreSqlFlexibleServerCreateMode.GeoRestore,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server with data encryption based on customer managed key with automatic key version update.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}
}
},
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"createMode": "Create",
"dataEncryption": {
"type": "AzureKeyVault",
"geoBackupKeyURI": "",
"geoBackupUserAssignedIdentityId": "",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"
},
"highAvailability": {
"mode": "ZoneRedundant"
},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"
},
"storage": {
"autoGrow": "Disabled",
"storageSizeGB": 512,
"tier": "P20"
},
"version": "17"
},
"sku": {
"name": "Standard_D4ds_v5",
"tier": "GeneralPurpose"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryptionType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.GeographicallyRedundantBackup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.IdentityType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Network;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow;
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 CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateWithDataEncryptionEnabledAutoUpdate.json
*/
/**
* Sample code: Create a new server with data encryption based on customer managed key with automatic key version
* update.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withSku(new Sku().withName("Standard_D4ds_v5").withTier(SkuTier.GENERAL_PURPOSE))
.withIdentity(new UserAssignedIdentity().withUserAssignedIdentities(mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
new UserIdentity())).withType(IdentityType.USER_ASSIGNED))
.withAdministratorLogin("exampleadministratorlogin").withAdministratorLoginPassword("examplepassword")
.withVersion(PostgresMajorVersion.ONE_SEVEN)
.withStorage(new Storage().withStorageSizeGB(512).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P20))
.withDataEncryption(new DataEncryption().withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity")
.withGeoBackupKeyUri("fakeTokenPlaceholder").withGeoBackupUserAssignedIdentityId("")
.withType(DataEncryptionType.AZURE_KEY_VAULT))
.withBackup(
new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeographicallyRedundantBackup.DISABLED))
.withNetwork(new Network().withDelegatedSubnetResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet")
.withPrivateDnsZoneArmResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"))
.withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT))
.withAvailabilityZone("1").withCreateMode(CreateMode.CREATE).create();
}
// 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_create_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_create_or_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/exampleprimaryidentity": {}
},
},
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"},
"createMode": "Create",
"dataEncryption": {
"geoBackupKeyURI": "",
"geoBackupUserAssignedIdentityId": "",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
"type": "AzureKeyVault",
},
"highAvailability": {"mode": "ZoneRedundant"},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com",
},
"storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"},
"version": "17",
},
"sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("exampleadministratorlogin"),
AdministratorLoginPassword: to.Ptr("examplepassword"),
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeographicallyRedundantBackupDisabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr(""),
GeoBackupUserAssignedIdentityID: to.Ptr(""),
PrimaryKeyURI: to.Ptr("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
},
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
},
Network: &armpostgresqlflexibleservers.Network{
DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"),
},
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
StorageSizeGB: to.Ptr[int32](512),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP20),
},
Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSeventeen),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4ds_v5"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json
*/
async function createANewServerWithDataEncryptionBasedOnCustomerManagedKeyWithAutomaticKeyVersionUpdate() {
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 = {
administratorLogin: "exampleadministratorlogin",
administratorLoginPassword: "examplepassword",
availabilityZone: "1",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" },
createMode: "Create",
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI: "",
geoBackupUserAssignedIdentityId: "",
primaryKeyURI: "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
},
highAvailability: { mode: "ZoneRedundant" },
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity":
{},
},
},
location: "eastus",
network: {
delegatedSubnetResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
privateDnsZoneArmResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com",
},
sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" },
version: "17",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Sku = new PostgreSqlFlexibleServerSku("Standard_D4ds_v5", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
{
UserAssignedIdentities =
{
["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"] = new UserAssignedIdentity()
},
},
AdministratorLogin = "exampleadministratorlogin",
AdministratorLoginPassword = "examplepassword",
Version = PostgreSqlFlexibleServerVersion.Seventeen,
Storage = new PostgreSqlFlexibleServerStorage
{
StorageSizeInGB = 512,
AutoGrow = StorageAutoGrow.Disabled,
Tier = PostgreSqlManagedDiskPerformanceTier.P20,
},
DataEncryption = new PostgreSqlFlexibleServerDataEncryption
{
PrimaryKeyUri = new Uri("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey"),
PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
GeoBackupKeyUri = new Uri(""),
GeoBackupUserAssignedIdentityId = "",
KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
},
Backup = new PostgreSqlFlexibleServerBackupProperties
{
BackupRetentionDays = 7,
GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Disabled,
},
Network = new PostgreSqlFlexibleServerNetwork
{
DelegatedSubnetResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDnsZoneArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"),
},
HighAvailability = new PostgreSqlFlexibleServerHighAvailability
{
Mode = PostgreSqlFlexibleServerHighAvailabilityMode.ZoneRedundant,
},
AvailabilityZone = "1",
CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server with data encryption based on customer managed key.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}
}
},
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"createMode": "Create",
"dataEncryption": {
"type": "AzureKeyVault",
"geoBackupKeyURI": "",
"geoBackupUserAssignedIdentityId": "",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"
},
"highAvailability": {
"mode": "ZoneRedundant"
},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"
},
"storage": {
"autoGrow": "Disabled",
"storageSizeGB": 512,
"tier": "P20"
},
"version": "17"
},
"sku": {
"name": "Standard_D4ds_v5",
"tier": "GeneralPurpose"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryptionType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.GeographicallyRedundantBackup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.IdentityType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Network;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow;
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 CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateWithDataEncryptionEnabled.json
*/
/**
* Sample code: Create a new server with data encryption based on customer managed key.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServerWithDataEncryptionBasedOnCustomerManagedKey(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withSku(new Sku().withName("Standard_D4ds_v5").withTier(SkuTier.GENERAL_PURPOSE))
.withIdentity(new UserAssignedIdentity().withUserAssignedIdentities(mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
new UserIdentity())).withType(IdentityType.USER_ASSIGNED))
.withAdministratorLogin("exampleadministratorlogin").withAdministratorLoginPassword("examplepassword")
.withVersion(PostgresMajorVersion.ONE_SEVEN)
.withStorage(new Storage().withStorageSizeGB(512).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P20))
.withDataEncryption(new DataEncryption().withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity")
.withGeoBackupKeyUri("fakeTokenPlaceholder").withGeoBackupUserAssignedIdentityId("")
.withType(DataEncryptionType.AZURE_KEY_VAULT))
.withBackup(
new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeographicallyRedundantBackup.DISABLED))
.withNetwork(new Network().withDelegatedSubnetResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet")
.withPrivateDnsZoneArmResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"))
.withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT))
.withAvailabilityZone("1").withCreateMode(CreateMode.CREATE).create();
}
// 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_create_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_create_or_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/exampleprimaryidentity": {}
},
},
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"availabilityZone": "1",
"backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"},
"createMode": "Create",
"dataEncryption": {
"geoBackupKeyURI": "",
"geoBackupUserAssignedIdentityId": "",
"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",
},
"highAvailability": {"mode": "ZoneRedundant"},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com",
},
"storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"},
"version": "17",
},
"sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerWithDataEncryptionBasedOnCustomerManagedKey() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("exampleadministratorlogin"),
AdministratorLoginPassword: to.Ptr("examplepassword"),
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeographicallyRedundantBackupDisabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr(""),
GeoBackupUserAssignedIdentityID: to.Ptr(""),
PrimaryKeyURI: to.Ptr("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
},
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
},
Network: &armpostgresqlflexibleservers.Network{
DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"),
},
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
StorageSizeGB: to.Ptr[int32](512),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP20),
},
Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSeventeen),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4ds_v5"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json
*/
async function createANewServerWithDataEncryptionBasedOnCustomerManagedKey() {
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 = {
administratorLogin: "exampleadministratorlogin",
administratorLoginPassword: "examplepassword",
availabilityZone: "1",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" },
createMode: "Create",
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI: "",
geoBackupUserAssignedIdentityId: "",
primaryKeyURI:
"https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
},
highAvailability: { mode: "ZoneRedundant" },
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/exampleresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/exampleprimaryidentity":
{},
},
},
location: "eastus",
network: {
delegatedSubnetResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
privateDnsZoneArmResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com",
},
sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" },
version: "17",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Sku = new PostgreSqlFlexibleServerSku("Standard_D4ds_v5", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
{
UserAssignedIdentities =
{
["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"] = new UserAssignedIdentity()
},
},
AdministratorLogin = "exampleadministratorlogin",
AdministratorLoginPassword = "examplepassword",
Version = PostgreSqlFlexibleServerVersion.Seventeen,
Storage = new PostgreSqlFlexibleServerStorage
{
StorageSizeInGB = 512,
AutoGrow = StorageAutoGrow.Disabled,
Tier = PostgreSqlManagedDiskPerformanceTier.P20,
},
DataEncryption = new PostgreSqlFlexibleServerDataEncryption
{
PrimaryKeyUri = new Uri("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
GeoBackupKeyUri = new Uri(""),
GeoBackupUserAssignedIdentityId = "",
KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
},
Backup = new PostgreSqlFlexibleServerBackupProperties
{
BackupRetentionDays = 7,
GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Disabled,
},
Network = new PostgreSqlFlexibleServerNetwork
{
DelegatedSubnetResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDnsZoneArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"),
},
HighAvailability = new PostgreSqlFlexibleServerHighAvailability
{
Mode = PostgreSqlFlexibleServerHighAvailabilityMode.ZoneRedundant,
},
AvailabilityZone = "1",
CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a new server with Microsoft Entra authentication enabled in your own virtual network and without high availability.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"
},
"availabilityZone": "1",
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"createMode": "Create",
"dataEncryption": {
"type": "SystemManaged"
},
"highAvailability": {
"mode": "Disabled"
},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"
},
"storage": {
"autoGrow": "Disabled",
"storageSizeGB": 512,
"tier": "P20"
},
"version": "17"
},
"sku": {
"name": "Standard_D4ds_v5",
"tier": "GeneralPurpose"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfig;
import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption;
import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryptionType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.GeographicallyRedundantBackup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability;
import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.MicrosoftEntraAuth;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Network;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PasswordBasedAuth;
import com.azure.resourcemanager.postgresqlflexibleserver.models.PostgresMajorVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
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 CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json
*/
/**
* Sample code: Create a new server with Microsoft Entra authentication enabled in your own virtual network and
* without high availability.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void
createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withSku(new Sku().withName("Standard_D4ds_v5").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLogin("exampleadministratorlogin").withAdministratorLoginPassword("examplepassword")
.withVersion(PostgresMajorVersion.ONE_SEVEN)
.withStorage(new Storage().withStorageSizeGB(512).withAutoGrow(StorageAutoGrow.DISABLED)
.withTier(AzureManagedDiskPerformanceTier.P20))
.withAuthConfig(new AuthConfig().withActiveDirectoryAuth(MicrosoftEntraAuth.ENABLED)
.withPasswordAuth(PasswordBasedAuth.ENABLED).withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt"))
.withDataEncryption(new DataEncryption().withType(DataEncryptionType.SYSTEM_MANAGED))
.withBackup(
new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeographicallyRedundantBackup.DISABLED))
.withNetwork(new Network().withDelegatedSubnetResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet")
.withPrivateDnsZoneArmResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"))
.withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.fromString("Disabled")))
.withAvailabilityZone("1").withCreateMode(CreateMode.CREATE).create();
}
// 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_create_with_microsoft_entra_enabled_in_your_own_virtual_network_without_high_availability.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_create_or_update(
resource_group_name="exampleresourcegroup",
server_name="exampleserver",
parameters={
"location": "eastus",
"properties": {
"administratorLogin": "exampleadministratorlogin",
"administratorLoginPassword": "examplepassword",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt",
},
"availabilityZone": "1",
"backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"},
"createMode": "Create",
"dataEncryption": {"type": "SystemManaged"},
"highAvailability": {"mode": "Disabled"},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com",
},
"storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"},
"version": "17",
},
"sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json
func ExampleServersClient_BeginCreateOrUpdate_createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("exampleadministratorlogin"),
AdministratorLoginPassword: to.Ptr("examplepassword"),
AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.MicrosoftEntraAuthEnabled),
PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordBasedAuthEnabled),
TenantID: to.Ptr("tttttt-tttt-tttt-tttt-tttttttttttt"),
},
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeographicallyRedundantBackupDisabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeSystemManaged),
},
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityMode("Disabled")),
},
Network: &armpostgresqlflexibleservers.Network{
DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"),
},
Storage: &armpostgresqlflexibleservers.Storage{
AutoGrow: to.Ptr(armpostgresqlflexibleservers.StorageAutoGrowDisabled),
StorageSizeGB: to.Ptr[int32](512),
Tier: to.Ptr(armpostgresqlflexibleservers.AzureManagedDiskPerformanceTierP20),
},
Version: to.Ptr(armpostgresqlflexibleservers.PostgresMajorVersionSeventeen),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4ds_v5"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json
*/
async function createANewServerWithMicrosoftEntraAuthenticationEnabledInYourOwnVirtualNetworkAndWithoutHighAvailability() {
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 = {
administratorLogin: "exampleadministratorlogin",
administratorLoginPassword: "examplepassword",
authConfig: {
activeDirectoryAuth: "Enabled",
passwordAuth: "Enabled",
tenantId: "tttttt-tttt-tttt-tttt-tttttttttttt",
},
availabilityZone: "1",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" },
createMode: "Create",
dataEncryption: { type: "SystemManaged" },
highAvailability: { mode: "Disabled" },
location: "eastus",
network: {
delegatedSubnetResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet",
privateDnsZoneArmResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com",
},
sku: { name: "Standard_D4ds_v5", tier: "GeneralPurpose" },
storage: { autoGrow: "Disabled", storageSizeGB: 512, tier: "P20" },
version: "17",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Sku = new PostgreSqlFlexibleServerSku("Standard_D4ds_v5", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
AdministratorLogin = "exampleadministratorlogin",
AdministratorLoginPassword = "examplepassword",
Version = PostgreSqlFlexibleServerVersion.Seventeen,
Storage = new PostgreSqlFlexibleServerStorage
{
StorageSizeInGB = 512,
AutoGrow = StorageAutoGrow.Disabled,
Tier = PostgreSqlManagedDiskPerformanceTier.P20,
},
AuthConfig = new PostgreSqlFlexibleServerAuthConfig
{
ActiveDirectoryAuth = PostgreSqlFlexibleServerActiveDirectoryAuthEnum.Enabled,
PasswordAuth = PostgreSqlFlexibleServerPasswordAuthEnum.Enabled,
TenantId = Guid.Parse("tttttt-tttt-tttt-tttt-tttttttttttt"),
},
DataEncryption = new PostgreSqlFlexibleServerDataEncryption
{
KeyType = PostgreSqlFlexibleServerKeyType.SystemManaged,
},
Backup = new PostgreSqlFlexibleServerBackupProperties
{
BackupRetentionDays = 7,
GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Disabled,
},
Network = new PostgreSqlFlexibleServerNetwork
{
DelegatedSubnetResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet"),
PrivateDnsZoneArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com"),
},
HighAvailability = new PostgreSqlFlexibleServerHighAvailability
{
Mode = PostgreSqlFlexibleServerHighAvailabilityMode.Disabled,
},
AvailabilityZone = "1",
CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Create a read replica of an existing server.
Beispielanforderung
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampleserver?api-version=2025-08-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}
}
},
"location": "eastus",
"properties": {
"createMode": "Replica",
"dataEncryption": {
"type": "AzureKeyVault",
"geoBackupKeyURI": "",
"geoBackupUserAssignedIdentityId": "",
"primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"
},
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
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.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Servers CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/
* ServersCreateReplica.json
*/
/**
* Sample code: Create a read replica of an existing server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createAReadReplicaOfAnExistingServer(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().define("exampleserver").withRegion("eastus").withExistingResourceGroup("exampleresourcegroup")
.withIdentity(new UserAssignedIdentity().withUserAssignedIdentities(mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity",
new UserIdentity())).withType(IdentityType.USER_ASSIGNED))
.withDataEncryption(new DataEncryption().withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity")
.withGeoBackupKeyUri("fakeTokenPlaceholder").withGeoBackupUserAssignedIdentityId("")
.withType(DataEncryptionType.AZURE_KEY_VAULT))
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver")
.withPointInTimeUtc(OffsetDateTime.parse("2025-06-01T18:35:22.123456Z")).withCreateMode(CreateMode.REPLICA)
.create();
}
// 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_create_replica.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_create_or_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/exampleprimaryidentity": {}
},
},
"location": "eastus",
"properties": {
"createMode": "Replica",
"dataEncryption": {
"geoBackupKeyURI": "",
"geoBackupUserAssignedIdentityId": "",
"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",
},
"pointInTimeUTC": "2025-06-01T18:35:22.123456Z",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e96c24570a484cff13d153fb472f812878866a39/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json
func ExampleServersClient_BeginCreateOrUpdate_createAReadReplicaOfAnExistingServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "exampleresourcegroup", "exampleserver", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {},
},
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeReplica),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr(""),
GeoBackupUserAssignedIdentityID: to.Ptr(""),
PrimaryKeyURI: to.Ptr("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
},
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-06-01T18:35:22.123Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates a new server.
*
* @summary Creates a new server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json
*/
async function createAReadReplicaOfAnExistingServer() {
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: "Replica",
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI: "",
geoBackupUserAssignedIdentityId: "",
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/exampleprimaryidentity":
{},
},
},
location: "eastus",
pointInTimeUTC: new Date("2025-06-01T18:35:22.123456Z"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateOrUpdateAndWait(
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql.FlexibleServers;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json
// this example is just showing the usage of "Servers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://dotnet.territoriali.olinfo.it/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "exampleresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlFlexibleServerResource
PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
// invoke the operation
string serverName = "exampleserver";
PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
{
Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
{
UserAssignedIdentities =
{
["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"] = new UserAssignedIdentity()
},
},
DataEncryption = new PostgreSqlFlexibleServerDataEncryption
{
PrimaryKeyUri = new Uri("https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity"),
GeoBackupKeyUri = new Uri(""),
GeoBackupUserAssignedIdentityId = "",
KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
},
SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver"),
PointInTimeUtc = DateTimeOffset.Parse("2025-06-01T18:35:22.123456Z"),
CreateMode = PostgreSqlFlexibleServerCreateMode.Replica,
};
ArmOperation<PostgreSqlFlexibleServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
PostgreSqlFlexibleServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlFlexibleServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
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
Definitionen
| Name |
Beschreibung |
|
AuthConfig
|
Authentifizierungskonfigurationseigenschaften eines Servers.
|
|
AzureManagedDiskPerformanceTier
|
Speicherebene eines Servers.
|
|
Backup
|
Sicherungseigenschaften eines Servers.
|
|
Cluster
|
Clustereigenschaften eines Servers.
|
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
|
CreateMode
|
Erstellungsmodus eines neuen Servers.
|
|
DataEncryption
|
Datenverschlüsselungseigenschaften eines Servers.
|
|
DataEncryptionType
|
Datenverschlüsselungstyp, der von einem Server verwendet wird.
|
|
EncryptionKeyStatus
|
Status des Schlüssels, der von einem Server verwendet wird, der mit einer Datenverschlüsselung auf der Grundlage eines vom Kunden verwalteten Schlüssels konfiguriert ist, um den primären Speicher zu verschlüsseln, der dem Server zugeordnet ist.
|
|
ErrorAdditionalInfo
|
Der Ressourcenverwaltungsfehler zusätzliche Informationen.
|
|
ErrorDetail
|
Das Fehlerdetails.
|
|
ErrorResponse
|
Fehlerantwort
|
|
GeographicallyRedundantBackup
|
Gibt an, ob der Server so konfiguriert ist, dass geografisch redundante Sicherungen erstellt werden.
|
|
HighAvailability
|
Eigenschaften mit hoher Verfügbarkeit eines Servers.
|
|
HighAvailabilityState
|
Mögliche Zustände des Standbyservers, der erstellt wird, wenn Hochverfügbarkeit auf SameZone oder ZoneRedundant festgelegt ist.
|
|
IdentityType
|
Arten von Identitäten, die einem Server zugeordnet sind.
|
|
MaintenanceWindow
|
Wartungsfenstereigenschaften eines Servers.
|
|
MicrosoftEntraAuth
|
Zeigt an, ob der Server Microsoft Entra-Authentifizierung unterstützt.
|
|
Network
|
Netzwerkeigenschaften eines Servers.
|
|
PasswordBasedAuth
|
Gibt an, ob der Server die kennwortbasierte Authentifizierung unterstützt.
|
|
PostgresMajorVersion
|
Hauptversion der PostgreSQL-Datenbank-Engine.
|
|
PostgreSqlFlexibleServerHighAvailabilityMode
|
Modus der hohen Verfügbarkeit wird für diese Berechnung unterstützt.
|
|
PrivateEndpoint
|
Die private Endpunktressource.
|
|
PrivateEndpointConnection
|
Die private Endpunktverbindungsressource.
|
|
PrivateEndpointConnectionProvisioningState
|
Der aktuelle Bereitstellungsstatus.
|
|
PrivateEndpointServiceConnectionStatus
|
Der Status der privaten Endpunktverbindung.
|
|
PrivateLinkServiceConnectionState
|
Eine Sammlung von Informationen über den Status der Verbindung zwischen Service Consumer und Provider.
|
|
ReadReplicaPromoteMode
|
Typ des Vorgangs, der auf das Read Replica angewendet werden soll. Diese Eigenschaft ist schreibgeschützt.
|
|
ReadReplicaPromoteOption
|
Datensynchronisierungsoption, die beim Verarbeiten des in der promoteMode-Eigenschaft angegebenen Vorgangs verwendet werden soll. Diese Eigenschaft ist schreibgeschützt.
|
|
Replica
|
Replikateigenschaften eines Servers.
|
|
ReplicationRole
|
Rolle des Servers in einer Replikationsgruppe.
|
|
ReplicationState
|
Gibt den Replikationsstatus einer Read Replica an. Diese Eigenschaft wird nur zurückgegeben, wenn es sich bei dem Zielserver um ein Lesereplikat handelt.
|
|
Server
|
Eigenschaften eines Servers.
|
|
ServerPublicNetworkAccessState
|
Gibt an, ob der Zugriff auf öffentliche Netzwerke aktiviert ist oder nicht.
|
|
ServerState
|
Zustand eines Servers.
|
|
Sku
|
Berechnen von Informationen eines Servers.
|
|
SkuTier
|
Ebene der Compute, die einem Server zugewiesen ist.
|
|
Storage
|
Speichereigenschaften eines Servers.
|
|
StorageAutoGrow
|
Zeigt an, ob der Server so konfiguriert ist, dass er automatisch die Speichergröße vergrößert, wenn der verfügbare Speicherplatz nahe an null ist und die Bedingungen ein automatisches Wachsen der Speichergröße erlauben.
|
|
StorageType
|
Typ des Speichers, der einem Server zugewiesen ist. Wenn nicht angegeben, wird standardmäßig Premium_LRS verwendet.
|
|
systemData
|
Metadaten zur Erstellung und letzten Änderung der Ressource.
|
|
UserAssignedIdentity
|
Identitäten, die einem Server zugeordnet sind.
|
|
UserIdentity
|
Benutzerseitig zugewiesene verwaltete Identität, die einem Server zugeordnet ist.
|
AuthConfig
Objekt
Authentifizierungskonfigurationseigenschaften eines Servers.
| Name |
Typ |
Standardwert |
Beschreibung |
|
activeDirectoryAuth
|
MicrosoftEntraAuth
|
|
Zeigt an, ob der Server Microsoft Entra-Authentifizierung unterstützt.
|
|
passwordAuth
|
PasswordBasedAuth
|
Enabled
|
Gibt an, ob der Server die kennwortbasierte Authentifizierung unterstützt.
|
|
tenantId
|
string
|
|
Bezeichner des Mandanten der delegierten Ressource.
|
Enumeration
Speicherebene eines Servers.
| Wert |
Beschreibung |
|
P1
|
SSD der Einstiegsklasse für minimale IOPS, ideal für leichte Entwicklungs- oder Test-Workloads.
|
|
P2
|
Etwas höhere IOPS für kleine Anwendungen, die eine gleichbleibend niedrige Latenz erfordern.
|
|
P3
|
Ausgewogene Leistung für grundlegende Produktionsworkloads mit moderatem Durchsatz.
|
|
P4
|
Verbesserte IOPS für wachsende Anwendungen mit vorhersehbaren Leistungsanforderungen.
|
|
P6
|
Mid-Tier-SSD für stetige Workloads, die zuverlässigen Durchsatz und Latenz erfordern.
|
|
P10
|
Beliebte Wahl für allgemeine Produktions-Workloads mit skalierbarer Leistung.
|
|
P15
|
Hohe IOPS-Stufe für anspruchsvolle Apps mit häufigen Lese-/Schreibvorgängen.
|
|
P20
|
Einstiegspunkt für Hochleistungs-Solid-State-Disks (SSDs), die sich für kleine I/O-intensive Workloads eignen.
|
|
P30
|
Ausgewogene Ebene für Anwendungen mit moderatem Durchsatz und Latenzempfindlichkeit.
|
|
P40
|
Verbesserte Leistung für wachsende Produktions-Workloads mit konsistenten IOPS-Anforderungen.
|
|
P50
|
Optimiert für Anwendungen der Enterprise-Klasse, die einen dauerhaft hohen Durchsatz erfordern.
|
|
P60
|
Tarif mit hoher Kapazität für große Datenbanken und Analyse-Workloads mit erhöhten IOPS.
|
|
P70
|
Entwickelt für geschäftskritische Systeme, die eine extrem niedrige Latenz und hohe Parallelität erfordern.
|
|
P80
|
Erstklassige SSD für maximale IOPS und Durchsatz, ideal für die anspruchsvollsten Workloads.
|
Backup
Objekt
Sicherungseigenschaften eines Servers.
| Name |
Typ |
Standardwert |
Beschreibung |
|
backupRetentionDays
|
integer
(int32)
|
7
|
Sicherungsaufbewahrungstage für den Server.
|
|
earliestRestoreDate
|
string
(date-time)
|
|
Frühester Zeitpunkt der Wiederherstellung (ISO8601 Format) für einen Server.
|
|
geoRedundantBackup
|
GeographicallyRedundantBackup
|
Disabled
|
Gibt an, ob der Server so konfiguriert ist, dass geografisch redundante Sicherungen erstellt werden.
|
Cluster
Objekt
Clustereigenschaften eines Servers.
| Name |
Typ |
Standardwert |
Beschreibung |
|
clusterSize
|
integer
(int32)
|
0
|
Anzahl der Knoten, die dem elastischen Cluster zugewiesen sind.
|
|
defaultDatabaseName
|
string
|
|
Standarddatenbankname für den elastischen Cluster.
|
createdByType
Enumeration
Der Identitätstyp, der die Ressource erstellt hat.
| Wert |
Beschreibung |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
CreateMode
Enumeration
Erstellungsmodus eines neuen Servers.
| Wert |
Beschreibung |
|
Default
|
Wenn der Vorgang auf einem nicht vorhandenen Server ausgelöst wird, entspricht er "Create". Wenn der Vorgang auf einem vorhandenen Server ausgelöst wird, entspricht er "Update".
|
|
Create
|
Mit dem Vorgang wird ein neuer Server erstellt.
|
|
Update
|
Der Vorgang aktualisiert einen vorhandenen Server.
|
|
PointInTimeRestore
|
Der Vorgang stellt eine vorhandene Sicherung eines vorhandenen Servers wieder her. Dieser Vorgang erstellt einen neuen Server und stellt dann die Sicherung eines vorhandenen Servers zu einem bestimmten Zeitpunkt wieder her.
|
|
GeoRestore
|
Der Vorgang stellt eine vorhandene Sicherung eines vorhandenen Servers in der gekoppelten Region des vorhandenen Servers wieder her. Dieser Vorgang erstellt einen neuen Server in der gekoppelten Region des vorhandenen Servers und stellt dann die Sicherung eines vorhandenen Servers zu einem bestimmten Zeitpunkt in einer anderen Region wieder her. Dieser Vorgang wird nur auf vorhandenen Servern unterstützt, die mit aktivierten geografisch redundanten Sicherungen erstellt wurden.
|
|
Replica
|
Mit dem Vorgang wird ein Replikat eines vorhandenen Servers erstellt. Bei diesem Vorgang wird ein neuer Server erstellt, eine Basissicherung des vorhandenen Servers (der als primärer Server bezeichnet wird) wiederhergestellt und die physische Replikation so konfiguriert, dass alle Änderungen, die im Transaktionsprotokoll des primären Servers aufgezeichnet werden, asynchron gestreamt werden.
|
|
ReviveDropped
|
Der Vorgang erstellt einen neuen Server, der mit der Sicherung eines Servers initialisiert wird, der kürzlich gelöscht wurde.
|
DataEncryption
Objekt
Datenverschlüsselungseigenschaften eines Servers.
| Name |
Typ |
Beschreibung |
|
geoBackupEncryptionKeyStatus
|
EncryptionKeyStatus
|
Status des Schlüssels, der von einem Server verwendet wird, der mit Datenverschlüsselung basierend auf einem vom Kunden verwalteten Schlüssel konfiguriert ist, um den geografisch redundanten Speicher zu verschlüsseln, der dem Server zugeordnet ist, wenn er für die Unterstützung geografisch redundanter Sicherungen konfiguriert ist.
|
|
geoBackupKeyURI
|
string
|
Identifikator der vom Benutzer zugewiesenen verwalteten Identität, die verwendet wird, um auf den Schlüssel in Azure Key Vault zuzugreifen, um die Datenverschlüsselung des geografisch redundanten Speichers zu erhalten, der mit einem Server verbunden ist, der für geografisch redundante Backups konfiguriert ist.
|
|
geoBackupUserAssignedIdentityId
|
string
|
Identifikator der vom Benutzer zugewiesenen verwalteten Identität, die verwendet wird, um auf den Schlüssel in Azure Key Vault zuzugreifen, um die Datenverschlüsselung des geografisch redundanten Speichers zu erhalten, der mit einem Server verbunden ist, der für geografisch redundante Backups konfiguriert ist.
|
|
primaryEncryptionKeyStatus
|
EncryptionKeyStatus
|
Status des Schlüssels, der von einem Server verwendet wird, der mit einer Datenverschlüsselung auf der Grundlage eines vom Kunden verwalteten Schlüssels konfiguriert ist, um den primären Speicher zu verschlüsseln, der dem Server zugeordnet ist.
|
|
primaryKeyURI
|
string
|
URI des Schlüssels in Azure Key Vault, der zur Datenverschlüsselung des mit einem Server verbundenen Primärspeichers verwendet wird.
|
|
primaryUserAssignedIdentityId
|
string
|
Identifikator der vom Benutzer zugewiesenen verwalteten Identität, die zum Zugriff auf den Schlüssel in Azure Key Vault zur Datenverschlüsselung des mit einem Server verbundenen Primärspeichers verwendet wird.
|
|
type
|
DataEncryptionType
|
Datenverschlüsselungstyp, der von einem Server verwendet wird.
|
DataEncryptionType
Enumeration
Datenverschlüsselungstyp, der von einem Server verwendet wird.
| Wert |
Beschreibung |
|
SystemManaged
|
Verschlüsselung wird von Azure mit plattformverwalteten Schlüsseln für Einfachheit und Einhaltung verwaltet.
|
|
AzureKeyVault
|
Verschlüsselung mit kundenverwalteten Schlüsseln, die in Azure Key Vault gespeichert sind, für verbesserte Kontrolle und Sicherheit.
|
EncryptionKeyStatus
Enumeration
Status des Schlüssels, der von einem Server verwendet wird, der mit einer Datenverschlüsselung auf der Grundlage eines vom Kunden verwalteten Schlüssels konfiguriert ist, um den primären Speicher zu verschlüsseln, der dem Server zugeordnet ist.
| Wert |
Beschreibung |
|
Valid
|
Der Schlüssel ist gültig und kann zur Verschlüsselung verwendet werden.
|
|
Invalid
|
Der Schlüssel ist ungültig und kann nicht für die Verschlüsselung verwendet werden. Mögliche Ursachen sind das Löschen von Schlüsseln, Berechtigungsänderungen, die Deaktivierung des Schlüssels, der nicht unterstützte Schlüsseltyp oder das aktuelle Datum, das außerhalb des mit dem Schlüssel verknüpften Gültigkeitszeitraums liegt.
|
ErrorAdditionalInfo
Objekt
Der Ressourcenverwaltungsfehler zusätzliche Informationen.
| Name |
Typ |
Beschreibung |
|
info
|
object
|
Die zusätzlichen Informationen.
|
|
type
|
string
|
Der zusätzliche Informationstyp.
|
ErrorDetail
Objekt
Das Fehlerdetails.
| Name |
Typ |
Beschreibung |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Die zusätzlichen Informationen des Fehlers.
|
|
code
|
string
|
Der Fehlercode.
|
|
details
|
ErrorDetail[]
|
Die Fehlerdetails.
|
|
message
|
string
|
Die Fehlermeldung.
|
|
target
|
string
|
Das Fehlerziel.
|
ErrorResponse
Objekt
Fehlerantwort
| Name |
Typ |
Beschreibung |
|
error
|
ErrorDetail
|
Das Fehlerobjekt.
|
GeographicallyRedundantBackup
Enumeration
Gibt an, ob der Server so konfiguriert ist, dass geografisch redundante Sicherungen erstellt werden.
| Wert |
Beschreibung |
|
Enabled
|
Der Server ist so konfiguriert, dass geografisch redundante Sicherungen erstellt werden.
|
|
Disabled
|
Der Server ist nicht so konfiguriert, dass geografisch redundante Sicherungen erstellt werden.
|
HighAvailability
Objekt
Eigenschaften mit hoher Verfügbarkeit eines Servers.
| Name |
Typ |
Standardwert |
Beschreibung |
|
mode
|
PostgreSqlFlexibleServerHighAvailabilityMode
|
Disabled
|
Hochverfügbarkeitsmodus für einen Server.
|
|
standbyAvailabilityZone
|
string
|
|
Verfügbarkeitszone, die dem Standbyserver zugeordnet ist, der erstellt wurde, wenn Hochverfügbarkeit auf SameZone oder ZoneRedundant festgelegt ist.
|
|
state
|
HighAvailabilityState
|
|
Mögliche Zustände des Standbyservers, der erstellt wird, wenn Hochverfügbarkeit auf SameZone oder ZoneRedundant festgelegt ist.
|
HighAvailabilityState
Enumeration
Mögliche Zustände des Standbyservers, der erstellt wird, wenn Hochverfügbarkeit auf SameZone oder ZoneRedundant festgelegt ist.
| Wert |
Beschreibung |
|
NotEnabled
|
Die Hochverfügbarkeit ist für den Server nicht aktiviert.
|
|
CreatingStandby
|
Der Standby-Server wird erstellt.
|
|
ReplicatingData
|
Die Daten werden auf den Standby-Server repliziert.
|
|
FailingOver
|
Der Failovervorgang zum Standbyserver wird ausgeführt.
|
|
Healthy
|
Der Standbyserver ist fehlerfrei und kann im Falle eines Failovers übernommen werden.
|
|
RemovingStandby
|
Der Standby-Server wird entfernt.
|
|
RecreatingStandby
|
Der Standby-Server wird neu erstellt.
|
|
ComputeUpdatingByFailover
|
Der Compute wird aufgrund eines Failovers aktualisiert.
|
IdentityType
Enumeration
Arten von Identitäten, die einem Server zugeordnet sind.
| Wert |
Beschreibung |
|
None
|
Dem Server ist keine verwaltete Identität zugewiesen.
|
|
UserAssigned
|
Dem Server werden eine oder mehrere verwaltete Identitäten zugewiesen, die vom Benutzer bereitgestellt werden.
|
|
SystemAssigned
|
Azure erstellt und verwaltet automatisch die Identität, die mit dem Lebenszyklus des Servers verknüpft ist.
|
|
SystemAssigned,UserAssigned
|
Dem Server werden sowohl systemseitig als auch benutzerseitig zugewiesene Identitäten zugewiesen.
|
MaintenanceWindow
Objekt
Wartungsfenstereigenschaften eines Servers.
| Name |
Typ |
Standardwert |
Beschreibung |
|
customWindow
|
string
|
Disabled
|
Gibt an, ob das benutzerdefinierte Fenster aktiviert oder deaktiviert ist.
|
|
dayOfWeek
|
integer
(int32)
|
0
|
Wochentag, der für das Wartungsfenster verwendet werden soll.
|
|
startHour
|
integer
(int32)
|
0
|
Startstunde, die für das Wartungsfenster verwendet werden soll.
|
|
startMinute
|
integer
(int32)
|
0
|
Startminute, die für das Wartungsfenster verwendet werden soll.
|
MicrosoftEntraAuth
Enumeration
Zeigt an, ob der Server Microsoft Entra-Authentifizierung unterstützt.
| Wert |
Beschreibung |
|
Enabled
|
Der Server unterstützt Microsoft Entra-Authentifizierung.
|
|
Disabled
|
Der Server unterstützt keine Microsoft Entra-Authentifizierung.
|
Network
Objekt
Netzwerkeigenschaften eines Servers.
| Name |
Typ |
Beschreibung |
|
delegatedSubnetResourceId
|
string
(arm-id)
|
Ressourcen-ID des delegierten Subnetzes. Erforderlich bei der Erstellung eines neuen Servers, falls der Server in Ihr eigenes virtuelles Netzwerk integriert werden soll. Für einen Aktualisierungsvorgang müssen Sie diese Eigenschaft nur angeben, wenn Sie den für die private DNS-Zone zugewiesenen Wert ändern möchten.
|
|
privateDnsZoneArmResourceId
|
string
(arm-id)
|
Kennung der privaten DNS-Zone. Erforderlich bei der Erstellung eines neuen Servers, falls der Server in Ihr eigenes virtuelles Netzwerk integriert werden soll. Für einen Aktualisierungsvorgang müssen Sie diese Eigenschaft nur angeben, wenn Sie den für die private DNS-Zone zugewiesenen Wert ändern möchten.
|
|
publicNetworkAccess
|
ServerPublicNetworkAccessState
|
Gibt an, ob der Zugriff auf öffentliche Netzwerke aktiviert ist oder nicht. Dies wird nur für Server unterstützt, die nicht in ein virtuelles Netzwerk integriert sind, das sich im Besitz des Kunden befindet und von ihm bereitgestellt wird, wenn der Server bereitgestellt wird.
|
PasswordBasedAuth
Enumeration
Gibt an, ob der Server die kennwortbasierte Authentifizierung unterstützt.
| Wert |
Beschreibung |
|
Enabled
|
Der Server unterstützt die kennwortbasierte Authentifizierung.
|
|
Disabled
|
Der Server unterstützt keine passwortbasierte Authentifizierung.
|
PostgresMajorVersion
Enumeration
Hauptversion der PostgreSQL-Datenbank-Engine.
| Wert |
Beschreibung |
|
18
|
PostgreSQL 18.
|
|
17
|
PostgreSQL 17.
|
|
16
|
PostgreSQL 16.
|
|
15
|
PostgreSQL 15.
|
|
14
|
PostgreSQL 14.
|
|
13
|
PostgreSQL 13.
|
|
12
|
PostgreSQL 12.
|
|
11
|
PostgreSQL 11.
|
PostgreSqlFlexibleServerHighAvailabilityMode
Enumeration
Modus der hohen Verfügbarkeit wird für diese Berechnung unterstützt.
| Wert |
Beschreibung |
|
Disabled
|
Die Hochverfügbarkeit ist für den Server deaktiviert.
|
|
ZoneRedundant
|
Hochverfügbarkeit ist für den Server aktiviert, wobei sich der Standbyserver in einer anderen Verfügbarkeitszone als der des primären Server befindet.
|
|
SameZone
|
Hochverfügbarkeit ist für den Server aktiviert, wobei sich der Standbyserver in derselben Verfügbarkeitszone wie der primäre Server befindet.
|
PrivateEndpoint
Objekt
Die private Endpunktressource.
| Name |
Typ |
Beschreibung |
|
id
|
string
|
Der ARM-Bezeichner für privaten Endpunkt.
|
PrivateEndpointConnection
Objekt
Die private Endpunktverbindungsressource.
| Name |
Typ |
Beschreibung |
|
id
|
string
(arm-id)
|
Vollqualifizierte Ressourcen-ID für die Ressource. Z. B. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
name
|
string
|
Der Name der Ressource
|
|
properties.groupIds
|
string[]
|
Die Gruppen-IDs für die private Endpunktressource.
|
|
properties.privateEndpoint
|
PrivateEndpoint
|
Die private Endpunktressource.
|
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
Eine Sammlung von Informationen über den Status der Verbindung zwischen Service Consumer und Provider.
|
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
Der Bereitstellungsstatus der privaten Endpunktverbindungsressource.
|
|
systemData
|
systemData
|
Azure Resource Manager-Metadaten, die createdBy und modifiedBy-Informationen enthalten.
|
|
type
|
string
|
Der Typ der Ressource. Zum Beispiel "Microsoft. Compute/virtualMachines" oder "Microsoft. Speicher/Speicherkonten"
|
PrivateEndpointConnectionProvisioningState
Enumeration
Der aktuelle Bereitstellungsstatus.
| Wert |
Beschreibung |
|
Succeeded
|
|
|
Creating
|
|
|
Deleting
|
|
|
Failed
|
|
PrivateEndpointServiceConnectionStatus
Enumeration
Der Status der privaten Endpunktverbindung.
| Wert |
Beschreibung |
|
Pending
|
|
|
Approved
|
|
|
Rejected
|
|
PrivateLinkServiceConnectionState
Objekt
Eine Sammlung von Informationen über den Status der Verbindung zwischen Service Consumer und Provider.
| Name |
Typ |
Beschreibung |
|
actionsRequired
|
string
|
Eine Meldung, die angibt, ob Änderungen am Dienstanbieter Updates für den Verbraucher erfordern.
|
|
description
|
string
|
Der Grund für die Genehmigung/Ablehnung der Verbindung.
|
|
status
|
PrivateEndpointServiceConnectionStatus
|
Gibt an, ob die Verbindung vom Besitzer des Diensts genehmigt/abgelehnt/entfernt wurde.
|
Enumeration
Typ des Vorgangs, der auf das Read Replica angewendet werden soll. Diese Eigenschaft ist schreibgeschützt.
| Wert |
Beschreibung |
|
Standalone
|
Read Replica wird zu einem unabhängigen Server und zu einer völlig unabhängigen Entität vom Replikationsset.
|
|
Switchover
|
Das Read Replica tauscht die Rollen mit dem primären Server.
|
Enumeration
Datensynchronisierungsoption, die beim Verarbeiten des in der promoteMode-Eigenschaft angegebenen Vorgangs verwendet werden soll. Diese Eigenschaft ist schreibgeschützt.
| Wert |
Beschreibung |
|
Planned
|
Warten Sie, bis die Daten im Lesereplikat vollständig mit dem Quellserver synchronisiert sind, bevor die Operation gestartet wird.
|
|
Forced
|
Starte die Operation sofort, ohne darauf zu warten, dass die Daten im Lesereplikat mit dem Quellserver synchronisiert sind.
|
Replica
Objekt
Replikateigenschaften eines Servers.
| Name |
Typ |
Beschreibung |
|
capacity
|
integer
(int32)
|
Maximale Anzahl von Read Replicas, die für einen Server zulässig sind.
|
|
promoteMode
|
ReadReplicaPromoteMode
|
Typ des Vorgangs, der auf das Read Replica angewendet werden soll. Diese Eigenschaft ist schreibgeschützt. Eigenständig bedeutet, dass das Lesereplikat zu einem eigenständigen Server heraufgestuft wird und zu einer vollständig unabhängigen Entität vom Replikationssatz wird. Switchover bedeutet, dass das Lesereplikat Rollen mit dem primären Server übernimmt.
|
|
promoteOption
|
ReadReplicaPromoteOption
|
Datensynchronisierungsoption, die beim Verarbeiten des in der promoteMode-Eigenschaft angegebenen Vorgangs verwendet werden soll. Diese Eigenschaft ist schreibgeschützt.
|
|
replicationState
|
ReplicationState
|
Gibt den Replikationsstatus einer Read Replica an. Diese Eigenschaft wird nur zurückgegeben, wenn es sich bei dem Zielserver um ein Lesereplikat handelt. Mögliche Werte sind "Active", "Broken", "Catchup", "Provisioning", "Reconfiguring" und "Updated".
|
|
role
|
ReplicationRole
|
Rolle des Servers in einer Replikationsgruppe.
|
ReplicationRole
Enumeration
Rolle des Servers in einer Replikationsgruppe.
| Wert |
Beschreibung |
|
None
|
Es ist keine Replikationsrolle zugewiesen. Der Server arbeitet unabhängig.
|
|
Primary
|
Fungiert als Quellserver für die Replikation auf ein oder mehrere Replikate.
|
|
AsyncReplica
|
Empfängt Daten asynchron von einem primären Server in derselben Region.
|
|
GeoAsyncReplica
|
Empfängt Daten asynchron von einem primären Server in einer anderen Region, um geografische Redundanz zu gewährleisten.
|
ReplicationState
Enumeration
Gibt den Replikationsstatus einer Read Replica an. Diese Eigenschaft wird nur zurückgegeben, wenn es sich bei dem Zielserver um ein Lesereplikat handelt.
| Wert |
Beschreibung |
|
Active
|
Der Read Replica-Server ist vollständig synchronisiert und repliziert aktiv Daten vom Primärserver.
|
|
Catchup
|
Der Read-Replica-Server liegt hinter dem Hauptserver und holt derzeit mit ausstehenden Änderungen auf.
|
|
Provisioning
|
Der Read-Replica-Server wird gerade erstellt und wird gerade initialisiert.
|
|
Updating
|
Der Read-Replica-Server durchläuft einige Änderungen, es kann sein, dass sich die Rechengröße ändert oder er auf den Primärserver befördert wird.
|
|
Broken
|
Die Replikation ist fehlgeschlagen oder wurde unterbrochen.
|
|
Reconfiguring
|
Der Read-Replica-Server wird neu konfiguriert, möglicherweise aufgrund von Quell- oder Einstellungsänderungen.
|
Server
Objekt
Eigenschaften eines Servers.
| Name |
Typ |
Beschreibung |
|
id
|
string
(arm-id)
|
Vollqualifizierte Ressourcen-ID für die Ressource. Z. B. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
identity
|
UserAssignedIdentity
|
Benutzerseitig zugewiesene verwaltete Identitäten, die dem Server zugewiesen sind.
|
|
location
|
string
|
Der geografische Standort, an dem sich die Ressource befindet
|
|
name
|
string
|
Der Name der Ressource
|
|
properties.administratorLogin
|
string
|
Name des Anmeldenamens, der als erster kennwortbasierter Administrator festgelegt ist, der Ihrer PostgreSQL-Instanz zugewiesen ist. Muss angegeben werden, wenn Sie die kennwortbasierte Authentifizierung zum ersten Mal auf einem Server aktivieren. Sobald er auf einen bestimmten Wert festgelegt ist, kann er für den Rest der Lebensdauer eines Servers nicht mehr geändert werden. Wenn Sie die kennwortbasierte Authentifizierung auf einem Server deaktivieren, auf dem sie aktiviert war, wird diese kennwortbasierte Rolle nicht gelöscht.
|
|
properties.administratorLoginPassword
|
string
(password)
|
Passwort, das dem Administrator-Login zugewiesen ist. Solange die Passwortauthentifizierung aktiviert ist, kann dieses Passwort jederzeit geändert werden.
|
|
properties.authConfig
|
AuthConfig
|
Authentifizierungskonfigurationseigenschaften eines Servers.
|
|
properties.availabilityZone
|
string
|
Verfügbarkeitszone eines Servers.
|
|
properties.backup
|
Backup
|
Sicherungseigenschaften eines Servers.
|
|
properties.cluster
|
Cluster
|
Clustereigenschaften eines Servers.
|
|
properties.createMode
|
CreateMode
|
Erstellungsmodus eines neuen Servers.
|
|
properties.dataEncryption
|
DataEncryption
|
Datenverschlüsselungseigenschaften eines Servers.
|
|
properties.fullyQualifiedDomainName
|
string
|
Vollständig qualifizierter Domänenname eines Servers.
|
|
properties.highAvailability
|
HighAvailability
|
Eigenschaften mit hoher Verfügbarkeit eines Servers.
|
|
properties.maintenanceWindow
|
MaintenanceWindow
|
Wartungsfenstereigenschaften eines Servers.
|
|
properties.minorVersion
|
string
|
Nebenversion der PostgreSQL-Datenbank-Engine.
|
|
properties.network
|
Network
|
Netzwerkeigenschaften eines Servers. Nur erforderlich, wenn der Server in ein vom Kunden bereitgestelltes virtuelles Netzwerk integriert werden soll.
|
|
properties.pointInTimeUTC
|
string
(date-time)
|
Erstellungszeit (in ISO8601 Format) der Sicherung, die Sie auf dem neuen Server wiederherstellen möchten. Dies ist erforderlich, wenn 'createMode' 'PointInTimeRestore', 'GeoRestore' oder 'ReviveDropped' ist.
|
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
Liste der Verbindungen mit privaten Endpunkten, die dem angegebenen Server zugeordnet sind.
|
|
properties.replica
|
Replica
|
Lesen Sie die Replikateigenschaften eines Servers. Nur erforderlich, wenn Sie einen Server heraufstufen möchten.
|
|
properties.replicaCapacity
|
integer
(int32)
|
Maximale Anzahl von Read Replicas, die für einen Server zulässig sind.
|
|
properties.replicationRole
|
ReplicationRole
|
Rolle des Servers in einer Replikationsgruppe.
|
|
properties.sourceServerResourceId
|
string
(arm-id)
|
Kennung des Servers, der als Quelle des neuen Servers verwendet werden soll. Erforderlich, wenn 'createMode' 'PointInTimeRestore', 'GeoRestore', 'Replica' oder 'ReviveDropped' ist. Diese Eigenschaft wird nur zurückgegeben, wenn es sich bei dem Zielserver um ein Lesereplikat handelt.
|
|
properties.state
|
ServerState
|
Mögliche Zustände eines Servers.
|
|
properties.storage
|
Storage
|
Speichereigenschaften eines Servers.
|
|
properties.version
|
PostgresMajorVersion
|
Hauptversion der PostgreSQL-Datenbank-Engine.
|
|
sku
|
Sku
|
Computeebene und -größe eines Servers.
|
|
systemData
|
systemData
|
Azure Resource Manager-Metadaten, die createdBy und modifiedBy-Informationen enthalten.
|
|
tags
|
object
|
Ressourcentags.
|
|
type
|
string
|
Der Typ der Ressource. Zum Beispiel "Microsoft. Compute/virtualMachines" oder "Microsoft. Speicher/Speicherkonten"
|
ServerPublicNetworkAccessState
Enumeration
Gibt an, ob der Zugriff auf öffentliche Netzwerke aktiviert ist oder nicht.
| Wert |
Beschreibung |
|
Enabled
|
Der Zugriff auf das öffentliche Netzwerk ist aktiviert. Auf diese Weise kann über das öffentliche Internet auf den Server zugegriffen werden, vorausgesetzt, die erforderliche Firewallregel ist vorhanden, die eingehenden Datenverkehr vom verbindenden Client zulässt. Dies ist kompatibel mit der Verwendung privater Endpunkte zum Herstellen einer Verbindung mit diesem Server.
|
|
Disabled
|
Öffentlicher Netzwerkzugriff ist deaktiviert. Das bedeutet, dass der Server nicht aus dem öffentlichen Internet erreichbar ist, sondern nur über private Endpunkte.
|
ServerState
Enumeration
Zustand eines Servers.
| Wert |
Beschreibung |
|
Ready
|
Der Server ist fehlerfrei und führt keine Vorgänge auf Verwaltungs- oder Steuerungsebene durch. Dies bedeutet nicht, dass der Server auf Datenebene voll funktionsfähig ist.
|
|
Dropping
|
Der Server wird gelöscht.
|
|
Disabled
|
Der Server ist deaktiviert. Typische Gründe sind: Das Abonnement, auf dem der Server bereitgestellt wird, wurde vom Administrator explizit deaktiviert oder gekündigt, das Ausgabenlimit wurde erreicht oder die Rechnung ist überfällig. Kann auch auftreten, wenn der Server in eine andere Ressourcengruppe oder ein anderes Abonnement verschoben wird.
|
|
Starting
|
Die PostgreSQL-Datenbank-Engine wird neu gestartet.
|
|
Stopping
|
Computeressourcen, die dem Server zugeordnet sind, werden gestoppt und die Zuordnung aufgehoben. Wenn auf dem Server Hochverfügbarkeit aktiviert ist, werden auch die Computeressourcen des Standbyservers gestoppt und die Zuordnung aufgehoben.
|
|
Stopped
|
Computeressourcen, die dem Server zugeordnet sind, werden gestoppt und die Zuordnung aufgehoben.
|
|
Updating
|
Der Server erfährt einige Änderungen, die sich auf die Verfügbarkeit der PostgreSQL-Datenbank-Engine auswirken können oder auch nicht. Beispielsweise werden die Computeressourcen des Servers nach oben oder unten skaliert, was dazu führen kann, dass die Datenbank-Engine vorübergehend nicht verfügbar ist. Oder es wird z. B. eine Firewallregel hinzugefügt oder entfernt, die nicht dazu führt, dass das Datenbankmodul nicht verfügbar ist.
|
|
Restarting
|
Die PostgreSQL-Datenbank-Engine wird neu gestartet.
|
|
Inaccessible
|
Auf den Server kann nicht zugegriffen werden, da sich der zum Verschlüsseln und Entschlüsseln der Daten bereitgestellte Schlüssel in einem ungültigen Zustand befindet.
|
|
Provisioning
|
Der Server wird gerade erstellt.
|
Sku
Objekt
Berechnen von Informationen eines Servers.
| Name |
Typ |
Beschreibung |
|
name
|
string
|
Name, unter dem eine bestimmte Computegröße bekannt ist, die einem Server zugewiesen ist.
|
|
tier
|
SkuTier
|
Ebene der Compute, die einem Server zugewiesen ist.
|
SkuTier
Enumeration
Ebene der Compute, die einem Server zugewiesen ist.
| Wert |
Beschreibung |
|
Burstable
|
Kostengünstiger Tarif für seltene CPU-Auslastung, ideal für Entwicklungs- und Test-Workloads mit geringen Leistungsanforderungen.
|
|
GeneralPurpose
|
Ausgewogene Rechenleistung und ausgewogener Arbeitsspeicher für die meisten Workloads mit skalierbarer Leistung und E/A-Durchsatz.
|
|
MemoryOptimized
|
Hohes Memory-to-Core-Verhältnis für anspruchsvolle Workloads, die eine schnelle In-Memory-Verarbeitung und hohe Parallelität erfordern.
|
Storage
Objekt
Speichereigenschaften eines Servers.
| Name |
Typ |
Beschreibung |
|
autoGrow
|
StorageAutoGrow
|
Flag zum Aktivieren oder Deaktivieren des automatischen Vergrößerns der Speichergröße eines Servers, wenn der verfügbare Speicherplatz nahe Null liegt und die Bedingungen das automatische Vergrößern der Speichergröße zulassen.
|
|
iops
|
integer
(int32)
|
Maximale IOPS-Unterstützung, die für den Speicher unterstützt wird. Erforderlich, wenn der Speichertyp PremiumV2_LRS oder UltraSSD_LRS ist.
|
|
storageSizeGB
|
integer
(int32)
|
Größe des Speichers, der einem Server zugewiesen ist.
|
|
throughput
|
integer
(int32)
|
Maximaler Durchsatz wird für den Speicher unterstützt. Erforderlich, wenn der Speichertyp PremiumV2_LRS oder UltraSSD_LRS ist.
|
|
tier
|
AzureManagedDiskPerformanceTier
|
Speicherebene eines Servers.
|
|
type
|
StorageType
|
Typ des Speichers, der einem Server zugewiesen ist. Zulässige Werte sind Premium_LRS, PremiumV2_LRS oder UltraSSD_LRS. Wenn nicht angegeben, wird standardmäßig Premium_LRS verwendet.
|
StorageAutoGrow
Enumeration
Zeigt an, ob der Server so konfiguriert ist, dass er automatisch die Speichergröße vergrößert, wenn der verfügbare Speicherplatz nahe an null ist und die Bedingungen ein automatisches Wachsen der Speichergröße erlauben.
| Wert |
Beschreibung |
|
Enabled
|
Der Server sollte die Speichergröße automatisch vergrößern, wenn der verfügbare Speicherplatz nahe Null liegt und die Bedingungen eine automatische Erhöhung der Speichergröße zulassen.
|
|
Disabled
|
Der Server sollte die Speichergröße nicht automatisch erhöhen, wenn der verfügbare Speicherplatz nahe Null liegt.
|
StorageType
Enumeration
Typ des Speichers, der einem Server zugewiesen ist. Wenn nicht angegeben, wird standardmäßig Premium_LRS verwendet.
| Wert |
Beschreibung |
|
Premium_LRS
|
Standardmäßiger SSD-gestützter Speicher (Solid State Disk) mit gleichbleibender Leistung für allgemeine Workloads.
|
|
PremiumV2_LRS
|
Solid State Disk (SSD)-Speicher der nächsten Generation mit verbesserter Skalierbarkeit und Leistung für anspruchsvolle Unternehmens-Workloads.
|
|
UltraSSD_LRS
|
High-End-Solid-State-Disk-Speicher (SSD), der für extreme IOPS und latenzempfindliche Anwendungen entwickelt wurde.
|
systemData
Objekt
Metadaten zur Erstellung und letzten Änderung der Ressource.
| Name |
Typ |
Beschreibung |
|
createdAt
|
string
(date-time)
|
Der Zeitstempel der Ressourcenerstellung (UTC).
|
|
createdBy
|
string
|
Die Identität, die die Ressource erstellt hat.
|
|
createdByType
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
|
lastModifiedAt
|
string
(date-time)
|
Der Zeitstempel der letzten Änderung der Ressource (UTC)
|
|
lastModifiedBy
|
string
|
Die Identität, die die Ressource zuletzt geändert hat.
|
|
lastModifiedByType
|
createdByType
|
Der Identitätstyp, der die Ressource zuletzt geändert hat.
|
UserAssignedIdentity
Objekt
Identitäten, die einem Server zugeordnet sind.
| Name |
Typ |
Beschreibung |
|
principalId
|
string
|
Bezeichner des Objekts des Dienstprinzipals, das der vom Benutzer zugewiesenen verwalteten Identität zugeordnet ist.
|
|
tenantId
|
string
|
Kennung des Mandanten eines Servers.
|
|
type
|
IdentityType
|
Arten von Identitäten, die einem Server zugeordnet sind.
|
|
userAssignedIdentities
|
<string,
UserIdentity>
|
Zuordnung der benutzerseitig zugewiesenen verwalteten Identitäten.
|
UserIdentity
Objekt
Benutzerseitig zugewiesene verwaltete Identität, die einem Server zugeordnet ist.
| Name |
Typ |
Beschreibung |
|
clientId
|
string
|
Bezeichner des Clients des Dienstprinzipals, der der benutzerseitig zugewiesenen verwalteten Identität zugeordnet ist.
|
|
principalId
|
string
|
Bezeichner des Objekts des Dienstprinzipals, das der vom Benutzer zugewiesenen verwalteten Identität zugeordnet ist.
|