Azure / Azure/azure-powershell
can not use $azfw.PrivateRange
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
## Description
When I used below command in order to add private address range on Azure Firewall, the operation was failed.
m> $azfw = Get-AzFirewall -Name AZFW01 -ResourceGroupName NVA-rg1
PS C:\Users\ishiyam> $azfw.PrivateRange = @("255.255.255.255/32")
Exception setting "PrivateRange": "'255.255.255.255/32' is not a valid private range ip address, bits not covered by subnet mask should be all 0"
At line:1 char:1
+ $azfw.PrivateRange = @("255.255.255.255/32")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
When I used other range, the command was successful.
PS C:\Users\ishiyam> $azfw.PrivateRange = @("200.200.200.200/32")
PS C:\Users\ishiyam>
I also confirmed that I could add the range "255.255.255.255/32" from Portal so this is bug of powershell.

I think this source is related to this issue.
https://github.com/Azure/azure-powershell/blob/master/src/Network/Network/Models/AzureFirewall/PSAzureFirewall.cs
## Environment data
PS C:\Users\ishiyam> Get-InstalledModule -Name Az -AllVersions | select Name,Version
Name Version
---- -------
Az 5.6.0
Contributor guide
Research direction
Reproduce the assignment with Get-AzFirewall and the 255.255.255.255/32 range, then inspect src/Network/Network/Models/AzureFirewall/PSAzureFirewall.cs, which the report identifies as related. Compare it with the successful 200.200.200.200/32 assignment and the Azure Portal behavior. Done means the PowerShell object accepts the reported range consistently with the portal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, powershell
- Domain
- cloud, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100