Azure / Azure/azure-powershell

can not use $azfw.PrivateRange

Open
#14,602 4 comments 0 reactions 0 assignees View on GitHub
act-quality-productivity-squad Network - Firewall question Service Attention
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.

![image](https://user-images.githubusercontent.com/37136042/111754803-c0df3100-88db-11eb-868f-aa3c1843c8c1.png)

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.