Search code examples
azure-storageazure-cli

Azure Storage Account (classic) access using only the Account Name?


I need to use either CLI or PowerShell (ARM) to retrieve the key from an Azure Storage Account (classic). The only challenge here is that I'm given only the storage account name and subscription.

With Get-AzStorageAccount and Get-AzStorageAccountKey, I need to provide the Resource Group, which I don't have. The az storage account show-connection-string command only works with ARM resources but not classic storage.


Solution

  • you can use something like this:

    Get-AzResource -ResourceType "Microsoft.ClassicStorage/StorageAccounts" | Where-Object {
        $_.Name -eq $your_storage_account_name
    }
    

    to find out that information