Azure Key Vault:用户、组或应用程序没有对 Key Vault 的机密集权限
我正在使用 Azure CLI 创建一个脚本,该脚本将自动生成应用程序注册(服务主体),然后使用该应用程序注册创建将存储在 Azure Key Vault 中的机密。
但是,我收到以下错误:
用户、组或应用程序'appid=04b07795-8ddb-461a-bbee-02f9e1bf7b46;oid=0ec2b0e8-daeb-46a8-b627-0d4f61f871 57;numgroups=134;iss=https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/'没有对密钥保管库“asakeyabcfelaqpgsfnxcy;location=eastus”设置机密权限。如需解决此问题的帮助,请参阅 https://go.microsoft.com/fwlink/? linkid=2125287
任何人都可以提供有关此 ID 是什么以及如何解决此错误的指导吗?这不是我的应用程序注册对象 ID 或应用程序 ID。
I am creating a script using Azure CLI that will automatically generate an App Registration (service principal), and then use that App Registration to create a secret that will be stored in Azure Key Vault.
However, I am getting the following error:
The user, group or application 'appid=04b07795-8ddb-461a-bbee-02f9e1bf7b46;oid=0ec2b0e8-daeb-46a8-b627-0d4f61f87157;numgroups=134;iss=https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/' does not have secrets set permission on key vault 'asakeyabcfelaqpgsfnxcy;location=eastus'. For help resolving this issue, please see https://go.microsoft.com/fwlink/?linkid=2125287
Can anyone provide guidance on what this ID is and how to resolve this error? This is not my App Registration Object ID or App ID.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你现在关心的有两点,一是你没有添加secret,二是错误消息中的app id不是你注册的。
我想你已经按照文档执行了cli命令,所以我只想解释一下第二点。请允许我向您展示一个代码示例以获得更好的解释。
当我们想要将密钥保管库机密添加到 azure 时,我们需要提供凭据以便对我们的操作进行身份验证。这是此处的
DefaultAzureCredential()
,它有多个来源来获取身份验证,如下面的屏幕截图所示。这意味着如果有人设置了 环境变量 进行身份验证,那么它会覆盖您在执行 cli 命令时输入的信息,这通常可能会导致应用程序与您设置的内容不同的问题。我想你可以按照这个文档检查你的所有配置并重试,或者你可以直接用你在计算机上注册的应用程序添加环境变量。
顺便说一句,请不要忘记 在 Azure 门户中为你注册的 Azure 广告应用添加访问策略。
I think there're 2 points you're now concerning, one is you failed to add secret, another is the app id in the error message is not the one you registered.
I think you've followed the document to execute the cli command, so I just want to explain the second point. Pls allow me show you a code sample for a better explanation.
When we want to add key vault secret to azure, we need to provide a credential so that our operations are authenticated. This is the
DefaultAzureCredential()
here, and it has several sources to get the authentication like screenshot below.That means if someone sets the environment variables for authentication, then it will cover the information you entered when executing cli command, this may usually cause the issue that the app is different from what you set. I think you may follow this document to check all your configurations and try again, or you can directly add environment variables with the app you registered on your computer.
By the way, pls don't forget to add access policy in azure portal for the azure ad app you registered.