'Azure CLI not showing all keyvault vaults

I created a keyvault and secrets from the MS docs and confirmed that I can list the keyvault and secrets from an Azure CLI session. When somebody else granted my access to another keyvault in our Azure tenant, I am not able to list that vault from the Azure CLI. The CLI command I am using is : 'az keyvault list' I have compared the individual policies applied in two vaults, and have 'owner' role access to both. I can see the vaults and secrets when I use a browser to navigate to the azure portal.

Thanks in advance for any suggestions on what I should check.



Solution 1:[1]

In my case, my login had expired, but unlike with other commands, I did not get a warning to that effect. It simply returned the [] empty list.

Renewing my login with az login allowed az keyvault list to work.

Solution 2:[2]

In my case I had to go to the subscription / RG where the key-vault was and give the user / service principal the Reader role. You can do that by clicking on the subscription/RG and then selecting "Access Control (IAM)" on the left side. And then add the role assignment. Instructions - https://docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal?tabs=current

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tobias J
Solution 2 Varun Sharma