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.
Get-AzureRMLocation
will give you the list of locations for your account/tenant/subscription that you run it against.
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.
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
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