Share via

list all storage account with public network access set to "Enabled from all networks"

Prince Rastogi Admin Account 21 Reputation points
2022-10-14T19:55:53.277+00:00

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.

Azure Storage
Azure Storage

Globally unique resources that provide access to data management services and serve as the parent namespace for the services.


7 answers

Sort by: Most helpful
  1. AntonioScordo-8037 20 Reputation points
    2023-07-24T17:51:16.72+00:00

    az storage account list --query "[].{resourcegroup:resourceGroup, name:name, allowBlobPublicAccess:allowBlobPublicAccess}" --output table

    this works.

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments

  2. Aman Garg 36 Reputation points
    2023-01-05T13:18:30.473+00:00

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

    Was this answer helpful?

    2 people found this answer helpful.

  3. Prince Rastogi Admin Account 21 Reputation points
    2022-10-17T16:03:03.26+00:00

    Found an another way to achieve the same which is much simple for me: Resource Graph Explorer

    thanks!

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments

  4. Prince Rastogi Admin Account 21 Reputation points
    2022-10-16T02:32:26.033+00:00

    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!

    Was this answer helpful?


  5. SaiKishor-MSFT 17,341 Reputation points Moderator
    2022-10-14T22:02:57.767+00:00

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

    Was this answer helpful?

    0 comments No comments

Your answer

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