-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.TimeoutException thrown from AddAzureAppConfiguration when using DefaultAzureCredential in Azure.Identity 1.11.0 #546
Comments
Hi @JoshMcAloone, the Are there any other exceptions that you received along with this one in the console? The provider tries to log any errors that occurred before the timeout, so that might help narrow down what happened. |
Also, you might want to take a look at these breaking changes if you haven't already for version 1.11.0. If you're using managed identity this could be relevant. |
We're experiencing the same problem when running locally and the below explicit retry policy seems to solve it.
|
Hi @borislavml, I can't seem to reproduce the issue on my end with a local application. Are there any other exceptions you see? Also, is there anything else about your code/environment that may be relevant? |
We are experiencing this issue in two environments GitLab Pipeline
Local Environment
we tried adding the retry block as suggested above but it did not seem to solve the issue
Exception Details
|
I've managed to further troubleshoot the issue on my own (I can help you internally @amerjusupovic). @JoshMcAloone / @bobvaselaarchs / @borislavml - do you, by any chance, have configurations that depend on the Azure Key Vault resource, in your Azure App Configuration? In my reproduction, it seems that there is a significant delay when fetching the secret from the Azure KeyVault service. If the timeout is not set to a high value (e.g. below 100 seconds), the @amerjusupovic - to reproduce, I've set Azure.Identity to 1.11.2, Microsoft.Azure.AppConfiguration.AspNetCore to 7.10 and then set some configurations to reference an Azure KeyVault secret. The moment I stepped in the Here is my working code, after determining the cancellationToken cancelled the task: configuration.AddAzureAppConfiguration(config =>
{
config.ConfigureKeyVault(kv =>
{
kv.SetCredential(new DefaultAzureCredential(new DefaultAzureCredentialOptions()
{
Retry =
{
MaxRetries = 10,
Mode = RetryMode.Exponential,
Delay = TimeSpan.FromSeconds(30),
NetworkTimeout = TimeSpan.FromSeconds(300)
}
}));
kv.SetSecretRefreshInterval(TimeSpan.FromMinutes(30));
});
config.ConfigureClientOptions(options =>
{
options.Retry.MaxRetries = 10;
options.Retry.Mode = RetryMode.Exponential;
options.Retry.Delay = TimeSpan.FromSeconds(30);
options.Retry.NetworkTimeout = TimeSpan.FromSeconds(300);
});
var connectionString = configuration["ConfigurationStore"];
config.Connect(connectionString);
}); |
@arolariu yes, indeed, we do have key vault references in the app config. And yes we also saw it works with the custom retry policy on the |
@arolariu Yes we also have Key Vault references in the App Configuration. |
we were able to resolve the issue with by passing the following options to the
Not sure which one precisely was causing it but eliminating ones that are definitely unneeded might be a place to start. |
Thank you everyone for contributing, it's been very helpful in finding where exactly this is happening but I'm still trying to understand why it happens in the provider. I've been able to reproduce the issue and see everything that's been mentioned here. However, I found that even just passing in options.ConfigureKeyVault(kv =>
{
kv.SetCredential(new DefaultAzureCredential(new DefaultAzureCredentialOptions()));
}); |
Yes, @arolariu our app configuration is tied to a key vault |
Another update: I've been able to reproduce this outside of the provider code, just by creating instances of For now, the best solution is to create a single credential variable and reuse it for both the calls to |
Fix was released in SDK repo |
Library names and versions
Microsoft.Azure.AppConfiguration.AspNetCore 7.1.0
Azure.Identity 1.11.0
Describe the bug
After upgrading Azure.Identity from 1.10.4 to 1.11.0, an exception is always thrown by AddAzureAppConfiguration in Startup.cs in my Azure Functions project.
This is how the Startup looks:
This is the exception:
After reverting Azure.Identity to 1.10.4 again, there are no issues starting the application.
The text was updated successfully, but these errors were encountered: