Azure / Azure/azure-powershell
Get-AzFirewallPolicy does not work without parameters
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description
When running `Get-AzFirewallPolicy` I am prompted for name and resource group. Seems like this is an issue with the parameter sets for the functions.
The expected behavior when running this without any parameters is that it will list by either subscription (with no params given) or by resource group (if only resourcegroup is given).
Relevant file: https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/AzureFirewallPolicy/GetAzureFirewallPolicyCommand.cs
This section of the cmdlet seems to never be evaluated due to the parameter set: https://github.com/Azure/azure-powershell/blob/28cbcb2f16431ed569a9cee464b6043c2a0869a1/src/Network/Network/AzureFirewallPolicy/GetAzureFirewallPolicyCommand.cs#L78-L94
### Issue script & Debug output
```PowerShell
get-azfirewallpolicy
cmdlet Get-AzFirewallPolicy at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Name:
get-azfirewallpolicy -ResourceGroupName
cmdlet Get-AzFirewallPolicy at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Name:
```
### Environment data
```PowerShell
$psversionTable
Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.26120
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 4.0.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 7.11.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGateway…
Script 1.1.3 Az.Tools.Predictor {Disable-AzPredictor, Enable-AzPredictor, Open-AzPredictorSurvey, Send-AzPredictorRating}
```
### Error output
```PowerShell
N/A
```
Contributor guide
Research direction
Start with src/Network/Network/AzureFirewallPolicy/GetAzureFirewallPolicyCommand.cs, especially the parameter-set section around lines 78-94. Reproduce Get-AzFirewallPolicy with no parameters and with only -ResourceGroupName, then trace why those parameter sets prompt for Name. Done means both forms list policies at subscription or resource-group scope without prompting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, powershell
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100