We are in the process of rolling out Redis with AAD Authentication for our service. However, we started seeing SocketException failures when trying to establish a new connection:
Note: We are using DefaultAzureCredential() to authenticate and SDK version in 2.0.0
await options.ConfigureForAzureWithTokenCredentialAsync(authToken.ObjectId, new DefaultAzureCredential());
ConnectionMultiplexer multiplexer = await ConnectionMultiplexer.ConnectAsync(options).ConfigureAwait(false);
Connection failed with MI: **System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.0.5.9:2377** **07-10-2024 15:10:49**
Investigating this failure, we found that the token used to authenticate has an expiration date of:
AccesTokenExpirationDate=7/11/2024 3:05:08 PM
This might correlate with the auth failure on 07/10 15:10PM, since the token expires every 24 hrs probably around that period of time the SDK was refreshing a new token and hence the failures during the connection attempt? However, my understanding is that Microsoft.Azure.StackExchangeRedis will refresh the token when 75% of the lifetime of the current token has passed.
Hello,
We are in the process of rolling out Redis with AAD Authentication for our service. However, we started seeing SocketException failures when trying to establish a new connection:
Note: We are using DefaultAzureCredential() to authenticate and SDK version in 2.0.0
Connection failed with MI: **System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.0.5.9:2377** **07-10-2024 15:10:49**
Investigating this failure, we found that the token used to authenticate has an expiration date of: AccesTokenExpirationDate=7/11/2024 3:05:08 PM
This might correlate with the auth failure on 07/10 15:10PM, since the token expires every 24 hrs probably around that period of time the SDK was refreshing a new token and hence the failures during the connection attempt? However, my understanding is that Microsoft.Azure.StackExchangeRedis will refresh the token when 75% of the lifetime of the current token has passed.
The connection then succeded around 15:16PM: