Azure / Azure/azure-powershell
[Feature]: Add retry logic to all Az cmdlets
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description of the new feature
When having PowerShell scripts running every 10 minutes 24x7 you get a lot of strange errors. Sometimes the backend API endpoint times out and does not respond, but will respond if you try again.
* Some resource providers seems less stable than others. In my experience `Microsoft.OperationalInsights` is more problematic than others, as in API (and thus Az cmdlets) more often fails.
* I've had this happen to something as simple as `Get-AzResource -ResourceId`
In important scripts I've had to create my own retry logic, but it would be even better if Az cmdlets got some built-in retry logic instead. Like what [`Invoke-RestMethod`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.4) currently have with parameters `-MaximumRetryCount` and `-RetryIntervalSec`. Or set some global settings for current session that all Az cmdlets will adhere to.
If it can't be done with all Az cmdlets, at least add retry logic to [`Invoke-AzRestMethod`](https://learn.microsoft.com/en-us/powershell/module/az.accounts/invoke-azrestmethod)?
### Proposed implementation details (optional)
_No response_
Contributor guide
Research direction
The issue names Invoke-AzRestMethod and the Az cmdlets; begin by tracing how that entry point handles API failures and compare its options with Invoke-RestMethod's retry parameters. Done means an agreed retry policy or session setting is implemented consistently, or the scope is narrowed to Invoke-AzRestMethod.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- api, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100