Azure AD 应用程序注册 secret 操纵

标签 azure powershell azure-devops azure-service-principal

我正在使用定义了 secret 的应用程序注册。通过 PowerShell,我可以获得凭据,但无法获得 secret 值。使用的函数是 Get-AzADAppCredential 这是预期行为,这里没有问题。

为了更新 key ,我运行了两个函数 Remove-AzADAppCredentialNew-AzADAppCredential

我通过 DevOps 管道运行这些 PowerShell cmdlet,并在 Azure 门户中使用具有权限的服务连接。

我注意到,当我们创建从 DevOps 到 Azure 的服务连接时,服务主体会自动分配云应用程序管理员角色。 此角色包括权限“microsoft.directory/applications/credentials/update”。

所以上面的(删除+新)应该有效,但它不起作用...... DevOps 返回错误:

Az.MSGraph.internal\Remove-AzADApplicationPassword : Insufficient privileges to complete the operation.

Az.MSGraph.internal\Add-AzADApplicationPassword : Insufficient privileges to complete the operation.

PS。使用 PowerShell 函数时使用 Az.Resources 版本 5.4.0。

有人知道我错过了什么吗?

谢谢。

最佳答案

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 。

enter image description here

分配给全局管理员角色的用户可以读取和修改 Azure AD 组织中的每个管理设置。

权限问题可能由于以下原因发生

  1. 用户在目录中仅具有访客权限
  2. 用户无权在目录中添加应用

引用here了解详细信息

关于Azure AD 应用程序注册 secret 操纵,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72041198/

相关文章:

Azure Devops 管道无法访问 Docker Windows 镜像?

azure - 获取 webrole 所属部署的名称和位置

azure - 如何将事件传递给 Azure Function 的所有实例

git - 如何在右键单击时打开 Github for Windows 的 Git Shell?

c# - 使用 Uri 创建时,新 Runspace 对象的 SessionStateProxy 属性为空

powershell - 为什么在 PowerShell 中将 DateTime 对象嵌入到字符串中会丢失 DateTime 区域设置?

azure-devops - 如何在 Azure DevOps 中重命名任务组

azure - 在带有 Linux 容器代理的 Azure DevOps 上的 powershell 脚本中使用环境变量

node.js - 删除azure服务总线队列消息?

Azure QnA 服务部署在门户中失败 - 模板无效