Could someone help in getting me the equivalent PowerShell command for the below Az command?
az network firewall policy rule-collection-group list --policy-name <policyname> --resource-group <RG_Name>
The requirement for me is to configure an automation account PowerShell runbook which will extract all the firewall rules and store as a file in blob. The script should run daily and retain the last 7 days file in blob.
I am not able to find the PowerShell command to fetch all the available Rule Collections. I can fetch ONLY if I pass the collection name as a parameter in cmdlet. Ex: (Get-AzFirewallPolicyRuleCollectionGroup -Name <Col_Name> -ResourceGroupName <RG_Name> -AzureFirewallPolicyName <Pol_Name>).Properties.RuleCollection
I should not pass the Collection name, as the collection may add or remove in daily run. I also tried the below possible PowerShell command, but it returns nothing.
$colids=(Get-AzFirewallPolicy -Name <Pol_Name> -ResourceGroupName <RG_Name>).rulecollectiongroups
foreach($colid in $colids)
{
Get-AzFirewallPolicyRuleCollectionGroup -ResourceId $colid.id
}
Passing the resource ID of rule collection group directly for -ResourceId also returns nothing.