Is there an API to list all Azure Regions?

2019-04-28 04:26发布

I would like to list all Azure locations via some API (I need to generate some config files for every region, and use the exact naming that Azure does to avoid typos). I found this question, but it only lists regions a particular subscription is authorized to use.

I want to list all regions that exist whether my subscription has access or not.

2条回答
做个烂人
2楼-- · 2019-04-28 05:20

A possible solution using powershell script would be to parse the response from the URL: https://azure.microsoft.com/en-us/regions/. Using this, you could get the information about newly announced regions.

If you do not mind using Java or C#, then the below solutions are handy as well.

  1. For region list in java, the dependency in maven is azure-mgmt-resources located at https://github.com/Azure/azure-libraries-for-java/tree/master/azure-mgmt-resources. Documentation: https://azure.github.io/azure-sdk-for-java/com/microsoft/azure/management/resources/fluentcore/arm/Region.html

  2. In case you are using c#, the dependency in nuget is Microsoft.Azure.Management.ResourceManager.Fluent. And for reference, the Source Code URL: https://github.com/Azure/azure-libraries-for-net/blob/master/src/ResourceManagement/ResourceManager/Region.cs

查看更多
\"骚年 ilove
3楼-- · 2019-04-28 05:27

Get-AzureRMLocation will give you the list of locations for your account/tenant/subscription that you run it against.

查看更多
登录 后发表回答