如何在 Azure Spring Apps 中使用权限

注意

Azure Spring Apps 是 Azure Spring Cloud 服务的新名称。 虽然该服务有新名称,但一些地方仍会使用旧名称,我们仍在更新屏幕截图、视频和图形等资产。

本文介绍如何创建将权限委托给 Azure Spring Apps 资源的自定义角色。 自定义角色通过各种默认权限对 Azure 内置角色进行扩展。

我们将实现以下自定义角色。

  • 开发人员角色

    • 部署
    • 测试
    • 重启应用
    • 应用 Git 存储库中的应用配置以及对其进行更改
    • 获取日志流
  • DevOps 工程师角色:

    • 在 Azure Spring Apps 云中创建、读取、更新和删除任何内容
  • 运营 - 现场可靠性工程角色:

    • 重启应用
    • 获取日志流
    • 无法对应用或配置进行更改
  • Azure Pipelines/Jenkins/GitHub Actions 角色:

    • 执行创建、读取、更新和删除操作
    • 使用 Terraform 或 ARM 模板在 Azure Spring Apps 和应用的服务实例中创建和配置任何内容:Azure Pipelines、Jenkins 和 GitHub Actions

定义开发人员角色

开发人员角色包括重启应用和查看其日志流的权限。 此角色无法对应用或配置进行更改。

  1. 在 Azure 门户中,打开你要在其中分配自定义角色的订阅。

  2. 打开“访问控制(IAM)”。

  3. 选择 添加

  4. 选择“添加自定义角色”。

  5. 选择“下一步”

    Screenshot that shows the Basics tab of the Create a custom role window.

  6. 选择“添加权限”:

    Screenshot that shows the Add permissions button.

  7. 在搜索框中,搜索“Microsoft.app”。 选择“Azure Spring Apps”:

    Screenshot that shows the results of searching for Microsoft.app.

  8. 选择开发人员角色的权限。

    在“Microsoft.AppPlatform/Spring”下,选择:

    • 写入:创建或更新 Azure Spring Apps 服务实例
    • 读取:获取 Azure Spring Apps 服务实例
    • 其他:列出 Azure Spring Apps 服务实例测试密钥

    在“Microsoft.AppPlatform/Spring/apps”下,选择:

    • 读取:读取 Azure Spring Apps 应用程序
    • 其他:获取 Azure Spring Apps 应用程序资源上传 URL

    在“Microsoft.AppPlatform/Spring/apps/bindings”下,选择:

    • 读取:读取 Azure Spring Apps 应用程序绑定

    在“Microsoft.AppPlatform/Spring/apps/deployments”下,选择:

    • 写入:写入 Azure Spring Apps 应用程序部署
    • 读取:读取 Azure Spring Apps 应用程序部署
    • 其他:启动 Azure Spring Apps 应用程序部署
    • 其他:停止 Azure Spring Apps 应用程序部署
    • 其他:重启 Azure Spring Apps 应用程序部署
    • 其他:获取 Azure Spring Apps 应用程序部署日志文件 URL

    在“Microsoft.AppPlatform/Spring/apps/domains”下,选择:

    • 读取:读取 Azure Spring Apps 应用程序自定义域

    在“Microsoft.AppPlatform/Spring/certificates”下,选择:

    • 读取:读取 Azure Spring Apps 证书

    在“Microsoft.AppPlatform/locations/operationResults/Spring”下,选择:

    • 读取:读取操作结果

    在“Microsoft.AppPlatform/locations/operationStatus/operationId”下,选择:

    • 读取:读取操作状态

    Screenshot of Azure portal that shows the selections for Developer permissions.

  9. 选择 添加

  10. 检查这些权限。

  11. 选择“查看并创建”。

定义 DevOps 工程师角色

此过程定义有权部署、测试和重启 Azure Spring Apps 应用的角色。

  1. 重复用于添加开发人员角色的过程的步骤 1 到 4。

  2. 选择 DevOps 工程师角色的权限:

    在“Microsoft.AppPlatform/Spring”下,选择:

    • 写入:创建或更新 Azure Spring Apps 服务实例
    • 删除:删除 Azure Spring Apps 服务实例
    • 读取:获取 Azure Spring Apps 服务实例
    • 其他:启用 Azure Spring Apps 服务实例测试终结点
    • 其他:禁用 Azure Spring Apps 服务实例测试终结点
    • 其他:列出 Azure Spring Apps 服务实例测试密钥
    • 其他:重新生成 Azure Spring Apps 服务实例测试密钥

    在“Microsoft.AppPlatform/Spring/apps”下,选择:

    • 写入: 写入 Azure Spring Apps 应用程序
    • 删除: 删除 Azure Spring Apps 应用程序
    • 读取:读取 Azure Spring Apps 应用程序
    • 其他:获取 Azure Spring Apps 应用程序资源上传 URL
    • 其他: 验证 Azure Spring Apps 应用程序自定义域

    在“Microsoft.AppPlatform/Spring/apps/bindings”下,选择:

    • 写入: 写入 Azure Spring Apps 应用程序绑定
    • 删除: 删除 Azure Spring Apps 应用程序绑定
    • 读取:读取 Azure Spring Apps 应用程序绑定

    在“Microsoft.AppPlatform/Spring/apps/deployments”下,选择:

    • 写入:写入 Azure Spring Apps 应用程序部署
    • 删除:删除 Azure Spring Apps 应用程序部署
    • 读取:读取 Azure Spring Apps 应用程序部署
    • 其他:启动 Azure Spring Apps 应用程序部署
    • 其他:停止 Azure Spring Apps 应用程序部署
    • 其他:重启 Azure Spring Apps 应用程序部署
    • 其他:获取 Azure Spring Apps 应用程序部署日志文件 URL

    在“Microsoft.AppPlatform/Spring/apps/deployments/skus”下,选择:

    • 读取:列出应用程序部署可用的 SKU

    在“Microsoft.AppPlatform/locations”下,选择:

    • 其他:检查名称可用性

    在“Microsoft.AppPlatform/locations/operationResults/Spring”下,选择:

    • 读取:读取操作结果

    在“Microsoft.AppPlatform/locations/operationStatus/operationId”下,选择:

    • 读取:读取操作状态

    在“Microsoft.AppPlatform/skus”下,选择:

    • 读取:列出可用的 SKU

    Screenshot of Azure portal that shows the selections for DevOps permissions.

  3. 选择 添加

  4. 检查这些权限。

  5. 选择“查看并创建”。

定义运营 - 现场可靠性工程角色

此过程定义有权部署、测试和重启 Azure Spring Apps 应用的角色。

  1. 重复用于添加开发人员角色的过程的步骤 1 到 4。

  2. 选择 Ops - 站点可靠性工程角色的权限:

    在“Microsoft.AppPlatform/Spring”下,选择:

    • 读取:获取 Azure Spring Apps 服务实例
    • 其他:列出 Azure Spring Apps 服务实例测试密钥

    在“Microsoft.AppPlatform/Spring/apps”下,选择:

    • 读取:读取 Azure Spring Apps 应用程序

    在“Microsoft.AppPlatform/apps/deployments”下,选择:

    • 读取:读取 Azure Spring Apps 应用程序部署
    • 其他:启动 Azure Spring Apps 应用程序部署
    • 其他:停止 Azure Spring Apps 应用程序部署
    • 其他:重启 Azure Spring Apps 应用程序部署

    在“Microsoft.AppPlatform/locations/operationResults/Spring”下,选择:

    • 读取:读取操作结果

    在“Microsoft.AppPlatform/locations/operationStatus/operationId”下,选择:

    • 读取:读取操作状态

    Screenshot of Azure portal that shows the selections for Ops - Site Reliability Engineering permissions.

  3. 选择 添加

  4. 检查这些权限。

  5. 选择“查看并创建”。

定义 Azure Pipelines/Jenkins/GitHub Actions 角色

此角色可以在具有服务实例的 Azure Spring Apps 和应用中创建和配置任何内容。 此角色用于发布或部署代码。

  1. 重复用于添加开发人员角色的过程的步骤 1 到 4。

  2. 打开“权限”选项。

  3. 选择 Azure Pipelines/Jenkins/GitHub Actions 角色的权限:

    在“Microsoft.AppPlatform/Spring”下,选择:

    • 写入:创建或更新 Azure Spring Apps 服务实例
    • 删除:删除 Azure Spring Apps 服务实例
    • 读取:获取 Azure Spring Apps 服务实例
    • 其他:启用 Azure Spring Apps 服务实例测试终结点
    • 其他:禁用 Azure Spring Apps 服务实例测试终结点
    • 其他:列出 Azure Spring Apps 服务实例测试密钥
    • 其他:重新生成 Azure Spring Apps 服务实例测试密钥

    在“Microsoft.AppPlatform/Spring/apps”下,选择:

    • 写入: 写入 Azure Spring Apps 应用程序
    • 删除: 删除 Azure Spring Apps 应用程序
    • 读取:读取 Azure Spring Apps 应用程序
    • 其他:获取 Azure Spring Apps 应用程序资源上传 URL
    • 其他: 验证 Azure Spring Apps 应用程序自定义域

    在“Microsoft.AppPlatform/Spring/apps/bindings”下,选择:

    • 写入: 写入 Azure Spring Apps 应用程序绑定
    • 删除: 删除 Azure Spring Apps 应用程序绑定
    • 读取:读取 Azure Spring Apps 应用程序绑定

    在“Microsoft.AppPlatform/Spring/apps/deployments”下,选择:

    • 写入:写入 Azure Spring Apps 应用程序部署
    • 删除:删除 Azure Spring Apps 应用程序部署
    • 读取:读取 Azure Spring Apps 应用程序部署
    • 其他:启动 Azure Spring Apps 应用程序部署
    • 其他:停止 Azure Spring Apps 应用程序部署
    • 其他:重启 Azure Spring Apps 应用程序部署
    • 其他:获取 Azure Spring Apps 应用程序部署日志文件 URL

    在“Microsoft.AppPlatform/Spring/apps/deployments/skus”下,选择:

    • 读取:列出应用程序部署可用的 SKU

    在“Microsoft.AppPlatform/locations”下,选择:

    • 其他:检查名称可用性

    在“Microsoft.AppPlatform/locations/operationResults/Spring”下,选择:

    • 读取:读取操作结果

    在“Microsoft.AppPlatform/locations/operationStatus/operationId”下,选择:

    • 读取:读取操作状态

    在“Microsoft.AppPlatform/skus”下,选择:

    • 读取:列出可用的 SKU

    Screenshot of Azure portal that shows the selections for Azure Pipelines / Jenkins / GitHub Actions permissions.

  4. 选择 添加

  5. 检查这些权限。

  6. 选择“查看并创建”。

后续步骤

有关定义自定义权限的三种方法的详细信息,请参阅: