4.3. 创建 Azure AD 应用程序


要为集群中的所有节点授权和自动访问高可用性(HA)操作,请创建一个 Azure Active Directory (AD)应用程序。

先决条件

流程

  1. 从 HA 集群中的任何节点登录到您的 Azure 帐户:

    $ az login
  2. 为 Azure 隔离代理的自定义角色创建一个 json 配置文件。使用以下配置,但将 <subscription_id> 替换为您的订阅 ID:

    {
      "Name": "Linux Fence Agent Role",
      "description": "Allows to power-off and start virtual machines",
      "assignableScopes": [
        "/subscriptions/<subscription_id>"
      ],
      "permissions": [
        {
          "actions": [
            "Microsoft.Compute/*/read",
            "Microsoft.Compute/virtualMachines/powerOff/action",
            "Microsoft.Compute/virtualMachines/start/action"
          ],
          "notActions": [],
          "dataActions": [],
          "notDataActions": []
        }
      ]
    }
  3. 为 Azure 隔离代理定义自定义角色。使用之前步骤中创建的 json 文件:

    $ az role definition create --role-definition <azure_fence_role.json>
    {
      "assignableScopes": [
        "/subscriptions/__<my_subscription_id>__"
      ],
      "description": "Allows to power-off and start virtual machines",
      "id": "/subscriptions/__<my_subscription_id>__/providers/Microsoft.Authorization/roleDefinitions/__<role_id>__",
      "name": "__<role_id>__",
      "permissions": [
        {
          "actions": [
            "Microsoft.Compute/*/read",
            "Microsoft.Compute/virtualMachines/powerOff/action",
            "Microsoft.Compute/virtualMachines/start/action"
          ],
          "dataActions": [],
          "notActions": [],
          "notDataActions": []
        }
      ],
      "roleName": "Linux Fence Agent Role",
      "roleType": "CustomRole",
      "type": "Microsoft.Authorization/roleDefinitions"
    }
  4. 在 Azure web 控制台界面中,在左侧菜单中选择 Virtual Machine Identity
  5. 选择 On Save Yes 确认。
  6. Azure role assignments Add role assignment
  7. 选择角色所需的 范围 以及所需的 资源组
  8. 可选:如果需要,请修改 订阅
  9. 选择 Linux Fence Agent Role 角色,再点 Save

验证

  • 显示 Azure AD 中可见的节点:

    # fence_azure_arm --msi -o list
    node1,
    node2,
    ...

    如果这个命令输出集群中的所有节点,则您已成功配置了 AD 应用程序。

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部