DisplayName Name RegionalDisplayName
------------------------ ------------------- -------------------------------------
East US eastus (US) East US
East US 2 eastus2 (US) East US 2
South Central US southcentralus (US) South Central US
West US 2 westus2 (US) West US 2
Australia East australiaeast (Asia Pacific) Australia East
Southeast Asia southeastasia (Asia Pacific) Southeast Asia
North Europe northeurope (Europe) North Europe
UK South uksouth (Europe) UK South
West Europe westeurope (Europe) West Europe
Central US centralus (US) Central US
North Central US northcentralus (US) North Central US
West US westus (US) West US
South Africa North southafricanorth (Africa) South Africa North
Central India centralindia (Asia Pacific) Central India
East Asia eastasia (Asia Pacific) East Asia
Japan East japaneast (Asia Pacific) Japan East
JIO India West jioindiawest (Asia Pacific) JIO India West
Korea Central koreacentral (Asia Pacific) Korea Central
Canada Central canadacentral (Canada) Canada Central
France Central francecentral (Europe) France Central
Germany West Central germanywestcentral (Europe) Germany West Central
Norway East norwayeast (Europe) Norway East
Switzerland North switzerlandnorth (Europe) Switzerland North
UAE North uaenorth (Middle East) UAE North
Brazil South brazilsouth (South America) Brazil South
Central US (Stage) centralusstage (US) Central US (Stage)
East US (Stage) eastusstage (US) East US (Stage)
East US 2 (Stage) eastus2stage (US) East US 2 (Stage)
North Central US (Stage) northcentralusstage (US) North Central US (Stage)
South Central US (Stage) southcentralusstage (US) South Central US (Stage)
West US (Stage) westusstage (US) West US (Stage)
West US 2 (Stage) westus2stage (US) West US 2 (Stage)
Asia asia Asia
Asia Pacific asiapacific Asia Pacific
Australia australia Australia
Brazil brazil Brazil
Canada canada Canada
Europe europe Europe
Global global Global
India india India
Japan japan Japan
United Kingdom uk United Kingdom
United States unitedstates United States
East Asia (Stage) eastasiastage (Asia Pacific) East Asia (Stage)
Southeast Asia (Stage) southeastasiastage (Asia Pacific) Southeast Asia (Stage)
Central US EUAP centraluseuap (US) Central US EUAP
East US 2 EUAP eastus2euap (US) East US 2 EUAP
West Central US westcentralus (US) West Central US
West US 3 westus3 (US) West US 3
South Africa West southafricawest (Africa) South Africa West
Australia Central australiacentral (Asia Pacific) Australia Central
Australia Central 2 australiacentral2 (Asia Pacific) Australia Central 2
Australia Southeast australiasoutheast (Asia Pacific) Australia Southeast
Japan West japanwest (Asia Pacific) Japan West
Korea South koreasouth (Asia Pacific) Korea South
South India southindia (Asia Pacific) South India
West India westindia (Asia Pacific) West India
Canada East canadaeast (Canada) Canada East
France South francesouth (Europe) France South
Germany North germanynorth (Europe) Germany North
Norway West norwaywest (Europe) Norway West
Switzerland West switzerlandwest (Europe) Switzerland West
UK West ukwest (Europe) UK West
UAE Central uaecentral (Middle East) UAE Central
Brazil Southeast brazilsoutheast (South America) Brazil Southeast
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)
> 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
...
6条答案
按热度按时间ru9i0ody1#
az account list-locations -o table
将为您提供如下表:
dgenwo3n2#
Get-AzureRMLocation
将为您提供运行它的帐户/租户/订阅的位置列表。从下面的答案可以看出,这与较新版本的Azure PS完美配合!
suzh9iv83#
这是一个老问题,已经有一个公认的答案。但鉴于Azure模块中的变化很少,因此在这里添加了最新的命令。
我不认为API的位置仍然存在。但与最新版本的Powershell Az模块,你可以获取的位置
这样您就可以自由选择所需的属性并将输出格式化为表格格式。AZ CLI命令仍然与上面的命令相同。
7rfyedvj4#
使用powershell脚本的可能解决方案是解析来自URL的响应:https://azure.microsoft.com/en-us/regions/。使用此选项,您可以获得有关新发布区域的信息。
如果您不介意使用Java或C#,那么下面的解决方案也很方便。
1.对于java中的区域列表,maven中的依赖项是位于https://github.com/Azure/azure-libraries-for-java/tree/master/azure-mgmt-resources的azure-mgmt-resources。文档:https://azure.github.io/azure-sdk-for-java/com/microsoft/azure/management/resources/fluentcore/arm/Region.html
1.如果您使用的是C#,nuget中的依赖项是Microsoft.Azure.Management.ResourceManager.Fluent。源代码URL:https://github.com/Azure/azure-libraries-for-net/blob/master/src/ResourceManagement/ResourceManager/Region.cs
r6vfmomb5#
您可以使用以下REST API:https://management.azure.com/subscriptions/YOUR_SUBSCRIPTION_ID/providers?api-版本=2020年10月1日
参见:
但是,与PowerShell和AZ命令行一样,这仅显示指定订阅可用的数据中心区域。
piv4azn76#
我一直在寻找一种方法来获取Azure区域,而不需要向Azure进行身份验证,并遇到了这个线程。与@grip11的响应类似,我一直在构建公共Azure文档。这是获取数据的python脚本:
该脚本返回
<class 'list'>
类型的响应,但如果需要,可以转换为可读性更强的类型。例如,在Windows上运行时: