gpt4 book ai didi

Azure.Identity.AuthenticationFailedException : ManagedIdentityCredential authentication failed: Service request failed

转载 作者:行者123 更新时间:2023-12-03 03:35:01 25 4
gpt4 key购买 nike

我在我的 azure 中有以下设置。我有专用网络设置。我的 azure 函数正在其中运行。我正在使用托管身份来访问 KeyVault 信息。

到目前为止,我已经尝试创建专用端点,在 azure 功能中添加了系统身份。在 Key Vault 中添加了具有正确角色分配的同一用户,从 azure 函数中的自定义域部分更新了 IP 地址以添加到 Key Vault 的防火墙和虚拟网络部分,更新了我的项目中的所有 nuget 包。但这些方法都没有解决错误:

Azure.Identity.AuthenticationFailedException:ManagedIdentityCredential 身份验证失败:服务请求失败 - 400 错误请求

此外,我的代码使用 ManagedIdentityCredential 作为凭据。但没有任何效果。

最佳答案

  • 您收到的错误是身份验证错误,请确保您的代码中没有逻辑错误。我使用了以下代码
var credential = new ManagedIdentityCredential();
var client = new SecretClient(new Uri("https://<KEY_VAULT_NAME>.vault.azure.net/"), credential);
var secret = await client.SetSecretAsync("secretName", "secretValue");
var d = await client.GetSecretAsync("secretName");

系统分配的身份已开启

  • 如果您只允许特定的 IP 地址通过防火墙,那么我可能无法工作,因为 Azure 功能是无服务器技术,其中 IP 地址必然会根据情况而变化。
  • 因此您必须允许配置该功能的整个虚拟网络。

enter image description here

选择现有虚拟网络并添加现有 vnet,并且不使用专用终结点。

关于Azure.Identity.AuthenticationFailedException : ManagedIdentityCredential authentication failed: Service request failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73684660/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com