Sau001
Sau001

Reputation: 1664

Why does AllowBlobPublicAccess of Get-AzStorageAccount cmdlet return NULL when it is clear that public access is enabled?

I was running the cmdlet Get-AzStorageAccount on a storage account to test whether public access is enabled.

Azure portal

enter image description here

Azure PowerShell

enter image description here

Similar results via CLI

az storage account show -g MyResourceGroup -n MyStorageAccount

enter image description here

Question

For a while I was under the impression that the cmdlet works only on StorageV2 accounts. But, I can confirm that this is not the case. The cmdlet is inconsistent with both StorageV2 and General purpose V1 accounts.

I am unable to understand the reason for the inconsistent behaviour of the cmdlet Get-AzStorageAccount w.r.t property AllowPublicBlobAccess ?

thank you,

Sau

Upvotes: 1

Views: 980

Answers (1)

unknown
unknown

Reputation: 7483

As the document shows in the Note:

The AllowBlobPublicAccess property is not set by default and does not return a value until you explicitly set it. The storage account permits public access when the property value is null or when it is true.

You need to disable it and save, then enable it. The property will be true that you want.

enter image description here

Upvotes: 2

Related Questions