Using Azure PowerShell how can I export the Firewalls and virtual networks settings to .CSV file?

Using Azure PowerShell how can I export the Firewalls and virtual networks settings to .CSV file?

@EnterpriseArchitect, Apologies for delay in response. Here is the PS script to export the Firewalls and Virtual network rules accordingly,
For Firewall Rules,
$Firewall = Get-AzSqlServerFirewallRule -ResourceGroupName "RG-Name" -ServerName "Server-Name"
$FirewallOutput = $Firewall | ForEach-Object {
[PSCustomObject]@{
"ResourceGroupName" = $_.ResourceGroupName
"ServerName" = $_.ServerName
"StartIpAddress" = $_.StartIpAddress
"EndIpAddress" = $_.EndIpAddress
"FirewallRuleName" = $_.FirewallRuleName
}
}
$FirewallOutput | export-csv /home/subhash/data.csv -delimiter ";" -force -notypeinformation
For Virtual Network rules,
Get-AzSqlServerVirtualNetworkRule -ResourceGroupName "RG-Name" -ServerName "Server-Name"
Copy the above the script script and replace the attributes accordingly to export them to CSV files.
Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.
Hi @suvasara-MSFT thank you for the update.
May I know how can I get the detailed FW rule that is mentioned in the FirewallRuleName column?

Because when I execute the below line:
Get-AzSqlServer | Get-AzSqlServerVirtualNetworkRule | ogv
it is still asking for ServerName and ResourceGroupName.
This script also not showing up the result in a table format:
& {
ForEach ($AzSQLServer in $(Get-AzSqlServer) ) {
Get-AzSqlServerVirtualNetworkRule -ServerName $AzSQLServer.ServerName -ResourceGroupName $AzSQLServer.ResourceGroupName
}
} | ft -AutoSize
12 people are following this question.