It can be issue from .net end mostly ,in .NET Core 3.0.100 or 3.1. This seems to occur when running under the debugger in Visual Studio mostly and when long parallel calls are made and retrypolicy may help stop this from giving exception for sometime and tries again.
So Please try to Upgrade/Update the .NET Project SDK if any updates
available in Visual Studio.
Try running with command line
Also in the message of error you can see retry faild after 4 tries..
You can check ReloadInterval Property which is used in 3.0 and 3.1
builder.AddAzureKeyVault(
new Uri(Configuration["KeyVault:URI"]),
new DefaultAzureCredential(
new DefaultAzureCredentialOptions
{
ExcludeSharedTokenCacheCredential = true,
VisualStudioTenantId = Configuration["AzureAd:TenantId"]
}),
new AzureKeyVaultConfigurationOptions()
{
ReloadInterval = TimeSpan.FromMinutes(15)
}
);
You could try catching this exception and implementing a retry mechanism for your code if this exception is thrown so that it could try with retry time and delay required for next attempt. Azure Key Vault throttling guidance | Microsoft Docs
SecretClientOptions options = new SecretClientOptions()
{
Retry =
{
Delay= TimeSpan.FromSeconds(2),
MaxDelay = TimeSpan.FromSeconds(16),
MaxRetries = 5,
Mode = RetryMode.Exponential
}
};
var client = new SecretClient(new Uri("https://keyVaultName.vault.azure.net"), new DefaultAzureCredential(),options);
//Retrieve Secret
secret = client.GetSecret(secretName);
If still issue remains, it may be calling several times due to
network issue also.So please check the network , firewall and if there is any DNS issue for that endpoint.
Check URI if endpoint is incorrect or Managed Identity does not have Data owner or Reader role.Please make sure that you have proper
permissions to access azure keyvault and give proper access
policies atleast get , list and create if needed .
Make sure to have one of the roles(RBAC) provided here to access the
keyvault .
发布评论
评论(1)
可能是从.NET结束的问题,主要是.NET Core 3.0.100或3.1 中的
。当大部分是在Visual Studio中的调试器下运行时,这似乎会发生这种情况,并且当进行长时间的平行呼叫并且重新拨动可能有助于阻止此播放一段时间并再次尝试。
升级/更新.NET Project SDK
(如果有任何更新)可在Visual Studio中找到。
在错误的消息中,您可以在4次尝试后看到
重试失败。
您可以检查ReloadInterval 在3.0和3.1中使用的属性,
您可以尝试捕获此异常,并为您的代码实现重试机制,如果抛出此异常,以便可以尝试重试时间和下一次尝试所需的延迟。
azure钥匙库节流指导| Microsoft Docs
另请参见 github讨论
网络问题。因此,请检查
网络,防火墙以及该端点的任何DNS问题。
数据所有者
或阅读器角色
。请确保您拥有正确权限可以访问Azure KeyVault并给出适当的 访问
策略 至少在需要时列出并创建。
密钥vault。
参考:
使用azure.security.keyvault库 - 堆栈溢出
It can be issue from .net end mostly ,
in .NET Core 3.0.100 or 3.1
. This seems to occur when running under the debugger in Visual Studio mostly and when long parallel calls are made and retrypolicy may help stop this from giving exception for sometime and tries again.Upgrade/Update the .NET Project SDK
if any updatesavailable in Visual Studio.
Also in the message of error you can see
retry faild after 4 tries..
You can check ReloadInterval Property which is used in 3.0 and 3.1
You could try catching this exception and implementing a retry mechanism for your code if this exception is thrown so that it could try with retry time and delay required for next attempt.
Azure Key Vault throttling guidance | Microsoft Docs
Also see GitHub discussion
network issue also.So please check the
network , firewall and if there is any DNS issue for that endpoint.
Data owner
orReader role
.Please make sure that you have properpermissions to access azure keyvault and give proper access
policies atleast get , list and create if needed .
keyvault .
References:
with the Azure.Security.KeyVault libraries - Stack Overflow