Azure / Azure/azure-cli

`az network vnet list` --resource-group filter does not seem to be working

Open
#18,942 2 comments 0 reactions 1 assignee Claimed by @kairu-ms View on GitHub
act-quality-productivity-squad Network Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug

**Command Name**
`az network vnet list --resource-group ...`

**Errors:**
No errors, the command just returns an empty array even though vnets are present in the resource group.

## To Reproduce:
(I'm using PowerShell in the steps below)

- $ResourceGroup = "my-resource-group"
- `az network vnet list --resource-group $ResourceGroup`

Output:
```
[]
```

Note that if I use a JMES query to do the filtering, it works:

```
az network vnet list --query "[?resourceGroup=='$ResourceGroup'].resourceGroup"
[
"my-resource-group"
]
```

## Expected Behavior

When using the `--resource-group` argument I would expect the results returned to include the vnets in the specified resource group.

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

azure-cli 2.26.1

Extensions:
aks-preview 0.5.23
application-insights 0.1.13
databricks 0.7.2

Note that I have also tried this on a machine with no extensions installed and the problem is still present.

```
## 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.