I have been looking into a way to get the Azure regions without needing to authenticate to Azure and came across this thread. Similar to @girip11's response, I have been building on the public Azure documentation. This is the python script to get the data:
import requests
import pandas as pd
from re import search
def list_azure_regions():
url = 'https://azure.microsoft.com/en-us/explore/global-infrastructure/geographies/'
html = requests.get(url).content
df_list = pd.read_html(html)
regions_list = []
locations_list = []
for df in df_list:
for dc in list(df):
if search('Regions', dc):
pass
else:
if search('Coming soon', dc):
state = 'planned'
else:
state = 'active'
location = df[dc][0]
region = dc.removesuffix(' Start free')
region = region.removesuffix(' Get started')
region = region.removesuffix(' Coming soon')
if region in regions_list:
pass
else:
regions_list.append(region)
locations_list.append(
dict({
'display_name': region,
'name': region.replace(' ','').lower(),
'location': location,
'state': state
})
)
return locations_list
azure_regions = list_azure_regions()
print(azure_regions)
The script returns a response of type <class 'list'>
but could be converted to something more readable if required. I.E. when running on Windows:
> python .\get-azure-regions.py | ConvertFrom-Json
display_name name location state
------------ ---- -------- -----
East Asia eastasia Hong Kong active
Southeast Asia southeastasia Singapore active
Australia Central australiacentral Canberra active
Australia East australiaeast New South Wales active
Australia Southeast australiasoutheast Victoria active
China East chinaeast Shanghai active
China East 2 chinaeast2 Shanghai active
China North chinanorth Beijing active
China North 2 chinanorth2 Beijing active
China North 3 chinanorth3 Hebei active
Central India centralindia Pune active
India South Central indiasouthcentral Hyderabad active
South India southindia Chennai active
Indonesia Central indonesiacentral Jakarta planned
Japan East japaneast Tokyo, Saitama active
Japan West japanwest Osaka active
Korea Central koreacentral Seoul active
Malaysia West malaysiawest Kuala Lumpur planned
New Zealand North newzealandnorth Auckland planned
Taiwan North taiwannorth Taipei planned
Austria East austriaeast Vienna planned
Belgium Central belgiumcentral Brussels active
...