簡體   English   中英

使用 .NET 核心 6 和 Azure SDK 創建 PostgreSQL 靈活服務器時出錯

[英]Error on creation of a PostgreSQL flexible server with .NET core 6, and Azure SDK

我在使用 .net 核心 6 創建 postgresql 靈活服務器時遇到問題。請求似乎是正確的。 但是在活動日志 session 上查看 azure 門戶時,它總是給我這個一般錯誤:

操作名稱:Update PostgreSQL Server Create
錯誤代碼:ResourceOperationFailure
消息:資源操作已完成,終端配置 state“失敗”。

並且,在代碼端這個異常的消息:

長時間運行的操作失敗,狀態為“失敗”。
附加信息:'處理請求時發生意外錯誤。
跟蹤 ID:'xxx-xxx-xxxx-xxx-xxxx'

我不明白問題出在哪里。 有沒有辦法獲得有關錯誤的更多詳細信息? 我認為這是一個過於籠統的錯誤。

關於我的實現,我使用 azure 中的 class 生成 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
);

此代碼導致異常,並出現上述錯誤消息。

我哪里做錯了?

感謝 Azure 支持,問題已解決。 缺少存儲大小。 根據arm模板: https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/quickstart-create-server-arm-template?tabs=portal%2Cazure-portal#review-the-template

感謝Franzkom與我們分享解決方案。 發布與答案相同的內容以幫助其他社區成員。

最初錯過了存儲skuSizeGB 添加相同的解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM