Azure / Azure/azure-cli

Same CLI query (az resource list) returns different results in cloud shell vs. local

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

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug

**Command Name**
`az resource list`

**Errors:**
```
Local results fewer than identical query run in cloud shell.

The query run locally (including in GitHub hosted Actions runner) does not return Microsoft.Compute/virtualMachines or Microsoft.network/networkInterfaces resources that are in the RG. The same query run in cloud shell does return those resources.

```

## To Reproduce:
Using Azure CLI 2.34.1 in both local (WSL2, Ubuntu 20.04) and cloud shell.

This exact query:
```
az resource list --subscription "4ca1851f-9d7a-456e-b346-1709991ecaff" -g "pz-vm-prod-eastus2" -o tsv --query '[].id'
```

Returns fewer results locally than in cloud shell.

## Expected Behavior
Local returns all results in resource group, matches cloud shell output.

## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.8.9
Installer:

azure-cli 2.34.1
```
## Additional Context

Also I did the following repeatedly locally:
az logout
az cache purge
az account clear
and deleted ~/.azure.

Also note that I updated my computer to Python 3.10 x64, but az --version output in WSL2 still shows Python x86 3.8.9.

Adding files:
- rg.png - showing the contents of the resource group in question, with hidden resources displayed
- local.png - local az cli query output
- cloud_shell.png - cloud shell az cli query output
- az_version_local.png - local az --version
- az_version_cloud_shell.png - cloud shell az --version
- local_debug.txt - local az cli query output with --verbose --debug

![rg](https://user-images.githubusercontent.com/35011873/161064286-87029905-102a-4855-9077-061c0c0e7b6b.png)

![local](https://user-images.githubusercontent.com/35011873/161064302-ec6a296e-1236-4e8e-928d-43cf144cb1dc.png)

![cloud_shell](https://user-images.githubusercontent.com/35011873/161064322-5051d904-ce30-4c82-900c-0183ff61ed2f.png)

![az_version_local](https://user-images.githubusercontent.com/35011873/161064334-2b90666e-270b-4129-89bf-fec7b3ab7dd1.png)

![az_version_cloud_shell](https://user-images.githubusercontent.com/35011873/161064342-2909fed1-eee1-4f6b-b72a-fab6e6c0462e.png)

[local_debug.txt](https://github.com/Azure/azure-cli/files/8389713/local_debug.txt)

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.