azure-sdk-for-net
azure-sdk-for-net copied to clipboard
Add configurable process timeout for dev-time credentials
We still have reports of credentials which spawn subprocesses, specifically AzurePowerShellCredential and AzureCliCredential, still timing out in some environments despite having increased the timeouts. From a user account of debugging such an issue.
Also, I copied the AzurePowerShellCredential code to my project and played with the timeout value. When the timeout is reduced from 10 seconds to 6 seconds, then the timeout always happens. When the timeout is increased from 10 seconds to 20 seconds, then the timeout never happens. This leads me to believe that there is no sinister race condition bug or a deadlock bug or something like that. It's just that PowerShell (or Azure CLI) starts up slow.
In order to make these credentials more resilient in various environments we should make this timeout configurable and possibly consider extending the default timeout a bit more.
Retitled issue to align with other languages. Using this as a placeholder for the required archboard discussion.
@scottaddie would you mind filing the issues for the other languages and making sure they're added to the github project?
Edit: nevermind, I see they exist, just that they were in a different milestone.
This feature shipped in v1.9.0. See the ProcessTimeout property in the credential options bag for the following dev tool credential types:
AzureCliCredentialAzureDeveloperCliCredentialAzurePowerShellCredentialVisualStudioCredential
For example:
https://github.com/Azure/azure-sdk-for-net/blob/3294e7ee85814145bb30aadd42cb682d86936020/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredentialOptions.cs#L29
Additionally, there's a CredentialProcessTimeout property in the DefaultAzureCredential options bag, which applies to all of the aforementioned dev tool credential types.
https://github.com/Azure/azure-sdk-for-net/blob/3294e7ee85814145bb30aadd42cb682d86936020/sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredentialOptions.cs#L206