azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

Add configurable process timeout for dev-time credentials

Open schaabs opened this issue 4 years ago • 2 comments

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.

schaabs avatar Aug 05 '21 17:08 schaabs

Retitled issue to align with other languages. Using this as a placeholder for the required archboard discussion.

scottaddie avatar Nov 15 '22 20:11 scottaddie

@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.

joshfree avatar Jan 09 '23 19:01 joshfree

This feature shipped in v1.9.0. See the ProcessTimeout property in the credential options bag for the following dev tool credential types:

  • AzureCliCredential
  • AzureDeveloperCliCredential
  • AzurePowerShellCredential
  • VisualStudioCredential

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

scottaddie avatar Aug 09 '23 00:08 scottaddie