Sleep or Pause to PowerShell Script

Last Updated on March 6, 2024 by Arnav Sharma

The PowerShell script, designed for Microsoft’s Azure platform, focuses on extracting and organizing Azure’s datacenter IP ranges, a crucial component for understanding the vast infrastructure of Azure’s public cloud. Originating from the official Microsoft Download Center, the script fetches a JSON file, a format known for its versatility and widespread use in data interchange. This file contains a plethora of IP ranges, often categorized under “Azure IP Ranges and Service Tags.”

Each service tag, a distinctive feature in Azure, represents a group of IP address prefixes associated with specific Azure services. As Azure continues to evolve, these IP ranges are updated weekly, reflecting the dynamic nature of the platform. Furthermore, the data can be related to the Azure Portal, Microsoft’s official web-based interface for managing Azure resources, and the Azure CLI, a command-line tool for interacting with Azure services. 

The script’s output, a CSV file, serves as a comprehensive guide to the IP ranges used by Azure, making it indispensable for network security, firewall configurations, and anyone keen on understanding the intricacies of Microsoft’s Azure datacenters. With the rise of regional IP ranges and specific services like SQL having their own ranges, this script ensures that users stay updated with the ever-evolving landscape of Azure’s network infrastructure.

Here is the script to extract Microsoft Azure Datacenter IP Ranges

# Define the URL for Azure IP Ranges and Service Tags JSON file
$url = ""

# Use Invoke-WebRequest to fetch the download link from the confirmation page
$downloadLink = ((Invoke-WebRequest -Uri $url).Links | Where-Object { $_.href -like "*.json" }).href

# Define paths for the downloaded JSON and the resulting CSV
$jsonPath = "C:tempAzureIPRanges.json" #update the location accordingly 
$csvPath = "C:tempAzureIPRanges.csv"   #update the location accordingly 

# Download the JSON file to a local folder
Invoke-WebRequest -Uri $downloadLink -OutFile $jsonPath
Write-Host "JSON file downloaded to $jsonPath"

# Load the JSON data from the local file
$jsonData = Get-Content -Path $jsonPath | ConvertFrom-Json

# Extract IP ranges and save to CSV
$csvData = @()
foreach ($value in $jsonData.values) {
    if ($ {
        foreach ($addressPrefix in $ {
            $csvData += [PSCustomObject]@{
                "Name"           = $
                "Region"         = $
                "Platform"       = $
                "SystemService"  = $
                "AddressPrefix"  = $addressPrefix

# Save data to CSV
$csvData | Export-Csv -Path $csvPath -NoTypeInformation
Write-Host "Azure IP Ranges saved to $csvPath"

FAQ – Azure IP Ranges

Q: What is Azure?

A: Azure is a cloud computing platform and infrastructure provided by Microsoft. It offers a wide range of services, including virtual machines, databases, networking, analytics, and more.

Q: Where can I find the IP ranges for Microsoft Azure?

A: You can find the IP ranges for Azure by visiting the Azure IP Ranges and Service Tags page on the official Microsoft website.

Q: How often are the Azure IP ranges updated?

A: The Azure IP ranges are updated weekly. It’s important to stay up to date with the latest IP ranges to ensure proper network security.

Q: Can I download the Azure IP ranges and service tags in JSON format?

A: Yes, you can download the Azure IP ranges in JSON format from the official Microsoft Download Center. This file contains all the IP address ranges used by Azure.

Q: What are Azure service tags?

A: Azure service tags are a convenient way to group IP addresses associated with specific services in Azure, such as Azure SQL or Azure App Services. They simplify network security rules and allow for easy management of access control.

Q: How can I get Azure service tags using PowerShell?

A: You can use the PowerShell command ‘Get-AzNetworkServiceTag’ to retrieve the Azure service tags. This command provides a list of service tags broken out by region within the Azure public cloud.

Q: What is the Azure portal?

A: The Azure portal is a web-based management interface provided by Microsoft for managing Azure resources. It allows users to deploy, monitor, and manage their applications and services in the Azure cloud.

Q: How do I install Azure?

A: Azure is a cloud platform, so you don’t need to install it on your local machine. Instead, you can access Azure services through the Azure portal or use the Azure CLI or PowerShell command-line tools to interact with Azure resources.

Q: How can I select a programming language for developing applications on Azure?

A: Azure supports a wide range of programming languages, including C#, Java, Python, Node.js, and many others. You can choose the language that best suits your needs and development preferences.

Q: What are Azure datacenter IP ranges?

A: Azure datacenter IP ranges are the IP address ranges used by Microsoft Azure datacenters. These ranges are used for network security, firewall configurations, and other purposes related to managing and securing Azure resources.

keywords: public azure region ranges for public azure region within that cloud gov api list of IP microsoft azure datacenter ip ranges service tags – public cloud used in azure new ranges appearing

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Toggle Dark Mode