【发布时间】:2018-06-18 13:25:01
【问题描述】:
在 Azure App 服务中运行以下代码,尝试在同一 Azure 订阅中获取云服务的详细信息,并获取证书与订阅无关的异常。
虽然,在订阅刀片下,在“管理证书”下 证书确实存在并获得授权。
X509Store certStore = new X509Store(StoreName.My, storeLocation);
certStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certCollection = certStore.Certificates.Find(X509FindType.FindByThumbprint, prodThumbprint, false);
if (certCollection.Count > 0)
CredentialsProd = new CertificateCloudCredentials(DBConstants.AZURE_SUBSCRIPTION_ID_PROD, certCollection[0]);
using (var client = new ComputeManagementClient(Credentials))
{
var t = client.HostedServices.GetDetailedAsync(serviceName, CancellationToken);
}
例外:
ForbiddenError:服务器未能验证请求。验证证书是否有效并且与此订阅相关联。
【问题讨论】:
标签: c# .net azure azure-management-api azure-management-portal