Use PowerShell to enable Azure Storage Account Firewall Rules

In this post I’ll show you how to Use PowerShell to enable Azure Storage Account Firewall Rules.

Be sure to be have AzureRM PowerShell 4.4.1 module installed.

Login to your Azure Account

Launch Powershell and start by Login to your Azure Account.

1    Login-AzureRmAccount

Set Resource Group and Storage Account Name Variables

Set the following variables

1    $resourceGroupName = "[THE NAME OF THE RESOURCE GROUP]"
2    $storageAccountName = "[THE NAME OF THE STORAGE ACCOUNT]"

Enable the Firewall

To enable the firewall you’ll need to Deny all trafic to the storage account using the DefaultAction parameter and then allow Azure Services to connect to it with the Bypass parameter.

1    Update-AzureRmStorageAccountNetworkRuleSet -ResourceGroupName $resourceGroupName -Name $storageAccountName -DefaultAction Deny -Bypass AzureServices,Metrics,Logging

To allow an IP Address or an IP Address range you can run the following commands changing the value of the IPAddressOrRange parameter:

1    Add-AzureRMStorageAccountNetworkRule -ResourceGroupName $resourceGroupName -AccountName $storageAccountName -IPAddressOrRange "" 
1    Add-AzureRMStorageAccountNetworkRule -ResourceGroupName $resourceGroupName -AccountName $storageAccountName -IPAddressOrRange "" 

Hope it helps!

Use PowerShell to Enable and Automate Azure Analysis Services Backup
Use PowerShell to create a Microsoft Teams Channel
comments powered by Disqus