Basically I would like to toggle this setting via Azure CLI on an azure storage account that has already been created.
I need to toggle from Enabled(Selected Networks) to Enabled ( All Networks) and vice versa.
I tried to reproduce the same in my environment and got the below results:
I have one storage account where public network access is "Enabled from selected virtual networks" like below:
To toggle from "Enabled from Selected Networks" to "Enabled from All Networks" via Azure CLI, you can make use of below command:
az storage account update --resource-group group_name --name accountname --default-action Allow
I ran the above command in Azure Cloud Shell
where it toggled to "Enabled from All Networks" after one refresh like below:
Now, to toggle from "Enabled from All Networks" to "Enabled from Selected Networks" via Azure CLI, you can make use of below command:
az storage account update --resource-group group_name --name accountname --default-action Deny
When I ran the above command, it again changed to "Enabled from Selected Networks" after one refresh like below: