Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 2.99k forks source link

Using Az resource list to select web apps returns duplicates #25214

Open KSchlobohm opened 1 year ago

KSchlobohm commented 1 year ago

Describe the bug

Running az resource list will return duplicate results for web apps, and Azure SQL resources. Tried filtering results by name, and found that it returned results with the same ID.

Command Name az resource list

To Reproduce:

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

Actual Behavior

Two web apps are returned

[
  "app-web-i4ugtihr2mwwm",
  "app-web-i4ugtihr2mwwm"
]

Expected Behavior

Single web app is returned

Environment Summary

Windows-10-10.0.22621-SP0
Python 3.10.8
Installer: MSI

azure-cli 2.44.1

Additional Context

yonzhan commented 1 year ago

@zhoxing-ms for awareness

KSchlobohm commented 1 year ago

this may be an azd specific issue

KSchlobohm commented 1 year ago

I just created a key vault with az keyvault create --location $Location --name $keyVaultName -g $resourceGroupName and I see the same issue. When i run the query az resource list -g $resourceGroupName --query "[? name=='$keyVaultName'].name"

This does not appear to be limited to azd deployments.

Actual Behavior

[
  "kv-ops-randomName",
  "kv-ops-randomName"
]

Expected Behavior

[
  "kv-ops-randomName"
]

Additional context

Used the Azure Portal to confirm there is only one KV with this name. $Location='eastus' for this sample

KSchlobohm commented 1 year ago

The following scenario returns 1 row as expected

az resource list -g $resourceGroupName --query "[? name=='$keyVaultName'].name | [0]"