Azure / Azure/azure-cli

Resource IDs containing spaces can't be consumed by other az commands

Open
#12,885 24 comments 1 reaction 1 assignee Claimed by @zhoxing-ms View on GitHub
customer-reported feature-request needs-team-attention Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

I've been trying to use a command to list all the Logic App IDs which have an Alert set up for them. To do this, I'm running 2 commands; az resource list, and az resource show. However, since az resource list returns IDs that contain spaces, az resource show will then fail.

**Command Name**
`az resource show --ids $(az resource list --resource-type Microsoft.Insights/metricAlerts --query [].id --output tsv) --query properties.scopes`

**Errors:**
`az resource: error: argument --ids: invalid ResourceId value: 'failed'`

## To Reproduce:
Create an alert against any Logic App.. make sure the Alert Name has a space in it, like 'logic-app-test-la failed'.

Run the command above.

## Expected Behavior
It should really be able to handle the encoding of the spaces so that az resource show can ingest the result of az resource list without having to resort to a Bash script to work round the problem.

## Environment Summary
```
Linux-4.15.0-1075-azure-x86_64-with-debian-stretch-sid
Python 3.6.5

azure-cli 2.2.0 *

Extensions:
interactive 0.4.4

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