Skip to content

Azure-CLI Rest Support Endpoints that return 202 #32141

@Klaas-

Description

@Klaas-

Related command
Currently if you have a put/patch request that is async, azure cli will just exit without showing anything because the response is empty.

$ az rest --method put --url https://management.azure.com/subscriptions/..../resourceGroups/..../providers/Microsoft.HybridCompute/machines/.../extensions/AzureMonitorLinuxAgent?api-version=2025-01-13 --body @arcextension.json add --debug if you want to see whats really happening.

It sends a 202 response and a header:
'Azure-AsyncOperation': 'https://management.azure.com/...'

which you need to poll until it's finished

I would like azure-cli rest to include this automatically, maybe behind a feature switch, to wait for the operation to finish. --wait-for-async or whatever :)

Is your feature request related to a problem? Please describe.
Right now you need to enable debug and manually get the url from there, then wait for it to finish etc

Describe the solution you'd like
New functionality that hides behind a arg option:
az rest --method put --url https://management.azure.com/subscriptions/..../resourceGroups/..../providers/Microsoft.HybridCompute/machines/.../extensions/AzureMonitorLinuxAgent?api-version=2025-01-13 --body @arcextension.json --wait-for-async

Additional context
The endpoint I have selected is just an example, there are tons more that are async.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions