Found an another way to achieve the same which is much simple for me: Resource Graph Explorer
thanks!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Is there any way in PowerShell or CLI to list all storage accounts from a subscription to list all storage account with public network access set to "Enabled from all networks"?
As per my check this option is not available on Portal.
Found an another way to achieve the same which is much simple for me: Resource Graph Explorer
thanks!
Resource Graph Explorer query for the same:
resources
| where type == "microsoft.storage/storageaccounts"
| extend d = parse_json(properties)
| project name,publicNetworkAccessstatus = d.publicNetworkAccess
Just in case someone revisits the page with requirement.]
az storage account list --query "[].{resourcegroup:resourceGroup, name:name, allowBlobPublicAccess:allowBlobPublicAccess}" --output table
this works.
@Prince Rastogi Admin Account Thanks for reaching out to Microsoft Q&A.
You can use- az storage account show (https://learn.microsoft.com/en-us/cli/azure/storage/account?view=azure-cli-latest)
This shows the storage account properties which includes the -PublicNetworkAccess property. You will have to write a script that can list all the storage accounts in your subscription and then their properties to achieve this. (https://learn.microsoft.com/en-us/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-list-examples)
Please let us know if you have any more questions and we will be glad to assist you further. Thank you!
Remember:
Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
Want a reminder to come back and check responses? Here is how to subscribe to a notification.
I am using this command to list out accounts: az storage account list --query "[].{resource:resourceGroup, name:name}" --output table
& want to add allowblobpublicaccess under query. I ran below statement but it is not working:
az storage account list --query "[].{resource:resourceGroup, name:name, resource:allowblobpublicaccess}" --output table
any idea, what is the correct way to add allowblobpublicaccess under query?
thanks!