Azure / Azure/azure-cli

Defining the subscription is mandatory sometimes

Open
#27,586 2 comments 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-codegen-extensibility-squad act-identity-squad ARM Auto-Assign Auto-Resolve Azure CLI Team Cognitive Services customer-reported question Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Subscription must be defined if you have basic user permissions to the subscription

According to the document, this should work:
Set-AzContext --SubscriptionName "1234"
az group list --output table
But it gives an empty result if you have basic permissions to the subscription.

On the other hand this works still:
Set-AzContext --SubscriptionName "1234"
az group list --output table --SubscriptionName "1234"

### Related command

Other az commands have the same issue, such as az cognitiveservices account show

### Errors

Empty result, which is wrong result

### Issue script & Debug output

Set-AzContext --SubscriptionName "1234"
az group list --output table --SubscriptionName "1234"

### Expected behavior

Lists resource groups in the subscription that you have access to.

### Environment Summary

azure-cli 2.49.0 *

core 2.49.0 *
telemetry 1.0.8 *

Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0

### Additional context

There is another defect as well with this command in an unusual environment, but I didn't figure out how to solve that.

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.