0

我一直在尝试使用 Azure.Management.Sql.SqlManagementClient 连接到 azure gov Sql Server,并且我使用的凭据使用云特定的 AzureEnvironment,如下所示

 AzureCredentials azureCredentials = new AzureCredentialsFactory().FromServicePrincipal(
            ServicePrincipalName,
            cert,
            IsCertificateRollOverEnabled: true,
            aadTenantId,
            azureEnvironment)

我看到文档中的 AzureEnvironment没有Azure Cloud 特定的 sql 后缀属性,如 keyvault/storage。我怀疑这是我遇到异常的问题

    Microsoft.Rest.Azure.CloudException: The subscription 'xxx ' could not be found.
   at Microsoft.Azure.Management.Sql.ElasticPoolsOperations.ListByServerWithHttpMessagesAsync(String resourceGroupName, String serverName, Nullable`1 skip, Dictionary`2 customHeaders, CancellationToken cancellationToken)
   at Microsoft.Azure.Management.Sql.ElasticPoolsOperationsExtensions.ListByServerAsync(IElasticPoolsOperations operations, String resourceGroupName, String serverName, Nullable`1 skip, CancellationToken cancellationToken)

如何使用 SqlManagementClient 连接到 Sql Server Azure US Gov?

4

0 回答 0