Azure / Azure/azure-cli

[Feature] Build retry logic into azure-cli for rate limiting

Open
#19,264 5 comments 9 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad act-platform-engineering-squad ARM Core customer-reported feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Is your feature request related to a problem? Please describe.**

Currently azure-cli is able to do queries against API endpoints that can be rate limited. I would like azure-cli to retry based on the output of the server response, either by default or via cli argument, so I am guaranteed a command succeeds and I don't have to code a retry logic outside of azure-cli.

**Describe the solution you'd like**

I've originally reported this against the azure graph extension, but they said this should be solved in azure-cli instead: https://github.com/Azure/azure-cli-extensions/issues/3325

It seems the azure-cli is not properly dealing with rate limiting. I would expect it to wait for the amount of seconds specified in x-ms-user-quota-resets-after and try again -- or something similar at the end of the day I would like a way to make sure my az cli commands do not fail because of rate limiting. It's okay if they run longer.

There is a similar problem in https://github.com/Azure/azure-cli/issues/11891 "az commands can trigger 429 / "too many requests" failures and provides no recourse for recovery"

**Describe alternatives you've considered**

My current alternative lopp the command and check output, exit if it's a proper answer, wait random seconds if not.

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.