Azure / Azure/azure-cli

az role assignment list retuns "subscription could not be found" in tenant without subscription

Open
#19,063 2 comments 1 reaction 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad feature-request RBAC
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

The CLI command "az role assignment list" returns the following error:
"The subscription '$tenantid' could not be found."

**Command Name**
`az role assignment list`

**Errors:**
```
The subscription '$tenandid' could not be found.
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Log into a tenant without subscriptions (e.g. MS365/AD tenant)
- `az role assignment list --all` --> returns an error
- Listing assignments works without issue in the portal
- Note1: Also fails when run with PowerShell
- Note2: Other commands express the same behavior

## Expected Behavior
- az role should query the tenant when there are no subscriptions.

## Environment Summary
```
Linux-5.4.0-80-generic-x86_64-with-glibc2.29
Python 3.8.10
Shell: bash

azure-cli 2.0.81

Extensions:
azure-devops 0.17.0

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.