0
这里是我的令牌认证是否有无法通过Azure API获取订阅?
var context = new AuthenticationContext(string.Format(ConfigurationManager.AppSettings["login"], ConfigurationManager.AppSettings["tenantId"]));
var credential = new ClientCredential(ConfigurationManager.AppSettings["clientId"], ConfigurationManager.AppSettings["clientSecret"]);
_token = await context.AcquireTokenAsync(ConfigurationManager.AppSettings["apiEndpoint"], credential);
是的,我得到了令牌现在从https://management.core.windows.net/
之后,我下Microsoft.Azure.Management.ResourceManager
命名空间创建的SubscriptionClient
一个新的实例有这个,但是这是两个不同的命名空间我正在使用的那个。
这里是我的实例
_credentials = new TokenCredentials(_managementToken.AccessToken);
_subscriptionClient = new SubscriptionClient(_credentials);
而且终于在这里是呼叫
await _subscriptionClient.Subscriptions.ListAsync();
,并从返回任何结果。
但是从这个呼叫
await _subscriptionClient.Tenants.ListAsync();
这将返回我的租户ID。
顺便说一句我正在使用网络应用程序不是一个原生APP。
有没有解决方案。我如何从Management API获取订阅?
感谢
谢谢,我的帐户有问题。我的其他队友帐户正常工作。 – sercanD