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

EnterpriseArchitect 5,376 Reputation points
2021-07-21T07:34:14.527+00:00

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

116598-image.png

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,427 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. suvasara-MSFT 10,041 Reputation points
    2021-07-26T10:50:25.637+00:00

    @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.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.