Search code examples
azureazure-storageazure-cli

`az storage account list` returns an empty list although it had worked in the past


I have logged in using

az login

But now

az storage account list

returns an empty list. I am using a number of different accounts presently on synapse and azure including from within the local Pycharm and on the ms.portal, synapse and dev websites. So why has this stopped working?

Here is my version

az --version
azure-cli                         2.53.0

core                              2.53.0
telemetry                          1.1.0

Dependencies:
msal                            1.24.0b2
azure-mgmt-resource             23.1.0b2

Python location '/usr/local/Cellar/azure-cli/2.53.0/libexec/bin/python'
Extensions directory '/Users/stephenboesch/.azure/cliextensions'

Python (Darwin) 3.10.13 (main, Aug 24 2023, 22:48:59) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Here is az account show

$az account show
{
  "environmentName": "AzureCloud",
  "homeTenantId": "*****b47",
  "id": "****499",
  "isDefault": true,
  "managedByTenants": [],
  "name": "Azure Portal Telemetry Reporting",
  "state": "Enabled",
  "tenantId": "*******b47",
  "user": {
    "name": "my-name@my-company.com",
    "type": "user"
  }
}

Solution

  • az storage account list returns an empty list.

    I also get the same empty list in my environment when I try with all the below commands.

    az account clear 
    az login
    az account set --subscription "xxxxx"
    

    When I tried with the same command az storage account list.

    PS C:\Users\xxx> az storage account list                                           
    []
    PS C:\Users\xxx> 
    

    The above command takes a particular resource group that doesn't have a storage account in your environment.

    Check with az config get it will show if you have a default resource group.

    If it is there try to remove it by using the below command:

    az config unset defaults.group
    

    The above command removes the default resource group.

    Now I ran the same command, and it shows me all storage accounts:

    Output: enter image description here

    Update:

    Please try with again with az login and az account set --subscription "xxxxx" commands in your environment.

    Reference:

    az storage account list is not listing all storage accounts by evelyn-ys.