azure,

How to get regional Azure public IP address ranges

Jan 12, 2022 · 2 mins read · Post a comment

Public Azure cloud IP ranges and service tags could be important thing when working with services and NSGs (Network Security Groups). The list could be downloaded as a JSON file in a couple of different ways which will be described as below.

Prerequisites

  • AZ CLI and/or PowerShell

Solution(s)

List IP ranges using az CLI

Step 1. Open Terminal and run the following command:

az network list-service-tags --location northeurope

Output:

{
  "changeNumber": "78",
  "cloud": "Public",
  "id": "/subscriptions/<sub_id>/providers/Microsoft.Network/serviceTags/Public",
  "name": "Public",
  "nextLink": "",
  "type": "Microsoft.Network/serviceTags",
  "values": [
    {
      "id": "ActionGroup",
      "name": "ActionGroup",
      "properties": {
        "addressPrefixes": [
          "13.65.25.19/32",
          "13.66.60.119/32",
          "13.66.143.220/30",
          ...

Note(s): To save the JSON output, run:

az network list-service-tags --location northeurope > azureipranges.json

List IP ranges using PowerShell

Step 1. Open PowerShell and save the output of Get-AzNetworkServiceTag -Location northeurope.

$azServiceTags = Get-AzNetworkServiceTag -Location northeurope

Step 2. Get the Values property.

$azServiceTags.Values

Output:

Name             : ActionGroup
System Service   : ActionGroup
Address Prefixes : {13.65.25.19/32, 13.66.60.119/32, 13.66.143.220/30, 13.66.202.14/32…}
Change Number    : 7

Name             : ApiManagement
System Service   : AzureApiManagement
Address Prefixes : {13.64.39.16/32, 13.66.138.92/31, 13.66.140.176/28, 13.67.8.108/31…}
Change Number    : 9
...

Download the JSON file from an official Microsoft website

Step 1. Go to Azure IP Ranges and Service Tags.

Step 2. Click the Download button.

Note(s): There are a lot of other third-party sites where you could check the IP ranges as well, but will not be covered as part of this post. You could google them though.

Conclusion

It’s worth to known that Microsoft updates the list every week, so an automated updated version would be possibly the next DevOps-ideal step. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.