Azure / Azure/azure-cli

Managing Tenant-Level Resources

Open
#24,146 2 comments 0 reactions 2 assignees Claimed by @jiasli View on GitHub
Account act-identity-squad ARM Auto-Assign Azure CLI Team customer-reported feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

#### Describe the bug

I'm trying to get a grasp of using Azure's API coming from AWS... I can successfully run `az login` to authenticate to one of my organization's Azure subscriptions then run something like `az group list` to list the resource-groups associated with that subscription.

I'm running into an issue where I'm trying to manage tenant-level resources.

Example:

I want to manage the secret for a particular App Registration application. I'm internally told to login to the tenant like so:

`az login --tenant --allow-no-subscriptions`.

Then when I run `az account list -o table` I notice that I have successfully authenticated to the tenant specific account.

```bash
Name CloudName SubscriptionId TenantId State IsDefault
------------------------- ----------- ---------------- ---------- ------- -----------
SubscriptionA AzureCloud abc-1234 12309481230948 Enabled False
SubscriptionB AzureCloud abc-9893 23980805458034 Enabled False
N/A(tenant level account) AzureCloud abc-9999 48230482309482 Enabled True
```

My issue/question arises when I'm trying to use the CLI to query the "tenant". I constantly receive errors like the one below.

**Errors:**
```
(SubscriptionNotFound) The subscription 'abc-9999' could not be found.
Code: SubscriptionNotFound
Message: The subscription 'abc-9999' could not be found.
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- Login to a tenant directory using Azure CLI ( `az login --tenant --no-allow-subscriptions`
- Attempt to run anything. For example: `az group list`

## Expected Behavior

- See the resources associated with the tenant

## Environment Summary
```
macOS-12.6-x86_64-i386-64bit, Darwin 21.6.0
Python 3.10.6
Installer: HOMEBREW

azure-cli 2.40.0

Extensions:
account 0.2.5

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
```
## 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.