Azure / Azure/azure-cli

No way to see long running API response

Open
#26,146 9 comments 0 reactions 2 assignees Claimed by @kairu-ms View on GitHub
Auto-Assign Azure CLI Team feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Related command

az networkcloud cluster deploy
az networkcloud baremetalmachine run-command

Note these are not officially released yet, and the APIs are behind AFEC.

### Resource Provider

Microsoft.NetworkCloud

### Description of Feature or Work Requested

This is a redirect from https://github.com/Azure/aaz-dev-tools/issues/233

The CLI provides interface `--no-wait` option in case it is a long running operation. When used, the CLI immediately returns back without displaying anything to the customer. This results in inability to retrieve the status of async command. Each command would need to use `--debug` to see 'Azure-AsyncOperation' header returned. This creates poor customer experience.

While `wait` command exists, it does the actual resource state polling and not sufficient for POST actions and the use case below.

`Azure-AsyncOperation` header response contains the addition properties that are returned whether the initial API is successful or failed:
- In case of a success, it may return extra details related to the action performed
- In case of a failure, it may return detailed error, which customer needs to know what went wrong with the original request.

It is especially important to have this information available as RPaaS and K8Bridge integration means all APIs are executed asynchronously and there is no way to responds back with the validation error message.

The proposal is to enhance command behavior for `--no-wait`.
Specifically, when the customer asks not to wait for the final result, the CLI should display the async header.
It would be great if it also provided a short message on how to use it, e.g., a standard `az rest --url `

### Minimum API Version Required

2022-12-12-preview

### Swagger PR link / SDK link

https://github.com/Azure/azure-rest-api-specs/tree/main/specification/networkcloud/resource-manager/Microsoft.NetworkCloud/preview/2022-12-12-preview

### Request Example

POST `https://management.azure.com/subscriptions/a3eeb848-665a-4dbf-80a4-eb460930fb23/resourceGroups/j18-6f1cd46e3bfd-HostedResources-11464C11/providers/Microsoft.NetworkCloud/bareMetalMachines/j18r750wkr7/runCommand?api-version=2022-12-12-preview`

Request body:
```
{"limitTimeSeconds": 120, "script": "ZWNobyAiaGVsbG8gd29ybGQi"}
```

Async operationStatuses response:

GET `/subscriptions/a3eeb848-665a-4dbf-80a4-eb460930fb23/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/241da922-3680-4ee9-8b6d-4a851a2cc459*A66E0C2621517814B329A506D0BD3483E80BBD701EF9F71F18EE04BFBAE62FB2?api-version=2022-12-12-preview`

Response content:
````
{
"id":"/subscriptions/a3eeb848-665a-4dbf-80a4-eb460930fb23/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/241da922-3680-4ee9-8b6d-4a851a2cc459*A66E0C2621517814B329A506D0BD3483E80BBD701EF9F71F18EE04BFBAE62FB2",
"name":"241da922-3680-4ee9-8b6d-4a851a2cc459*A66E0C2621517814B329A506D0BD3483E80BBD701EF9F71F18EE04BFBAE62FB2",
"resourceId":"/subscriptions/a3eeb848-665a-4dbf-80a4-eb460930fb23/resourceGroups/j18-6f1cd46e3bfd-HostedResources-11464C11/providers/Microsoft.NetworkCloud/bareMetalMachines/j18r750wkr7",
"status":"Succeeded",
"startTime":"2023-04-13T22:59:33.7693487Z",
"endTime":"2023-04-13T22:59:53.0027686Z",
"error":{},
"properties":{"exitCode":"0","outputHead":"====Action Command Output====\nhello world\n","resultUrl":"https://cm2p9bctvhxnst.blob.core.windows.net/bmm-run-command-output/5cb5b8be-bf92-4954-a1e2-bc61816d4a76-action-bmmruncmd.tar.gz?se=2023-04-14T02%3A59%3A50Z&sig=ZtrxoxbQ%2Fkad8W0cKzQdKIGT7Ux1C3xLm2rl3Rr7D8Y%3D&sp=r&spr=https&sr=b&st=2023-04-13T22%3A59%3A50Z&sv=2019-12-12"}
}
````

Both `errors` and `properties` content has valuable to a user information.

### Target Date

2023-06-01

### Additional context

_No response_

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.