- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
基于给出的文档here 。使用 DefaultAzureCredentials() 时,它将检查环境变量,然后检查 ManagedIdentity 等。在我的测试中,我部署了系统托管服务身份 AKS。我已经部署了一个 C# 应用程序,尝试使用以下代码通过应用程序连接到 Keyvault
var keyClient = new KeyClient(vaultUri: new Uri(keyVaultUrl),
credential: new DefaultAzureCredential(true));
Response<KeyVaultKey> response = keyClient.GetKey("somekey");
将我的应用程序部署到 AKS 群集时,失败并出现以下错误 -
Unhandled exception. Azure.Identity.AuthenticationFailedException: DefaultAzureCredential failed to retrieve a token from the included credentials.
- EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
- ManagedIdentityCredential authentication unavailable. The requested identity has not been assigned to this resource.
Status: 400 (Bad Request)
Content:
{"error":"invalid_request","error_description":"Identity not found"}
根据文档,我的应用程序应该从 AKS 集群中获取托管身份,并能够与 Keyvault 连接以获取值。但由于某种原因它抛出了这个错误。如果我遗漏了什么,请有人指导我。
最佳答案
Managed identity用于创建 AKS 群集的是控制平面,而不是工作节点或应用程序。控制平面使用该托管身份来创建请求的云资源,例如负载均衡器、规模集、路由等。如果您希望应用程序使用托管身份,建议的方法是部署 aad-pod-identities这为您提供了应用程序级别的授权方案。或者,您也可以启用 managed identity for the VMSS基于节点池。在后一种情况下,Azure 将为具有相同名称的节点池创建一个新的系统托管标识,您可以使用它在 KeyVault 或其他服务之间建立授权。
关于azure - DefaultAzureCredentials 无法在 MangedIdentity AKS 中获取凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63582171/
基于给出的文档here 。使用 DefaultAzureCredentials() 时,它将检查环境变量,然后检查 ManagedIdentity 等。在我的测试中,我部署了系统托管服务身份 AKS。
基于给出的文档here 。使用 DefaultAzureCredentials() 时,它将检查环境变量,然后检查 ManagedIdentity 等。在我的测试中,我部署了系统托管服务身份 AKS。
我是一名优秀的程序员,十分优秀!