Balaji
Balaji

Reputation: 21

Is there a way to get Azure Subscription ID programmatically?

We would like to create some Azure resources using Azure Rest APIs through a C# program. We are able to get access token by following the below msdn doc https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-oauth-code . But the Azure Rest APIs also requires Subscription ID which we are not able to get. Is there a way we can get it through program?

Thanks

Balaji

Upvotes: 2

Views: 3307

Answers (1)

SaurabhSharma
SaurabhSharma

Reputation: 936

You can use the below request URI to get list of subscriptions for a tenant. https://management.azure.com/subscriptions?api-version=2016-06-01

Please refer to Get Subscription List for more information.

Upvotes: 3

Related Questions