If not using the latest Az version, one might receive the following error message:
"WARNING: INITIALIZATION: Fallback context save mode to process because of error during checking token cache persistence: Persistence check fails due to unknown error.".
Hence, logic for $throttleLimit should be revised.
In the meantime, setting that variable to 1 leaves the logic for throttling out of the code, but ends up presenting an error message (despite proceeding to succeed). This is not an error but works as expected. Therefore, the Write-Error should either be a Write-Information, a Write-Warning, or nothing at all. I decided to go for Write-Warning as hopefully, there will be a fix to the original problem of throttling while not using the very latest Az version.
If not using the latest Az version, one might receive the following error message: "WARNING: INITIALIZATION: Fallback context save mode to process because of error during checking token cache persistence: Persistence check fails due to unknown error.".
Hence, logic for $throttleLimit should be revised.
In the meantime, setting that variable to 1 leaves the logic for throttling out of the code, but ends up presenting an error message (despite proceeding to succeed). This is not an error but works as expected. Therefore, the Write-Error should either be a Write-Information, a Write-Warning, or nothing at all. I decided to go for Write-Warning as hopefully, there will be a fix to the original problem of throttling while not using the very latest Az version.