我正在使用定义了 secret 的应用程序注册。通过 PowerShell,我可以获得凭据,但无法获得 secret 值。使用的函数是 Get-AzADAppCredential
这是预期行为,这里没有问题。
为了更新 key ,我运行了两个函数 Remove-AzADAppCredential
和 New-AzADAppCredential
。
我通过 DevOps 管道运行这些 PowerShell cmdlet,并在 Azure 门户中使用具有权限的服务连接。
我注意到,当我们创建从 DevOps 到 Azure 的服务连接时,服务主体会自动分配云应用程序管理员角色。 此角色包括权限“microsoft.directory/applications/credentials/update”。
所以上面的(删除+新)应该有效,但它不起作用...... DevOps 返回错误:
Az.MSGraph.internal\Remove-AzADApplicationPassword : Insufficient privileges to complete the operation.
PS。使用 PowerShell 函数时使用 Az.Resources 版本 5.4.0。Az.MSGraph.internal\Add-AzADApplicationPassword : Insufficient privileges to complete the operation.
有人知道我错过了什么吗?
谢谢。
最佳答案
Insufficient privileges to complete the operation.
当用户在 AAD 中没有足够的权限并且没有所选 Azure 订阅的写入权限时,会出现此错误。
Note: If you have Cloud application administrator privileges of the user, this role grants the ability to manage application credentials. Users assigned this role can add credentials to an application and use those credentials to impersonate the application’s identity. If the application’s identity has been granted access to a resource, such as the ability to create or update User or other objects, then a user assigned to this role could perform those actions while impersonating the application.
请务必检查一次您是否具有全局管理员访问权限。如果您有访问权限,则可以修改 secret 。
分配给全局管理员角色的用户可以读取和修改 Azure AD 组织中的每个管理设置。
权限问题可能由于以下原因发生
- 用户在目录中仅具有访客权限
- 用户无权在目录中添加应用
引用here了解详细信息
关于Azure AD 应用程序注册 secret 操纵,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72041198/