Generating Azure Firewall Policy Rules and VNet and Subnet configuration CSVs and JSONs

Those who have worked with an Azure Firewall will know that there isn’t an easy way to export all the firewall rules from the GUI and trying to navigate within the GUI to each firewall rule isn’t an effective way review the configuration. What I’ve done in the past is to use a PowerShell script to create a CSV and JSON export, which will export all of the rules as well as handle any that uses IP Groups so that additional columns for the IP Group Name and IP Group addresses are extracted. This script can be found here in my GitHub repo: https://github.com/terenceluk/Azure/blob/main/Firewall/Get-Firewall-Rules.ps1

Additionally, it’s also useful to retrieve the VNets and subnet information and that can be exported with this script: https://github.com/terenceluk/Azure/blob/main/Firewall/Get-VNet-Subnet.ps1

The following screenshots of the console, code snippet, and output of these scripts:

Get-Firewall-Rules.ps1

Get-VNet-Subnet.ps1

Hope this helps anyone who may be looking for these scripts.