Azure Public IP Prefixes – Static IP Ranges
Azure offered the ability to get static public IP addresses for many years now, however, when you request an IP you will receive one from the general pool of available addresses and it is very unlikely you will receive multiple IPs in the same range. A new Public IP Prefixes feature is a reserved range of IP addresses for your public endpoints in Azure.
Instead of requesting a single static IP you can request a Prefix, which will give you a contiguous range of IP addresses. You can then assign IP’s from this range to your VM’s, Load Balancers and other resources. The benefit of this is that you get a contiguous range of IP’s that you know the addresses of upfront, which you can then allocate as required. This means that if you need to work with customers of service providers to whitelist your IP’s you can now do this with a set range, rather than having to update this each time you create a new IP in Azure.
Benefits
- You can create public IP address resources from a known range.
- You, or your business partners can create firewall rules with ranges that include public IP addresses you’ve currently assigned, as well as addresses you haven’t assigned yet. This eliminates the need to change firewall rules as you assign IP addresses to new resources.
- The default size of a range you can create is /28 or 16 IP addresses.
- There are no limits as to how many ranges you can create, however, there are limits on the maximum number of static public IP addresses you can have in an Azure subscription. As a result, the number of ranges you create can’t encompass more static public IP addresses than you can have in your subscription. For more information, see Azure limits.
- The addresses that you create using addresses from the prefix can be assigned to any Azure resource that you can assign a public IP address to.
- You can easily see which IP addresses that are allocated and not yet allocated within the range.
Restrictions
- You can’t specify the IP addresses for the prefix. Azure allocates the IP addresses for the prefix, based on the size that you specify.
- You can create a prefix of upto 16 IP addresses or a /28. For more information, see Azure limits.
- You can’t change the range, once you’ve created the prefix.
- The range is for IPv4 addresses only. The range does not contain IPv6 addresses.
- Only static public IP addresses created with the Standard SKU can be assigned from the prefix’s range. To learn more about public IP address SKUs, see public IP address.
- Addresses from the range can only be assigned to Azure Resource Manager resources. Addresses cannot be assigned to resources in the classic deployment model.
- All public IP addresses created from the prefix must exist in the same Azure region and subscription as the prefix, and must be assigned to resources in the same region and subscription.
- You can’t delete a prefix if any addresses within it are assigned to public IP address resources associated to a resource. Dissociate all public IP address resources that are assigned IP addresses from the prefix first.
Create an IP Prefix from Azure Portal
- Click create a new resource
- Search for “Public IP Prefix”
- Click “Create”
- In the window that opens select a resource group to deploy to then enter a name for your range and a region
- In the prefix size drop-down, select the size of the range you wish to create
Command Line
PowerShell
In the Cloud Shell use the following to create a Public IP Prefix. Just make sure you change the parameters to what you need.
New–AzureRmPublicIpPrefix–Name PixelIPRange –ResourceGroupName Networking –location “WestEurope” –PrefixLength 28
|
Azure CLI
In the CloudShell make sure you are in the Bash mode and use the following. Just make sure you change the parameters to what you need.
az network public–ip prefix create —name CLIIPRange —resource–group Networking —location “West Europe” —length 28
|
Source Reference: https://samcogan.com/static-ip-ranges-with-azure-public-ip-prefixes/