---
title: "Find Azure IP Ranges and Service Tags with PowerShell"
description: "Discover how to find the latest Azure IP ranges and service tags, and build a handy PowerShell script to stay up-to-date."
canonical: "https://adamtheautomator.com/azure-ip-ranges/"
---

# Find Azure IP Ranges and Service Tags with PowerShell

> Discover how to find the latest Azure IP ranges and service tags, and build a handy PowerShell script to stay up-to-date.

Source: https://adamtheautomator.com/azure-ip-ranges/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Find Azure IP Ranges and Service Tags with PowerShell](https://adamtheautomator.com/wp-content/uploads/2020/12/The-Azure-IP-Ranges-You-Need-to-Know.jpg)

# Find Azure IP Ranges and Service Tags with PowerShell

[![](https://secure.gravatar.com/avatar/4147968aa2332aa682bcebf295e4e9d0eb2672dee3d9ae0523a00ac51e7d6017?s=192&d=mm&r=g)Bill Kindle](https://adamtheautomator.com/author/bill/)24 December 20203 min. read

Categories: [Cloud](/category/cloud/)

Tags:[Microsoft Azure](/tag/microsoft-azure/)

Table of Contents

*   [Prerequisites](#h-prerequisites)
*   [Finding Azure IP Ranges with JSON](#h-finding-azure-ip-ranges-with-json)
*   [Finding Azure IP Ranges with the Get-AzNetworkServiceTag Cmdlet](#h-finding-azure-ip-ranges-with-the-get-aznetworkservicetag-cmdlet)
*   [Next Steps](#h-next-steps)

Azure IP ranges and service tags for the public and gov clouds are updated weekly. Knowing these ranges and tags is crucial for identifying and working with services in Azure. Luckily, Microsoft makes this data available as a single, large JSON file for both clouds. When that happens, you can use tooling to discover this information programmatically.

In this article, you’re going to learn:

*   Where to find the Azure IP range JSON files online.
*   How to extract the Azure IP range and service tag info using JSON and PowerShell.
*   How to use the `_Get-AzNetworkServiceTag_` PowerShell cmdlet to find current service tags.

Ready to explore Azure IP ranges and service tags you need to know? If so, keep reading!

## Prerequisites

To find the latest Azure IP ranges, you’ll be using PowerShell in this article so be sure you have the following requirements met:

1.  The latest Az PowerShell module (5.1.0 at the time of this writing) by running `_Install-Module -Name Az_`.
2.  PowerShell 7.1+ because of _improvements made to JSON cmdlets_ or you could use the [_Azure Cloud Shell_](https://shell.azure.com).

**_Related: [Upgrading to PowerShell 7](https://adamtheautomator.com/powershell-7-upgrade/#Installing_PowerShell_7_manually), [Connect-AzAccount: Your Gateway to Azure with PowerShell](https://adamtheautomator.com/connect-azaccount/)_**

## Finding Azure IP Ranges with JSON

Microsoft offers a list of all Azure IP ranges and services tags via two JSON files; one for the public cloud and [_one for the US government cloud_](https://www.microsoft.com/en-us/download/details.aspx?id=57063) (assuming you’re in the US) and [_one for the public cloud_](https://www.microsoft.com/en-us/download/details.aspx?id=56519).

> _If you simply want to quickly find the Azure IP ranges and service tags, you could just download the JSON files and inspect them manually. But these IP ranges change frequently so it’s a much better idea to get a script to download and parse this information regularly_.

To save you some time, you will find a PowerShell script below. This PowerShell script will download both the Azure Government and public cloud JSON files, parse them and return a couple of objects which you can then work with.

Create a file called _Get-AzureIPRange.ps1_ or something similar, copy and paste the below code into it and run the script in a PowerShell console.

```powershell
## Define each URI for each JSON file. These URI's change weekly so be sure to update them otherwise you will have potentially outdated info!
 $jsonFileUris = @(
     'https://download.microsoft.com/download/6/4/D/64DB03BF-895B-4173-A8B1-BA4AD5D4DF22/ServiceTags_AzureGovernment_20201214.json'
     'https://download.microsoft.com/download/7/1/D/71D86715-5596-4529-9B13-DA13A5DE5B63/ServiceTags_Public_20201214.json'
 )
 foreach ($uri in $jsonFileUris) {
     $jsonFileName = "$($uri.split('/')[-1]).json"
 ## Download the JSON file $null = Invoke-WebRequest -Uri $uri -OutFile $jsonFileName ## Parse the JSON to create an object
 $json = Get-Content -LiteralPath $jsonFileName -Raw | ConvertFrom-Json
 ## Return the PowerShell object [pscustomobject]@{     'Cloud' = $json.cloud     'Values' = $json.values.properties } ## Remove the temporary JSON file Remove-Item -Path $jsonFileName
 }
```

Running the script above (`_.\Get-AzureIPRange.ps1_`), you will see output like below. Notice that the IP ranges are defined with the `_addressPrefixes_` property for each `region` and `_systemService_`.

![Azure IP Ranges with JSON](https://adamtheautomator.com/wp-content/uploads/2020/12/Untitled-2020-12-20T113052.060.png)

Azure IP Ranges with JSON

**_Related: [Wrangling REST APIs with JSON and PowerShell](https://adamtheautomator.com/powershell-json/)_**

_If you’d like to learn more information about what each of the attributes returned means, check out the Microsoft [Regions and Availability Zones in Azure](https://docs.microsoft.com/en-us/azure/availability-zones/az-overview) and the [Products Available by Region](https://azure.microsoft.com/en-us/global-infrastructure/services/) pages._

Now that you know how to discover Azure IP ranges via JSON files, let’s now discover how to perform a similar task using the Az PowerShell module cmdlets!

## Finding Azure IP Ranges with the `Get-AzNetworkServiceTag` Cmdlet

In the last section, you learned how to discover all the ranges you need to know using the [_publicly available JSON file from Microsoft_](https://www.microsoft.com/en-us/download/details.aspx?id=56519). But you do not have to download and ingest a JSON file if you don’t want to. The same data can be obtained using the [_Az module’s Get-AzNetworkServiceTag cmdlet_](https://docs.microsoft.com/en-us/powershell/module/az.network/get-aznetworkservicetag?view=azps-5.1.0)!

While in the Azure Cloud Shell or at your PowerShell console, run the following command.

```powershell
Get-AzNetworkServiceTag -Location eastus2
```

Below you will see an example of assigning the output to a variable and then inspecting the `Values` property like in the previous section.

![Azure Service Tags using Get-AzNetworkServiceTag cmdlet](https://adamtheautomator.com/wp-content/uploads/2020/12/Untitled-2020-12-20T113218.836.png)

Azure Service Tags using Get-AzNetworkServiceTag cmdlet

> _As an honorable mention, you can also find ranges via the Azure Virtual Network API; specifically, the Service Tags `list` call. If you’d like to learn more about this method, check out the [Service Tags documentation](https://docs.microsoft.com/en-us/rest/api/virtualnetwork/servicetags/list)._

## Next Steps

In this article, you’ve learned how you can find all the Azure IP ranges you need to know with PowerShell.

Now see if you can improve the code shown in this article and build a better solution!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fazure-ip-ranges%2F&text=Find%20Azure%20IP%20Ranges%20and%20Service%20Tags%20with%20PowerShell)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fazure-ip-ranges%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fazure-ip-ranges%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/07/featured_image-1.webp)

### [Microsoft Azure Certification Roadmap: Choose the Right Path](/azure-certification-roadmap-2/)

Choose the right Microsoft Azure certification for your career goals. Compare AZ-900, AZ-104, AZ-305, AZ-400, AZ-700, DP-700, study timelines, and 2026 retirements.

![](https://adamtheautomator.com/wp-content/uploads/2021/05/How-to-RenameMove-Azure-Resource-Groups-GUI-and-CLI.jpg)

### [Smart Ways to Rename Azure Resource Groups (GUI and CLI)](/rename-azure-resource-group/)

Unlock the secret to Rename Azure Resource Groups! Dive into our easy guide for reshaping your Azure landscape with Portal, PowerShell, and CLI techniques.

![](https://adamtheautomator.com/wp-content/uploads/2021/03/azure-cli.jpg)

### [Master Azure CLI: Command Your Cloud with Confidence](/azure-cli/)

Unlock the full potential of cloud management with the Azure CLI. This guide provides the essentials to get you started with Azure resources efficiently.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
