AzureIPNetworks 2.0.0

dotnet add package AzureIPNetworks --version 2.0.0                
NuGet\Install-Package AzureIPNetworks -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AzureIPNetworks" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AzureIPNetworks --version 2.0.0                
#r "nuget: AzureIPNetworks, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AzureIPNetworks as a Cake Addin
#addin nuget:?package=AzureIPNetworks&version=2.0.0

// Install AzureIPNetworks as a Cake Tool
#tool nuget:?package=AzureIPNetworks&version=2.0.0                

AzureIPNetworks

NuGet Nuget

Introduction

This library eases working with known Azure IP networks in dotnet. AzureCloudServiceTag provides the IP ranges for the entire cloud and is also broken out by region within that cloud. You cannot create your own service tag nor can you specify which IP addresses are included within a tag. Microsoft manages the address prefixes encompassed by the service tag, and automatically updates the service tag and their addresses as they change.

Service tags are stored in a JSON file which contains the IP address ranges for Public Azure as a whole, each Azure region within Public, and ranges for several Azure services such as EventHub, KeyVault, Storage, SQL, and TrafficManager in Public. The JSON file is downloaded from Microsoft's Website every so often from:

The library offers capabilities such as:

  • Listing IP addresses or IP networks used by the whole of Azure or filtered to a single service tag.
  • Checking if a given IP address or IP network belongs to Azure

The current version of the files can be found at files.json

You can also download the files from the remote URL once per application run using AzureIPsProvider.Remote.xxxx methods

Installation

Using the .NET Core command-line interface (CLI) tools:

dotnet add package AzureIPNetworks

Using the NuGet Command Line Interface (CLI):

nuget install AzureIPNetworks

Using the Package Manager Console:

Install-Package AzureIPNetworks

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "AzureIPNetworks".
  5. Click on the AzureIPNetworks package, select the appropriate version in the right-tab and click Install.

Example 1 - Get all IP Networks (local)

var networks = await AzureIPsProvider.Local.GetNetworksAsync(AzureCloud.Public);
foreach (var net in networks)
{
    Console.WriteLine($"{net} ({range.FirstUsable} to {net.LastUsable})");
}

Example 2 - Check if an IP is used by Azure (local)

var ip = "30.0.0.20";
var used = await AzureIPsProvider.Local.IsAzureIpAsync(IPAddress.Parse(ip));
Console.WriteLine($"{ip} is {(used ? "" : "not")} used by any Azure service");

Example 3 - Get all IP Networks (remote)

var networks = await AzureIPsProvider.Remote.GetNetworksAsync(AzureCloud.Public);
foreach (var net in networks)
{
    Console.WriteLine($"{net} ({range.FirstUsable} to {net.LastUsable})");
}

Example 4 - Check if an IP is used by Azure (remote)

var ip = "30.0.0.20";
var used = await AzureIPsProvider.Remote.IsAzureIpAsync(IPAddress.Parse(ip));
Console.WriteLine($"{ip} is {(used ? "" : "not")} used by any Azure service");

Issues & Comments

Please leave all comments, bugs, requests, and issues on the Issues page. We'll respond to your request ASAP!

License

The Library is licensed under the MIT license. Refer to the LICENSE file for more information.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AzureIPNetworks:

Package Downloads
Tingle.AspNetCore.Authorization

Convenience authorization functionality such as approval of IPs in AspNetCore

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 202 11/25/2024
1.9.7 221 10/21/2024
1.9.6 471 9/21/2024
1.9.5 221 9/12/2024
1.9.4 519 7/22/2024
1.9.3 380 6/24/2024
1.9.2 296 6/5/2024
1.9.1 217 5/23/2024
1.9.0 306 5/10/2024
1.8.0 330 5/5/2024
1.7.4 130 4/24/2024
1.7.3 125 3/21/2024
1.7.2 136 2/22/2024
1.7.1 134 2/17/2024
1.7.0 755 1/19/2024
1.6.0 1,006 11/15/2023
1.5.5 148 10/23/2023
1.5.4 316 9/21/2023
1.5.3 181 8/21/2023
1.5.2 173 7/21/2023
1.5.1 167 6/21/2023
1.5.0 1,495 5/30/2023
1.4.3 178 5/29/2023
1.4.2 328 4/17/2023
1.4.1 271 3/21/2023
1.4.0 923 3/13/2023
1.3.0 449 11/11/2022
1.2.0 5,507 12/3/2021
1.1.1 3,862 9/12/2021
1.1.0 1,247 6/23/2021
1.0.2 1,109 4/28/2021
1.0.1 1,735 1/18/2021
1.0.0 719 11/29/2020