用于 Octopus Webapp 部署的 Azure AAD 角色

Azure AAD Role for Octopus Webapp deployments

我正在使用 Octopus Deploy 部署 Azure WebApp,使用服务主体作为身份验证机制。按照在线说明,我能够获取所有 ID 和密钥,并在 AAD 中为具有 Reader 角色的应用程序创建权限。

Octopus 可以成功地从 Azure 中为帐户检索 webapps 列表,但是当我部署时,我得到以下信息:

System.AggregateException: One or more errors occurred. ---> System.Exception: Retrieving publishing credentials failed with HTTP status 403 - Forbidden

我猜 Reader 角色未获得部署授权 - 哪个角色最合适?或者我还需要做些什么吗?

您的服务委托人需要参与者角色才能在 Azure 上进行部署。

如果您查看我们在 our Azure Service Principal Account guide 中提供的示例 PowerShell 脚本,您会发现我们为角色定义参数分配了 "Contributor"。

New-AzureRmRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $azureAdApplication.ApplicationId

希望对您有所帮助。

如果您只使用服务主体来部署网络应用程序,您可以赋予它 Website Contributor 角色。

Website Contributor Can manage websites, but not the web plans to which they are connected

网站贡献者可以访问的操作请参考此link

如果您希望服务主体创建应用服务计划,您还需要赋予它 Web Plan Contributor 角色。

OwnerContributor可以管理一切,如果你需要微调权限,我建议你使用selectWebsite Contributor角色。更多信息请参考这个link:Built-in roles for Azure role-based access control.

请参考这个link:Assign application to role