WillyMoselhy / AzureFirewallPolicyExportImport

Azure Firewall Policy Export and Import
MIT License
0 stars 1 forks source link

Default 'FirewallPolicies.csv' file missing #1

Open sjackson0109 opened 6 months ago

sjackson0109 commented 6 months ago

It appears your template CSV file is missing from the repo; likely you excluded it from the import.

I figured you should be aware:

.\Export-AzureFirewallPolicyRulesToCsv.ps1 -FirewallPolicyId "/subscriptions/$SUBSCRIPTIONID/resourceGroups/$RG/providers/Microsoft.Network/firewallPolicies/$POLICYID"
Export-Csv : Could not find a part of the path '....\AzureFirewallPolicyExportImport\src\src\FirewallPolicies.csv'.
At ....\AzureFirewallPolicyExportImport\src\Export-AzureFirewallPolicyRulesToCsv.ps1:58 char:18
+ $policySummary | Export-Csv -Path $OutputCSVPath
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Export-Csv], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.ExportCsvCommand

I can create a new CSV, but what are the column headings?

Maybe provide an argument for --OutputFileName.. So we can call this on loop, through half a dozen nested firewall policies...

sjackson0109 commented 6 months ago

OK 2 more problems.

Your Export-AzureFirewallPolcyRulesToCSV.ps1 file is located inside the src sub-folder. Yet line #6 of that file reads $OutputCSVPath = '.\src\FirewallPolicies.csv'

I updated this path to $OutputCSVPath = '.\FirewallPolicies.csv' , as there isn't a second nested src sub-folder.

I also created a new, empty, file FirewallPolicies.csv in the src folder. The export command now works.

WillyMoselhy commented 6 months ago

Thanks for the tip, I haven't touched this repo in a while. I will update its ASAP!