Create postgresql flexible server with netcore 6 and azure sdk

Franz 21 Reputation points
2022-02-18T16:36:17.297+00:00

Hi, I have a problem with the creation of a postgresql flexible server using .net core 6.
The request seems to be correct. But looking on azure portal on activity log session, it always gave me this generic error:

Operation name: Update PostgreSQL Server Create
Error code: ResourceOperationFailure
Message: The resource operation completed with terminal provisioning state 'Failed'.

and, at code side this exception's message:

Long running operation failed with status 'Failed'.
Additional Info:'An unexpected error occured while processing the request.
Tracking ID: 'a3149cf8-b453-451b-807c-e91b62e5ef85'

I don't understand where the problem can be. Is there a way to get more details on the error? I think this is a too generic error.

Regarding my implementation, I generate the azure client using the class from azure sdk: Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient:

var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(clientId, clientSecret, tenantId, AzureEnvironment.AzureGlobalCloud);
var client = new PostgreSQLManagementClient(credentials, new HttpClientHandler ());
client.SubscriptionId = subscriptionId;

var response = await client.Servers.CreateWithHttpMessagesAsync(
data.ResourceGroupName,
"servername",
new Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models.Server
(
location: "northeurope",
sku: new Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models.Sku("Standard_D4s_v3", "GeneralPurpose"),
administratorLogin: data.AdministratorLogin,
administratorLoginPassword: data.AdministratorLoginPassword,
version: "13"
), null, CancellationToken.None
);

This code causes an exception, with the error message mentioned above.

Azure Database for PostgreSQL
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,920 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Franz 21 Reputation points
    2022-03-01T09:30:27.52+00:00

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.