Reputation: 197
Here is my token Authentication
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);
And yes I got the token now from https://management.core.windows.net/
After that I am creating a new instance of SubscriptionClient
under Microsoft.Azure.Management.ResourceManager
namespace there is 2 different namespace for this but that is the one I am using.
Here is my instance
_credentials = new TokenCredentials(_managementToken.AccessToken);
_subscriptionClient = new SubscriptionClient(_credentials);
And the finally here is the call
await _subscriptionClient.Subscriptions.ListAsync();
And returns nothing from that.
But from this call
await _subscriptionClient.Tenants.ListAsync();
this returns my tenant id.
BTW I am using WEB APP not a NATIVE APP.
Is there any solution for that. How can I get subscriptions from Management API.
Thanks
Upvotes: 0
Views: 134
Reputation: 27528
Please firstly ensure your subscription has associated with your azure ad tenant :
Please ensure the azure ad tenant you are using has any subscription .
Upvotes: 1