Configuring a firewall for an Azure storage account using PowerShell
In this recipe, we'll enable firewall rules for an Azure storage account using PowerShell.
Getting ready
Before you start, perform the following steps:
- Make sure you have an existing Azure storage account. If not, create one by following the Provisioning an Azure storage account using PowerShell recipe.
- Log in to your Azure subscription in PowerShell. To log in, run the
Connect-AzAccount
command in a new PowerShell window and follow the instructions.
How to do it…
The steps for this recipe are as follows:
- Execute the following command to deny access from all networks:
Update-AzStorageAccountNetworkRuleSet -ResourceGroupName packtADE -Name packtadestorage -DefaultAction Deny
You should get a similar output to that shown in the following screenshot:
- Execute the following commands to add a firewall rule for the client...