我正在尝试使用 Bicep 模板和 Azure Pipelines 部署 Azure 资源。 到目前为止,我成功部署了一个 Web 应用程序,但我很难在 Azure AD 中注册它。
我的管道中有一项作业应该在 Azure AD 中创建一个应用程序:
此作业失败并出现以下错误:
ERROR: Insufficient privileges to complete the operation.
ERROR: Forbidden({"error":{"code":"Authorization_RequestDenied","message":"Insufficient privileges to complete the operation.","innerError":{"date":"2022-03-01T07:18:30","request-id":"903fcd87-ad15-4766-8f31-132185e2c97d","client-request-id":"903fcd87-ad15-4766-8f31-132185e2c97d"}}})
很明显,管道使用的服务连接没有一些必要的权限,但我不知道是哪一个。
有一个answer类似的问题表明我需要 Azure AD Graph 中的 Application.ReadWrite.All,但 Azure AD 已弃用:
如有任何帮助,我们将不胜感激!
最佳答案
您应该改用 Microsoft Graph 并在其中选择适当的权限。
另一种选择是让 Web 应用程序的二头肌模板通过使用身份属性中的 SystemAssigned 为您添加系统管理的身份:
resource appService 'Microsoft.Web/sites@2020-06-01' = {
name: webAppName
location: location
properties: {
serverFarmId: appServicePlan.id
siteConfig:{
alwaysOn: true
}
httpsOnly: true
clientAffinityEnabled: false
}
identity: {
type: 'SystemAssigned'
}
}
关于azure - 如何使用 Azure Pipelines 在 Azure AD 中注册 Web 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71324931/