Unhandled Exception: Microsoft.Azure.KeyVault.KeyVaultClientException: Service Error information was not available
at Microsoft.Azure.KeyVault.KeyVaultClient.<Do>d__11b`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.KeyVault.KeyVaultClient.<GetSecretAsync>d__cb.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at CertificateEncryptValueTask.CertificateEncryptValueTask.Main(String[] args) in C:\dev\sinnovations-vsts-tasks\src\CertificateEncryptValueTask\CertificateEncryptValueTask.cs:line 92
Press any key to continue . . .
使用https://vault.azure.net/
时尝试从Azure Keyvault检索机密时抛出
var valueToken = options.ConnectedServiceName.GetToken("https://vault.azure.net/");
答案 0 :(得分:1)
深入查看发现跟随状态的例外情况:System.Net.HttpStatusCode.Unauthorized
表示该令牌已获得授权。
事实证明,原因是资源uri的最后一次削减。
var valueToken = options.ConnectedServiceName.GetToken("https://vault.azure.net");
在management.azure.com resource
上 - 如果由于缺少斜线等原因,它们很好地将此信息包含在错误中。