question

ka-2597 avatar image
0 Votes"
ka-2597 asked SumanthMarigowda-MSFT commented

Unable to retrieve storage account properties using PowerShell



Unable to retrieve storage account properties using PowerShell

Running this PowerShell command

Connect-AzAccount
$sa = Get-AzStorageAccount -ResourceGroupName "myResourceGroup" -Name "mySA"
$sa | Format-List -Property *


Most of the properties sow up empty. For example: I see the Minimum TLS Version set to TLS 1.0 in the UI but the property shows empty in the output of the command above

115562-untitled.png


azure-storage-accounts
untitled.png (50.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ManuPhilip avatar image
0 Votes"
ManuPhilip answered ka-2597 commented

Try the following code. You have to construct a variable which has storage account context registered
$StorageAccountName = "Your SG Name"
$StorageAccountKeyPrimary = "Your Key"
$StorageContext = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKeyPrimary
$StorageContext | Format-List -Property *

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your response. Storage account keys are not allowed in the environment I am working in.

0 Votes 0 ·
ManuPhilip avatar image
0 Votes"
ManuPhilip answered SumanthMarigowda-MSFT commented

you may pass the key within the code with the following code change

 $StorageAccountName = "Your SG Name"
 $Resourcegroupname ="Your RG Name"
 $StorageAccountKeyPrimary = get-azstorageaccountkey -storageaccountname $StorageAccountName -resourcegroupname $Resourcegroupname
 $StorageAccountKeyPrimary = $StorageAccountKeyPrimary[0].value 
 $StorageContext = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKeyPrimary
 $StorageContext | Format-List -Property *
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.