Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Azure PowerShell Get-AzStorageShare Could not get the storage context

While working with Azure Storage Account Shares report, while running below Azure az PowerShell command to get shares list, it was throwing error.

Get-AzStorageShare -Name testbackup
Get-AzStorageShare: could not get the storage context. Please pass in a storage context or set the current storage context.

Solution: To resolve this error message and get the information about shares, you will need to use storage account as context in the shares, as shown in below one liner command.

Get-AzStorageShare -Name  -Context (Get-AzStorageAccount -Name  -ResourceGroupName ).context

Useful Articles
Create Key Vault and secrets with access policies in Microsoft Azure
Working With Azure Key Vault Using Azure PowerShell and AzureCLI
Use Key Vault secret identifier url to get the secret value using Powershell
Use a Azure VM system assigned managed identity to access Azure Key Vault
Create Azure Key Vault Certificates on Azure Portal and Powershell
Export certificates from Azure Key Vault using PowerShell



This post first appeared on Tales From Real IT System Administrators World And Non-production Environment, please read the originial post: here

Share the post

Azure PowerShell Get-AzStorageShare Could not get the storage context

×

Subscribe to Tales From Real It System Administrators World And Non-production Environment

Get updates delivered right to your inbox!

Thank you for your subscription

×