{"id":6671,"date":"2020-07-30T20:35:12","date_gmt":"2020-07-30T19:35:12","guid":{"rendered":"https:\/\/walkingrandomly.com\/?p=6671"},"modified":"2020-07-30T20:40:15","modified_gmt":"2020-07-30T19:40:15","slug":"programmatically-listing-all-available-regions-in-microsoft-azure","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=6671","title":{"rendered":"Programmatically listing all available regions in Microsoft Azure"},"content":{"rendered":"<p>When using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/cli\/azure\/?view=azure-cli-latest\">Azure Command Line Interface (CLI)<\/a>, it is often necessary to explicitly state which region you want to perform an operation in.\u00a0 For example, when creating a <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/azure-resource-manager\/management\/overview#resource-groups\">resource group<\/a><\/p>\n<pre><code>az group create --name &lt;rg_name&gt; --location &lt;location&gt;\n<\/code><\/pre>\n<p>Where you replace <code>&lt;location&gt;<\/code>with the region where you want to create the resource group.  You may have a region in mind (South Central US perhaps) or you may be wondering which <a href=\"https:\/\/azure.microsoft.com\/en-gb\/global-infrastructure\/geographies\/\">regions are available<\/a>.  Either way, it is helpful to see the list of all possible values for <code>&lt;location&gt;<\/code> in commands like the one above.<\/p>\n<p>The way to do this is with the following command<\/p>\n<pre><code>az account list-locations\n<\/code><\/pre>\n<p>By default, the output is in JSON format:<\/p>\n<pre><code>[\n  {\n    \"displayName\": \"East Asia\",\n    \"id\": \"\/subscriptions\/1ce68363-bb47-4365-b243-7451a25611c4\/locations\/eastasia\",\n    \"latitude\": \"22.267\",\n    \"longitude\": \"114.188\",\n    \"name\": \"eastasia\",\n    \"subscriptionId\": null\n  },\n  {\n    \"displayName\": \"Southeast Asia\",\n    \"id\": \"\/subscriptions\/1ce68363-bb47-4365-b243-7451a25611c4\/locations\/southeastasia\",\n    \"latitude\": \"1.283\",\n    \"longitude\": \"103.833\",\n    \"name\": \"southeastasia\",\n    \"subscriptionId\": null\n  },\n  {\n    \"displayName\": \"Central US\",\n    \"id\": \"\/subscriptions\/1ce68363-bb47-4365-b243-7451a25611c4\/locations\/centralus\",\n    \"latitude\": \"41.5908\",\n    \"longitude\": \"-93.6208\",\n    \"name\": \"centralus\",\n    \"subscriptionId\": null\n<\/code><\/pre>\n<p>Let&#8217;s get the output in a more human readable table format.<\/p>\n<pre><code>az account list-locations -o table\n\nDisplayName           Latitude    Longitude    Name\n--------------------  ----------  -----------  ------------------\nEast Asia             22.267      114.188      eastasia\nSoutheast Asia        1.283       103.833      southeastasia\nCentral US            41.5908     -93.6208     centralus\nEast US               37.3719     -79.8164     eastus\nEast US 2             36.6681     -78.3889     eastus2\nWest US               37.783      -122.417     westus\nNorth Central US      41.8819     -87.6278     northcentralus\nSouth Central US      29.4167     -98.5        southcentralus\nNorth Europe          53.3478     -6.2597      northeurope\nWest Europe           52.3667     4.9          westeurope\nJapan West            34.6939     135.5022     japanwest\nJapan East            35.68       139.77       japaneast\nBrazil South          -23.55      -46.633      brazilsouth\nAustralia East        -33.86      151.2094     australiaeast\nAustralia Southeast   -37.8136    144.9631     australiasoutheast\nSouth India           12.9822     80.1636      southindia\nCentral India         18.5822     73.9197      centralindia\nWest India            19.088      72.868       westindia\nCanada Central        43.653      -79.383      canadacentral\nCanada East           46.817      -71.217      canadaeast\nUK South              50.941      -0.799       uksouth\nUK West               53.427      -3.084       ukwest\nWest Central US       40.890      -110.234     westcentralus\nWest US 2             47.233      -119.852     westus2\nKorea Central         37.5665     126.9780     koreacentral\nKorea South           35.1796     129.0756     koreasouth\nFrance Central        46.3772     2.3730       francecentral\nFrance South          43.8345     2.1972       francesouth\nAustralia Central     -35.3075    149.1244     australiacentral\nAustralia Central 2   -35.3075    149.1244     australiacentral2\nUAE Central           24.466667   54.366669    uaecentral\nUAE North             25.266666   55.316666    uaenorth\nSouth Africa North    -25.731340  28.218370    southafricanorth\nSouth Africa West     -34.075691  18.843266    southafricawest\nSwitzerland North     47.451542   8.564572     switzerlandnorth\nSwitzerland West      46.204391   6.143158     switzerlandwest\nGermany North         53.073635   8.806422     germanynorth\nGermany West Central  50.110924   8.682127     germanywestcentral\nNorway West           58.969975   5.733107     norwaywest\nNorway East           59.913868   10.752245    norwayeast\n<\/code><\/pre>\n<p>The entries in the <code>Name<\/code> column are valid options for <code>&lt;location&gt;<\/code> in the command we started out with.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When using the Azure Command Line Interface (CLI), it is often necessary to explicitly state which region you want to perform an operation in.\u00a0 For example, when creating a resource group az group create &#8211;name &lt;rg_name&gt; &#8211;location &lt;location&gt; Where you replace &lt;location&gt;with the region where you want to create the resource group. You may have [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[88,86],"tags":[],"class_list":["post-6671","post","type-post","status-publish","format-standard","hentry","category-azure","category-cloud-computing"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-1JB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/6671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6671"}],"version-history":[{"count":9,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/6671\/revisions"}],"predecessor-version":[{"id":6681,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/6671\/revisions\/6681"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}