Cria um novo servidor.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}?api-version=2022-12-01
Parâmetros do URI
Name |
Em |
Necessário |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos. O nome não é sensível a maiúsculas e minúsculas.
|
serverName
|
path |
True
|
string
|
O nome do servidor.
Padrão Regex: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
subscriptionId
|
path |
True
|
string
|
O ID da subscrição de destino.
|
api-version
|
query |
True
|
string
|
A versão da API a utilizar para esta operação.
|
Corpo do Pedido
Name |
Tipo |
Description |
parameters
|
Server
|
Os parâmetros necessários para criar ou atualizar um servidor.
|
Respostas
Name |
Tipo |
Description |
200 OK
|
Server
|
OK
|
201 Created
|
Server
|
Criado
|
202 Accepted
|
|
Aceite
Cabeçalhos
Location: string
|
Other Status Codes
|
ErrorResponse
|
Resposta de erro que descreve a razão pela qual a operação falhou.
|
Segurança
azure_auth
Fluxo OAuth2 do Azure Active Directory
Tipo:
oauth2
Fluxo:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Âmbitos
Name |
Description |
user_impersonation
|
representar a sua conta de utilizador
|
Exemplos
Create a database as a geo-restore in geo-paired location
Pedido de amostra
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5geo?api-version=2022-12-01
{
"location": "eastus",
"properties": {
"createMode": "GeoRestore",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
"pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateGeoRestore.json
*/
/**
* Sample code: Create a database as a geo-restore in geo-paired location.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createADatabaseAsAGeoRestoreInGeoPairedLocation(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager
.servers()
.define("pgtestsvc5geo")
.withRegion("eastus")
.withExistingResourceGroup("testrg")
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername")
.withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00"))
.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
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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateGeoRestore.json
func ExampleServersClient_BeginCreate_createADatabaseAsAGeoRestoreInGeoPairedLocation() {
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().BeginCreate(ctx, "testrg", "pgtestsvc5geo", armpostgresqlflexibleservers.Server{
Location: to.Ptr("eastus"),
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeGeoRestore),
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T00:04:59.407Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresqlflexibleservers.Server{
// Name: to.Ptr("pgtestsvc5geo"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5geo"),
// Location: to.Ptr("eastus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
// ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.ActiveDirectoryAuthEnumDisabled),
// PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordAuthEnumEnabled),
// },
// AvailabilityZone: to.Ptr("2"),
// Backup: &armpostgresqlflexibleservers.Backup{
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-27T00:28:17.727Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumEnabled),
// },
// DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
// Type: to.Ptr(armpostgresqlflexibleservers.ArmServerKeyTypeSystemManaged),
// },
// FullyQualifiedDomainName: to.Ptr("pgtestsvc5geo.postgres.database.azure.com"),
// HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeDisabled),
// State: to.Ptr(armpostgresqlflexibleservers.ServerHAStateNotEnabled),
// },
// MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Disabled"),
// DayOfWeek: to.Ptr[int32](0),
// StartHour: to.Ptr[int32](0),
// StartMinute: to.Ptr[int32](0),
// },
// MinorVersion: to.Ptr("6"),
// Network: &armpostgresqlflexibleservers.Network{
// PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled),
// },
// State: to.Ptr(armpostgresqlflexibleservers.ServerStateReady),
// Storage: &armpostgresqlflexibleservers.Storage{
// StorageSizeGB: to.Ptr[int32](512),
// },
// Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
// },
// SKU: &armpostgresqlflexibleservers.SKU{
// Name: to.Ptr("Standard_D4s_v3"),
// Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
// },
// }
}
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");
/**
* 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/2022-12-01/examples/ServerCreateGeoRestore.json
*/
async function createADatabaseAsAGeoRestoreInGeoPairedLocation() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "pgtestsvc5geo";
const parameters = {
createMode: "GeoRestore",
location: "eastus",
pointInTimeUTC: new Date("2021-06-27T00:04:59.4078005+00:00"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(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
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_create_geo_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(
resource_group_name="testrg",
server_name="pgtestsvc5geo",
parameters={
"location": "eastus",
"properties": {
"createMode": "GeoRestore",
"pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateGeoRestore.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
Resposta da amostra
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "pgtestsvc5geo.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "2",
"storage": {
"storageSizeGB": 512
},
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Enabled",
"earliestRestoreDate": "2021-05-27T00:28:17.7279547+00:00"
},
"network": {
"publicNetworkAccess": "Enabled"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "eastus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5geo",
"name": "pgtestsvc5geo",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "pgtestsvc5geo.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "2",
"storage": {
"storageSizeGB": 512
},
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Enabled",
"earliestRestoreDate": "2021-05-27T00:28:17.7279547+00:00"
},
"network": {
"publicNetworkAccess": "Enabled"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "eastus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5geo",
"name": "pgtestsvc5geo",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
Create a database as a point in time restore
Pedido de amostra
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5?api-version=2022-12-01
{
"location": "westus",
"properties": {
"createMode": "PointInTimeRestore",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
"pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreatePointInTimeRestore.json
*/
/**
* Sample code: Create a database as a point in time restore.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createADatabaseAsAPointInTimeRestore(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager
.servers()
.define("pgtestsvc5")
.withRegion("westus")
.withExistingResourceGroup("testrg")
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername")
.withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00"))
.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
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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreatePointInTimeRestore.json
func ExampleServersClient_BeginCreate_createADatabaseAsAPointInTimeRestore() {
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().BeginCreate(ctx, "testrg", "pgtestsvc5", armpostgresqlflexibleservers.Server{
Location: to.Ptr("westus"),
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModePointInTimeRestore),
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T00:04:59.407Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresqlflexibleservers.Server{
// Name: to.Ptr("pgtestsvc5"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
// ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.ActiveDirectoryAuthEnumDisabled),
// PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordAuthEnumEnabled),
// },
// AvailabilityZone: to.Ptr("2"),
// Backup: &armpostgresqlflexibleservers.Backup{
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-27T00:28:17.727Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
// },
// DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
// Type: to.Ptr(armpostgresqlflexibleservers.ArmServerKeyTypeSystemManaged),
// },
// FullyQualifiedDomainName: to.Ptr("pgtestsvc5.postgres.database.azure.com"),
// HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeDisabled),
// State: to.Ptr(armpostgresqlflexibleservers.ServerHAStateNotEnabled),
// },
// MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Disabled"),
// DayOfWeek: to.Ptr[int32](0),
// StartHour: to.Ptr[int32](0),
// StartMinute: to.Ptr[int32](0),
// },
// MinorVersion: to.Ptr("6"),
// Network: &armpostgresqlflexibleservers.Network{
// PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled),
// },
// State: to.Ptr(armpostgresqlflexibleservers.ServerStateReady),
// Storage: &armpostgresqlflexibleservers.Storage{
// StorageSizeGB: to.Ptr[int32](512),
// },
// Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
// },
// SKU: &armpostgresqlflexibleservers.SKU{
// Name: to.Ptr("Standard_D4s_v3"),
// Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
// },
// }
}
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");
/**
* 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/2022-12-01/examples/ServerCreatePointInTimeRestore.json
*/
async function createADatabaseAsAPointInTimeRestore() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "pgtestsvc5";
const parameters = {
createMode: "PointInTimeRestore",
location: "westus",
pointInTimeUTC: new Date("2021-06-27T00:04:59.4078005+00:00"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta da amostra
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "pgtestsvc5.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "2",
"storage": {
"storageSizeGB": 512
},
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-27T00:28:17.7279547+00:00"
},
"network": {
"publicNetworkAccess": "Enabled"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5",
"name": "pgtestsvc5",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "pgtestsvc5.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "2",
"storage": {
"storageSizeGB": 512
},
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-27T00:28:17.7279547+00:00"
},
"network": {
"publicNetworkAccess": "Enabled"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5",
"name": "pgtestsvc5",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
Create a new server
Pedido de amostra
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4?api-version=2022-12-01
{
"location": "westus",
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D4s_v3"
},
"properties": {
"administratorLogin": "cloudsa",
"administratorLoginPassword": "password",
"version": "12",
"availabilityZone": "1",
"createMode": "Create",
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant"
}
},
"tags": {
"ElasticServer": "1"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup;
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoRedundantBackupEnum;
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.ServerVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreate.json
*/
/**
* Sample code: Create a new server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServer(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager
.servers()
.define("pgtestsvc4")
.withRegion("westus")
.withExistingResourceGroup("testrg")
.withTags(mapOf("ElasticServer", "1"))
.withSku(new Sku().withName("Standard_D4s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLogin("cloudsa")
.withAdministratorLoginPassword("password")
.withVersion(ServerVersion.ONE_TWO)
.withStorage(new Storage().withStorageSizeGB(512))
.withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED))
.withNetwork(
new Network()
.withDelegatedSubnetResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")
.withPrivateDnsZoneArmResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.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
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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreate.json
func ExampleServersClient_BeginCreate_createANewServer() {
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().BeginCreate(ctx, "testrg", "pgtestsvc4", armpostgresqlflexibleservers.Server{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"ElasticServer": to.Ptr("1"),
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("cloudsa"),
AdministratorLoginPassword: to.Ptr("password"),
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
},
Network: &armpostgresqlflexibleservers.Network{
DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
},
Storage: &armpostgresqlflexibleservers.Storage{
StorageSizeGB: to.Ptr[int32](512),
},
Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4s_v3"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresqlflexibleservers.Server{
// Name: to.Ptr("pgtestsvc4"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
// ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.ActiveDirectoryAuthEnumDisabled),
// PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordAuthEnumEnabled),
// },
// AvailabilityZone: to.Ptr("1"),
// Backup: &armpostgresqlflexibleservers.Backup{
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-26T01:08:06.719Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
// },
// DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
// Type: to.Ptr(armpostgresqlflexibleservers.ArmServerKeyTypeSystemManaged),
// },
// FullyQualifiedDomainName: to.Ptr("c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com"),
// HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
// StandbyAvailabilityZone: to.Ptr("2"),
// State: to.Ptr(armpostgresqlflexibleservers.ServerHAStateHealthy),
// },
// MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Disabled"),
// DayOfWeek: to.Ptr[int32](0),
// StartHour: to.Ptr[int32](0),
// StartMinute: to.Ptr[int32](0),
// },
// MinorVersion: to.Ptr("6"),
// Network: &armpostgresqlflexibleservers.Network{
// DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
// PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
// PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateDisabled),
// },
// State: to.Ptr(armpostgresqlflexibleservers.ServerStateReady),
// Storage: &armpostgresqlflexibleservers.Storage{
// StorageSizeGB: to.Ptr[int32](512),
// },
// Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
// },
// SKU: &armpostgresqlflexibleservers.SKU{
// Name: to.Ptr("Standard_D4s_v3"),
// Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
// },
// }
}
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");
/**
* 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/2022-12-01/examples/ServerCreate.json
*/
async function createANewServer() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "pgtestsvc4";
const parameters = {
administratorLogin: "cloudsa",
administratorLoginPassword: "password",
availabilityZone: "1",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" },
createMode: "Create",
highAvailability: { mode: "ZoneRedundant" },
location: "westus",
network: {
delegatedSubnetResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
privateDnsZoneArmResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
sku: { name: "Standard_D4s_v3", tier: "GeneralPurpose" },
storage: { storageSizeGB: 512 },
tags: { elasticServer: "1" },
version: "12",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Resposta da amostra
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "1",
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-26T01:08:06.7197478+00:00"
},
"network": {
"publicNetworkAccess": "Disabled",
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant",
"state": "Healthy",
"standbyAvailabilityZone": "2"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "1",
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-26T01:08:06.7197478+00:00"
},
"network": {
"publicNetworkAccess": "Disabled",
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant",
"state": "Healthy",
"standbyAvailabilityZone": "2"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
Create a new server with active directory authentication enabled
Pedido de amostra
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4?api-version=2022-12-01
{
"location": "westus",
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D4s_v3"
},
"properties": {
"administratorLogin": "cloudsa",
"administratorLoginPassword": "password",
"version": "12",
"availabilityZone": "1",
"createMode": "Create",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"
},
"dataEncryption": {
"type": "SystemManaged"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant"
}
},
"tags": {
"ElasticServer": "1"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAuthEnum;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ArmServerKeyType;
import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfig;
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.GeoRedundantBackupEnum;
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.PasswordAuthEnum;
import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku;
import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier;
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithAadAuthEnabled.json
*/
/**
* Sample code: Create a new server with active directory authentication enabled.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServerWithActiveDirectoryAuthenticationEnabled(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager
.servers()
.define("pgtestsvc4")
.withRegion("westus")
.withExistingResourceGroup("testrg")
.withTags(mapOf("ElasticServer", "1"))
.withSku(new Sku().withName("Standard_D4s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withAdministratorLogin("cloudsa")
.withAdministratorLoginPassword("password")
.withVersion(ServerVersion.ONE_TWO)
.withStorage(new Storage().withStorageSizeGB(512))
.withAuthConfig(
new AuthConfig()
.withActiveDirectoryAuth(ActiveDirectoryAuthEnum.ENABLED)
.withPasswordAuth(PasswordAuthEnum.ENABLED)
.withTenantId("tttttt-tttt-tttt-tttt-tttttttttttt"))
.withDataEncryption(new DataEncryption().withType(ArmServerKeyType.SYSTEM_MANAGED))
.withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED))
.withNetwork(
new Network()
.withDelegatedSubnetResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")
.withPrivateDnsZoneArmResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.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
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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithAadAuthEnabled.json
func ExampleServersClient_BeginCreate_createANewServerWithActiveDirectoryAuthenticationEnabled() {
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().BeginCreate(ctx, "testrg", "pgtestsvc4", armpostgresqlflexibleservers.Server{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"ElasticServer": to.Ptr("1"),
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("cloudsa"),
AdministratorLoginPassword: to.Ptr("password"),
AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.ActiveDirectoryAuthEnumEnabled),
PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordAuthEnumEnabled),
TenantID: to.Ptr("tttttt-tttt-tttt-tttt-tttttttttttt"),
},
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.ArmServerKeyTypeSystemManaged),
},
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
},
Network: &armpostgresqlflexibleservers.Network{
DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
},
Storage: &armpostgresqlflexibleservers.Storage{
StorageSizeGB: to.Ptr[int32](512),
},
Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4s_v3"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresqlflexibleservers.Server{
// Name: to.Ptr("pgtestsvc4"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
// ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.ActiveDirectoryAuthEnumEnabled),
// PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordAuthEnumEnabled),
// TenantID: to.Ptr("tttttt-tttt-tttt-tttt-tttttttttttt"),
// },
// AvailabilityZone: to.Ptr("1"),
// Backup: &armpostgresqlflexibleservers.Backup{
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-26T01:08:06.719Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
// },
// FullyQualifiedDomainName: to.Ptr("c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com"),
// HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
// StandbyAvailabilityZone: to.Ptr("2"),
// State: to.Ptr(armpostgresqlflexibleservers.ServerHAStateHealthy),
// },
// MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Disabled"),
// DayOfWeek: to.Ptr[int32](0),
// StartHour: to.Ptr[int32](0),
// StartMinute: to.Ptr[int32](0),
// },
// MinorVersion: to.Ptr("6"),
// Network: &armpostgresqlflexibleservers.Network{
// DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
// PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
// PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateDisabled),
// },
// State: to.Ptr(armpostgresqlflexibleservers.ServerStateReady),
// Storage: &armpostgresqlflexibleservers.Storage{
// StorageSizeGB: to.Ptr[int32](512),
// },
// Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
// },
// SKU: &armpostgresqlflexibleservers.SKU{
// Name: to.Ptr("Standard_D4s_v3"),
// Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
// },
// }
}
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");
/**
* 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/2022-12-01/examples/ServerCreateWithAadAuthEnabled.json
*/
async function createANewServerWithActiveDirectoryAuthenticationEnabled() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "pgtestsvc4";
const parameters = {
administratorLogin: "cloudsa",
administratorLoginPassword: "password",
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: "ZoneRedundant" },
location: "westus",
network: {
delegatedSubnetResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
privateDnsZoneArmResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
sku: { name: "Standard_D4s_v3", tier: "GeneralPurpose" },
storage: { storageSizeGB: 512 },
tags: { elasticServer: "1" },
version: "12",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(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
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_create_with_aad_auth_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(
resource_group_name="testrg",
server_name="pgtestsvc4",
parameters={
"location": "westus",
"properties": {
"administratorLogin": "cloudsa",
"administratorLoginPassword": "password",
"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": "ZoneRedundant"},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
"storage": {"storageSizeGB": 512},
"version": "12",
},
"sku": {"name": "Standard_D4s_v3", "tier": "GeneralPurpose"},
"tags": {"ElasticServer": "1"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithAadAuthEnabled.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
Resposta da amostra
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "1",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"
},
"dataEncryption": {
"type": "SystemManaged"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-26T01:08:06.7197478+00:00"
},
"network": {
"publicNetworkAccess": "Disabled",
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant",
"state": "Healthy",
"standbyAvailabilityZone": "2"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "1",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled",
"tenantId": "tttttt-tttt-tttt-tttt-tttttttttttt"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-26T01:08:06.7197478+00:00"
},
"network": {
"publicNetworkAccess": "Disabled",
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant",
"state": "Healthy",
"standbyAvailabilityZone": "2"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
ServerCreateReplica
Pedido de amostra
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5rep?api-version=2022-12-01
{
"location": "westus",
"properties": {
"createMode": "Replica",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
"pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateReplica.json
*/
/**
* Sample code: ServerCreateReplica.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void serverCreateReplica(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager
.servers()
.define("pgtestsvc5rep")
.withRegion("westus")
.withExistingResourceGroup("testrg")
.withSourceServerResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername")
.withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00"))
.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
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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateReplica.json
func ExampleServersClient_BeginCreate_serverCreateReplica() {
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().BeginCreate(ctx, "testrg", "pgtestsvc5rep", armpostgresqlflexibleservers.Server{
Location: to.Ptr("westus"),
Properties: &armpostgresqlflexibleservers.ServerProperties{
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeReplica),
PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T00:04:59.407Z"); return t }()),
SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresqlflexibleservers.Server{
// Name: to.Ptr("pgtestsvc5rep"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5rep"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
// ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.ActiveDirectoryAuthEnumDisabled),
// PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordAuthEnumEnabled),
// },
// AvailabilityZone: to.Ptr("2"),
// Backup: &armpostgresqlflexibleservers.Backup{
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-27T00:28:17.727Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
// },
// DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
// Type: to.Ptr(armpostgresqlflexibleservers.ArmServerKeyTypeSystemManaged),
// },
// FullyQualifiedDomainName: to.Ptr("pgtestsvc5rep.postgres.database.azure.com"),
// HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeDisabled),
// State: to.Ptr(armpostgresqlflexibleservers.ServerHAStateNotEnabled),
// },
// MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Disabled"),
// DayOfWeek: to.Ptr[int32](0),
// StartHour: to.Ptr[int32](0),
// StartMinute: to.Ptr[int32](0),
// },
// MinorVersion: to.Ptr("6"),
// Network: &armpostgresqlflexibleservers.Network{
// PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled),
// },
// ReplicaCapacity: to.Ptr[int32](0),
// ReplicationRole: to.Ptr(armpostgresqlflexibleservers.ReplicationRoleAsyncReplica),
// State: to.Ptr(armpostgresqlflexibleservers.ServerStateReady),
// Storage: &armpostgresqlflexibleservers.Storage{
// StorageSizeGB: to.Ptr[int32](512),
// },
// Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
// },
// SKU: &armpostgresqlflexibleservers.SKU{
// Name: to.Ptr("Standard_D4s_v3"),
// Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
// },
// }
}
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");
/**
* 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/2022-12-01/examples/ServerCreateReplica.json
*/
async function serverCreateReplica() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "pgtestsvc5rep";
const parameters = {
createMode: "Replica",
location: "westus",
pointInTimeUTC: new Date("2021-06-27T00:04:59.4078005+00:00"),
sourceServerResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(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
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_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(
resource_group_name="testrg",
server_name="pgtestsvc5rep",
parameters={
"location": "westus",
"properties": {
"createMode": "Replica",
"pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00",
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateReplica.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
Resposta da amostra
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "pgtestsvc5rep.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "2",
"storage": {
"storageSizeGB": 512
},
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-27T00:28:17.7279547+00:00"
},
"network": {
"publicNetworkAccess": "Enabled"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
},
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
"replicationRole": "AsyncReplica",
"replicaCapacity": 0
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5rep",
"name": "pgtestsvc5rep",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"properties": {
"fullyQualifiedDomainName": "pgtestsvc5rep.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "2",
"storage": {
"storageSizeGB": 512
},
"dataEncryption": {
"type": "SystemManaged"
},
"authConfig": {
"activeDirectoryAuth": "Disabled",
"passwordAuth": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-27T00:28:17.7279547+00:00"
},
"network": {
"publicNetworkAccess": "Enabled"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
},
"sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername",
"replicationRole": "AsyncReplica",
"replicaCapacity": 0
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5rep",
"name": "pgtestsvc5rep",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
ServerCreateWithDataEncryptionEnabled
Pedido de amostra
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4?api-version=2022-12-01
{
"location": "westus",
"sku": {
"tier": "GeneralPurpose",
"name": "Standard_D4s_v3"
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {}
},
"type": "UserAssigned"
},
"properties": {
"administratorLogin": "cloudsa",
"administratorLoginPassword": "password",
"version": "12",
"availabilityZone": "1",
"createMode": "Create",
"dataEncryption": {
"type": "AzureKeyVault",
"primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant"
}
},
"tags": {
"ElasticServer": "1"
}
}
import com.azure.resourcemanager.postgresqlflexibleserver.models.ArmServerKeyType;
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.GeoRedundantBackupEnum;
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.ServerVersion;
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.UserAssignedIdentity;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.json
*/
/**
* Sample code: ServerCreateWithDataEncryptionEnabled.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void serverCreateWithDataEncryptionEnabled(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager
.servers()
.define("pgtestsvc4")
.withRegion("westus")
.withExistingResourceGroup("testrg")
.withTags(mapOf("ElasticServer", "1"))
.withSku(new Sku().withName("Standard_D4s_v3").withTier(SkuTier.GENERAL_PURPOSE))
.withIdentity(
new UserAssignedIdentity()
.withUserAssignedIdentities(
mapOf(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity",
new UserIdentity()))
.withType(IdentityType.USER_ASSIGNED))
.withAdministratorLogin("cloudsa")
.withAdministratorLoginPassword("password")
.withVersion(ServerVersion.ONE_TWO)
.withStorage(new Storage().withStorageSizeGB(512))
.withDataEncryption(
new DataEncryption()
.withPrimaryKeyUri("fakeTokenPlaceholder")
.withPrimaryUserAssignedIdentityId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")
.withType(ArmServerKeyType.AZURE_KEY_VAULT))
.withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED))
.withNetwork(
new Network()
.withDelegatedSubnetResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet")
.withPrivateDnsZoneArmResourceId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.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
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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.json
func ExampleServersClient_BeginCreate_serverCreateWithDataEncryptionEnabled() {
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().BeginCreate(ctx, "testrg", "pgtestsvc4", armpostgresqlflexibleservers.Server{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"ElasticServer": to.Ptr("1"),
},
Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {},
},
},
Properties: &armpostgresqlflexibleservers.ServerProperties{
AdministratorLogin: to.Ptr("cloudsa"),
AdministratorLoginPassword: to.Ptr("password"),
AvailabilityZone: to.Ptr("1"),
Backup: &armpostgresqlflexibleservers.Backup{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
},
CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeCreate),
DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
Type: to.Ptr(armpostgresqlflexibleservers.ArmServerKeyTypeAzureKeyVault),
PrimaryKeyURI: to.Ptr("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
},
HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
},
Network: &armpostgresqlflexibleservers.Network{
DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
},
Storage: &armpostgresqlflexibleservers.Storage{
StorageSizeGB: to.Ptr[int32](512),
},
Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
},
SKU: &armpostgresqlflexibleservers.SKU{
Name: to.Ptr("Standard_D4s_v3"),
Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresqlflexibleservers.Server{
// Name: to.Ptr("pgtestsvc4"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Identity: &armpostgresqlflexibleservers.UserAssignedIdentity{
// Type: to.Ptr(armpostgresqlflexibleservers.IdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armpostgresqlflexibleservers.UserIdentity{
// "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": &armpostgresqlflexibleservers.UserIdentity{
// ClientID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// PrincipalID: to.Ptr("0a4e0c6e-7751-4078-ae1f-a477306c11e9"),
// },
// },
// },
// Properties: &armpostgresqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AuthConfig: &armpostgresqlflexibleservers.AuthConfig{
// ActiveDirectoryAuth: to.Ptr(armpostgresqlflexibleservers.ActiveDirectoryAuthEnumEnabled),
// PasswordAuth: to.Ptr(armpostgresqlflexibleservers.PasswordAuthEnumEnabled),
// },
// AvailabilityZone: to.Ptr("1"),
// Backup: &armpostgresqlflexibleservers.Backup{
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-26T01:08:06.719Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armpostgresqlflexibleservers.GeoRedundantBackupEnumDisabled),
// },
// DataEncryption: &armpostgresqlflexibleservers.DataEncryption{
// Type: to.Ptr(armpostgresqlflexibleservers.ArmServerKeyTypeAzureKeyVault),
// PrimaryKeyURI: to.Ptr("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
// PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
// },
// FullyQualifiedDomainName: to.Ptr("c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com"),
// HighAvailability: &armpostgresqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant),
// StandbyAvailabilityZone: to.Ptr("2"),
// State: to.Ptr(armpostgresqlflexibleservers.ServerHAStateHealthy),
// },
// MaintenanceWindow: &armpostgresqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Disabled"),
// DayOfWeek: to.Ptr[int32](0),
// StartHour: to.Ptr[int32](0),
// StartMinute: to.Ptr[int32](0),
// },
// MinorVersion: to.Ptr("6"),
// Network: &armpostgresqlflexibleservers.Network{
// DelegatedSubnetResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
// PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
// PublicNetworkAccess: to.Ptr(armpostgresqlflexibleservers.ServerPublicNetworkAccessStateDisabled),
// },
// State: to.Ptr(armpostgresqlflexibleservers.ServerStateReady),
// Storage: &armpostgresqlflexibleservers.Storage{
// StorageSizeGB: to.Ptr[int32](512),
// },
// Version: to.Ptr(armpostgresqlflexibleservers.ServerVersionTwelve),
// },
// SKU: &armpostgresqlflexibleservers.SKU{
// Name: to.Ptr("Standard_D4s_v3"),
// Tier: to.Ptr(armpostgresqlflexibleservers.SKUTierGeneralPurpose),
// },
// }
}
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");
/**
* 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/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.json
*/
async function serverCreateWithDataEncryptionEnabled() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "pgtestsvc4";
const parameters = {
administratorLogin: "cloudsa",
administratorLoginPassword: "password",
availabilityZone: "1",
backup: { backupRetentionDays: 7, geoRedundantBackup: "Disabled" },
createMode: "Create",
dataEncryption: {
type: "AzureKeyVault",
primaryKeyURI:
"https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity",
},
highAvailability: { mode: "ZoneRedundant" },
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/testresourcegroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/testUsermanagedidentity":
{},
},
},
location: "westus",
network: {
delegatedSubnetResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
privateDnsZoneArmResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
sku: { name: "Standard_D4s_v3", tier: "GeneralPurpose" },
storage: { storageSizeGB: 512 },
tags: { elasticServer: "1" },
version: "12",
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(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
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_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(
resource_group_name="testrg",
server_name="pgtestsvc4",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {}
},
},
"location": "westus",
"properties": {
"administratorLogin": "cloudsa",
"administratorLoginPassword": "password",
"availabilityZone": "1",
"backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"},
"createMode": "Create",
"dataEncryption": {
"primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity",
"type": "AzureKeyVault",
},
"highAvailability": {"mode": "ZoneRedundant"},
"network": {
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com",
},
"storage": {"storageSizeGB": 512},
"version": "12",
},
"sku": {"name": "Standard_D4s_v3", "tier": "GeneralPurpose"},
"tags": {"ElasticServer": "1"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.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
Resposta da amostra
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {
"principalId": "0a4e0c6e-7751-4078-ae1f-a477306c11e9",
"clientId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
},
"type": "UserAssigned"
},
"properties": {
"fullyQualifiedDomainName": "c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "1",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled"
},
"dataEncryption": {
"type": "AzureKeyVault",
"primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-26T01:08:06.7197478+00:00"
},
"network": {
"publicNetworkAccess": "Disabled",
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant",
"state": "Healthy",
"standbyAvailabilityZone": "2"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
{
"sku": {
"name": "Standard_D4s_v3",
"tier": "GeneralPurpose"
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {
"principalId": "0a4e0c6e-7751-4078-ae1f-a477306c11e9",
"clientId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
},
"type": "UserAssigned"
},
"properties": {
"fullyQualifiedDomainName": "c7d7483a8ceb.test-private-dns-zone.postgres.database.azure.com",
"version": "12",
"minorVersion": "6",
"administratorLogin": "cloudsa",
"state": "Ready",
"availabilityZone": "1",
"authConfig": {
"activeDirectoryAuth": "Enabled",
"passwordAuth": "Enabled"
},
"dataEncryption": {
"type": "AzureKeyVault",
"primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"
},
"storage": {
"storageSizeGB": 512
},
"backup": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-05-26T01:08:06.7197478+00:00"
},
"network": {
"publicNetworkAccess": "Disabled",
"delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet",
"privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"
},
"highAvailability": {
"mode": "ZoneRedundant",
"state": "Healthy",
"standbyAvailabilityZone": "2"
},
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
}
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/flexibleServers"
}
Definições
Name |
Description |
activeDirectoryAuthEnum
|
Se Ativado, a autenticação do Azure Active Directory está ativada.
|
ArmServerKeyType
|
Tipo de encriptação de dados para ilustrar se é Gerido pelo Sistema vs. Cofre de chaves do Azure.
|
AuthConfig
|
Propriedades AuthConfig de um servidor.
|
Backup
|
Propriedades de cópia de segurança de um servidor.
|
createdByType
|
O tipo de identidade que criou o recurso.
|
CreateMode
|
O modo para criar um novo servidor PostgreSQL.
|
DataEncryption
|
Propriedades de encriptação de dados de um servidor.
|
ErrorAdditionalInfo
|
Informações adicionais sobre o erro de gestão de recursos.
|
ErrorDetail
|
O detalhe do erro.
|
ErrorResponse
|
Resposta a erros
|
GeoRedundantBackupEnum
|
Um valor que indica se Geo-Redundant cópia de segurança está ativada no servidor.
|
HighAvailability
|
Propriedades de elevada disponibilidade de um servidor.
|
HighAvailabilityMode
|
O modo HA para o servidor.
|
IdentityType
|
os tipos de identidades associadas a este recurso; atualmente restrito a "Nenhum e UserAssigned"
|
MaintenanceWindow
|
Propriedades da janela de manutenção de um servidor.
|
Network
|
Propriedades de rede de um servidor. Esta propriedade Rede só tem de ser transmitida caso pretenda que o servidor seja servidor de acesso privado.
|
passwordAuthEnum
|
Se Ativado, a autenticação por palavra-passe está ativada.
|
ReplicationRole
|
Função de replicação do servidor
|
Server
|
Representa um servidor.
|
ServerHAState
|
Um estado de um servidor HA que é visível para o utilizador.
|
ServerPublicNetworkAccessState
|
o acesso à rede pública está ativado ou não
|
ServerState
|
Um estado de um servidor que é visível para o utilizador.
|
ServerVersion
|
Versão do Servidor PostgreSQL.
|
Sku
|
O SKU (escalão de preço) do servidor.
|
SkuTier
|
A camada do SKU específico, por exemplo, Expansível.
|
Storage
|
Propriedades de armazenamento de um servidor.
|
systemData
|
Os metadados do sistema relacionados com este recurso.
|
UserAssignedIdentity
|
Descreve a identidade da aplicação.
|
UserIdentity
|
Descreve uma única identidade atribuída pelo utilizador associada à aplicação.
|
activeDirectoryAuthEnum
Se Ativado, a autenticação do Azure Active Directory está ativada.
Name |
Tipo |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
ArmServerKeyType
Tipo de encriptação de dados para ilustrar se é Gerido pelo Sistema vs. Cofre de chaves do Azure.
Name |
Tipo |
Description |
AzureKeyVault
|
string
|
|
SystemManaged
|
string
|
|
AuthConfig
Propriedades AuthConfig de um servidor.
Name |
Tipo |
Default value |
Description |
activeDirectoryAuth
|
activeDirectoryAuthEnum
|
|
Se Ativado, a autenticação do Azure Active Directory está ativada.
|
passwordAuth
|
passwordAuthEnum
|
Enabled
|
Se Ativado, a autenticação por palavra-passe está ativada.
|
tenantId
|
string
|
|
ID do inquilino do servidor.
|
Backup
Propriedades de cópia de segurança de um servidor.
Name |
Tipo |
Default value |
Description |
backupRetentionDays
|
integer
|
7
|
Dias de retenção de cópias de segurança para o servidor.
|
earliestRestoreDate
|
string
|
|
O tempo de ponto de restauro mais antigo (ISO8601 formato) para o servidor.
|
geoRedundantBackup
|
GeoRedundantBackupEnum
|
Disabled
|
Um valor que indica se Geo-Redundant cópia de segurança está ativada no servidor.
|
createdByType
O tipo de identidade que criou o recurso.
Name |
Tipo |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
CreateMode
O modo para criar um novo servidor PostgreSQL.
Name |
Tipo |
Description |
Create
|
string
|
|
Default
|
string
|
|
GeoRestore
|
string
|
|
PointInTimeRestore
|
string
|
|
Replica
|
string
|
|
Update
|
string
|
|
DataEncryption
Propriedades de encriptação de dados de um servidor.
Name |
Tipo |
Description |
primaryKeyURI
|
string
|
URI para a chave para encriptação de dados para o servidor primário.
|
primaryUserAssignedIdentityId
|
string
|
ID de Recurso para a identidade atribuída pelo utilizador a ser utilizada para encriptação de dados para o servidor primário.
|
type
|
ArmServerKeyType
|
Tipo de encriptação de dados para ilustrar se é Gerido pelo Sistema vs. Cofre de chaves do Azure.
|
ErrorAdditionalInfo
Informações adicionais sobre o erro de gestão de recursos.
Name |
Tipo |
Description |
info
|
object
|
As informações adicionais.
|
type
|
string
|
O tipo de informação adicional.
|
ErrorDetail
O detalhe do erro.
Name |
Tipo |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
As informações adicionais do erro.
|
code
|
string
|
O código de erro.
|
details
|
ErrorDetail[]
|
Os detalhes do erro.
|
message
|
string
|
A mensagem de erro.
|
target
|
string
|
O destino do erro.
|
ErrorResponse
Resposta a erros
Name |
Tipo |
Description |
error
|
ErrorDetail
|
O objeto de erro.
|
GeoRedundantBackupEnum
Um valor que indica se Geo-Redundant cópia de segurança está ativada no servidor.
Name |
Tipo |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
HighAvailability
Propriedades de elevada disponibilidade de um servidor.
Name |
Tipo |
Default value |
Description |
mode
|
HighAvailabilityMode
|
Disabled
|
O modo HA para o servidor.
|
standbyAvailabilityZone
|
string
|
|
informações da zona de disponibilidade do modo de espera.
|
state
|
ServerHAState
|
|
Um estado de um servidor HA que é visível para o utilizador.
|
HighAvailabilityMode
O modo HA para o servidor.
Name |
Tipo |
Description |
Disabled
|
string
|
|
SameZone
|
string
|
|
ZoneRedundant
|
string
|
|
IdentityType
os tipos de identidades associadas a este recurso; atualmente restrito a "Nenhum e UserAssigned"
Name |
Tipo |
Description |
None
|
string
|
|
UserAssigned
|
string
|
|
MaintenanceWindow
Propriedades da janela de manutenção de um servidor.
Name |
Tipo |
Default value |
Description |
customWindow
|
string
|
Disabled
|
indica se a janela personalizada está ativada ou desativada
|
dayOfWeek
|
integer
|
0
|
dia da semana para a janela de manutenção
|
startHour
|
integer
|
0
|
hora de início para a janela de manutenção
|
startMinute
|
integer
|
0
|
minuto de início para a janela de manutenção
|
Network
Propriedades de rede de um servidor. Esta propriedade Rede só tem de ser transmitida caso pretenda que o servidor seja servidor de acesso privado.
Name |
Tipo |
Description |
delegatedSubnetResourceId
|
string
|
ID de recurso delegado do arm da sub-rede. Isto tem de ser transmitido durante a criação, caso pretendamos que o servidor seja injetado na VNET, ou seja, servidor de acesso privado. Durante a atualização, transmita-o apenas se quisermos atualizar o valor para DNS Privado zona.
|
privateDnsZoneArmResourceId
|
string
|
ID de recurso do arm da zona dns privado. Isto tem de ser transmitido durante a criação, caso pretendamos que o servidor seja injetado na VNET, ou seja, servidor de acesso privado. Durante a atualização, transmita-o apenas se quisermos atualizar o valor para DNS Privado zona.
|
publicNetworkAccess
|
ServerPublicNetworkAccessState
|
o acesso à rede pública está ativado ou não
|
passwordAuthEnum
Se Ativado, a autenticação por palavra-passe está ativada.
Name |
Tipo |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
ReplicationRole
Função de replicação do servidor
Name |
Tipo |
Description |
AsyncReplica
|
string
|
|
GeoAsyncReplica
|
string
|
|
None
|
string
|
|
Primary
|
string
|
|
Server
Representa um servidor.
Name |
Tipo |
Description |
id
|
string
|
ID de recurso completamente qualificado para o recurso. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
UserAssignedIdentity
|
Descreve a identidade da aplicação.
|
location
|
string
|
A localização geográfica onde o recurso se encontra
|
name
|
string
|
O nome do recurso
|
properties.administratorLogin
|
string
|
O nome de início de sessão do administrador de um servidor. Só pode ser especificado quando o servidor está a ser criado (e é necessário para a criação).
|
properties.administratorLoginPassword
|
string
|
A palavra-passe de início de sessão do administrador (necessária para a criação do servidor).
|
properties.authConfig
|
AuthConfig
|
Propriedades AuthConfig de um servidor.
|
properties.availabilityZone
|
string
|
informações da zona de disponibilidade do servidor.
|
properties.backup
|
Backup
|
Propriedades de cópia de segurança de um servidor.
|
properties.createMode
|
CreateMode
|
O modo para criar um novo servidor PostgreSQL.
|
properties.dataEncryption
|
DataEncryption
|
Propriedades de encriptação de dados de um servidor.
|
properties.fullyQualifiedDomainName
|
string
|
O nome de domínio completamente qualificado de um servidor.
|
properties.highAvailability
|
HighAvailability
|
Propriedades de elevada disponibilidade de um servidor.
|
properties.maintenanceWindow
|
MaintenanceWindow
|
Propriedades da janela de manutenção de um servidor.
|
properties.minorVersion
|
string
|
A versão secundária do servidor.
|
properties.network
|
Network
|
Propriedades de rede de um servidor. Esta propriedade Rede só tem de ser transmitida caso pretenda que o servidor seja servidor de acesso privado.
|
properties.pointInTimeUTC
|
string
|
Hora de criação do ponto de restauro (ISO8601 formato), especificando a hora de restauro. É necessário quando "createMode" é "PointInTimeRestore" ou "GeoRestore".
|
properties.replicaCapacity
|
integer
|
Réplicas permitidas para um servidor.
|
properties.replicationRole
|
ReplicationRole
|
Função de replicação do servidor
|
properties.sourceServerResourceId
|
string
|
O ID de recurso do servidor de origem a partir do qual restaurar. É necessário quando "createMode" é "PointInTimeRestore" ou "GeoRestore" ou "Réplica". Esta propriedade é devolvida apenas para o servidor réplica
|
properties.state
|
ServerState
|
Um estado de um servidor que é visível para o utilizador.
|
properties.storage
|
Storage
|
Propriedades de armazenamento de um servidor.
|
properties.version
|
ServerVersion
|
Versão do Servidor PostgreSQL.
|
sku
|
Sku
|
O SKU (escalão de preço) do servidor.
|
systemData
|
systemData
|
Os metadados do sistema relacionados com este recurso.
|
tags
|
object
|
Etiquetas de recursos.
|
type
|
string
|
O tipo de recurso. Por exemplo, "Microsoft.Compute/virtualMachines" ou "Microsoft.Storage/storageAccounts"
|
ServerHAState
Um estado de um servidor HA que é visível para o utilizador.
Name |
Tipo |
Description |
CreatingStandby
|
string
|
|
FailingOver
|
string
|
|
Healthy
|
string
|
|
NotEnabled
|
string
|
|
RemovingStandby
|
string
|
|
ReplicatingData
|
string
|
|
ServerPublicNetworkAccessState
o acesso à rede pública está ativado ou não
Name |
Tipo |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
ServerState
Um estado de um servidor que é visível para o utilizador.
Name |
Tipo |
Description |
Disabled
|
string
|
|
Dropping
|
string
|
|
Ready
|
string
|
|
Starting
|
string
|
|
Stopped
|
string
|
|
Stopping
|
string
|
|
Updating
|
string
|
|
ServerVersion
Versão do Servidor PostgreSQL.
Name |
Tipo |
Description |
11
|
string
|
|
12
|
string
|
|
13
|
string
|
|
14
|
string
|
|
Sku
O SKU (escalão de preço) do servidor.
Name |
Tipo |
Description |
name
|
string
|
O nome do sku, normalmente, camada + família + núcleos, por exemplo, Standard_D4s_v3.
|
tier
|
SkuTier
|
A camada do SKU específico, por exemplo, Expansível.
|
SkuTier
A camada do SKU específico, por exemplo, Expansível.
Name |
Tipo |
Description |
Burstable
|
string
|
|
GeneralPurpose
|
string
|
|
MemoryOptimized
|
string
|
|
Storage
Propriedades de armazenamento de um servidor.
Name |
Tipo |
Description |
storageSizeGB
|
integer
|
Armazenamento máximo permitido para um servidor.
|
systemData
Os metadados do sistema relacionados com este recurso.
Name |
Tipo |
Description |
createdAt
|
string
|
O carimbo de data/hora da criação de recursos (UTC).
|
createdBy
|
string
|
A identidade que criou o recurso.
|
createdByType
|
createdByType
|
O tipo de identidade que criou o recurso.
|
lastModifiedAt
|
string
|
O carimbo de data/hora da última modificação do recurso (UTC)
|
lastModifiedBy
|
string
|
A identidade que modificou o recurso pela última vez.
|
lastModifiedByType
|
createdByType
|
O tipo de identidade que modificou o recurso pela última vez.
|
UserAssignedIdentity
Descreve a identidade da aplicação.
Name |
Tipo |
Description |
tenantId
|
string
|
ID do inquilino do servidor.
|
type
|
IdentityType
|
os tipos de identidades associadas a este recurso; atualmente restrito a "Nenhum e UserAssigned"
|
userAssignedIdentities
|
<string,
UserIdentity>
|
representa o mapa de identidades atribuídas pelo utilizador.
|
UserIdentity
Descreve uma única identidade atribuída pelo utilizador associada à aplicação.
Name |
Tipo |
Description |
clientId
|
string
|
o identificador de cliente do Principal de Serviço que esta identidade representa.
|
principalId
|
string
|
o identificador de objeto do Principal de Serviço que esta identidade representa.
|