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 <ShareName> -Context (Get-AzStorageAccount -Name <StorageAccountName> -ResourceGroupName <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