文档

Grafana AzureAD统一认证登录

更新时间:

可观测可视化 Grafana 版支持使用AzureAD进行统一认证登录。本文介绍如何通过AzureAD活动目录进行统一认证登录,以及如何通过AzureAD提供的应用权限来设置用户和用户组角色。

更多信息请参见Grafana AzureAD官网文档

步骤一:创建Registration

  1. 登录Azure Portal,在左侧导航栏选择Azure AD。

    说明

    如果您有多个AD域,可以在页面右侧选择您需要添加的AD,同时选择您需要进行配置的AD Tenant。

  2. 在侧面管理菜单,单击App registration > New Registration

  3. 添加重定向URL ,选择Web,这里Grafana的URL地址为https://<my_grafana_server_name_or_ip>:<grafana_server_port>/login/azuread 然后单击Register,系统会跳转至新建APP的Overview页面。

  4. Certificates & secrets中添加新的Client Secret。

步骤二:设置权限

  1. 在左侧单击Manifest,定义应用的Role和权限。

    Grafana分为Viewer、Editor、Admin。如果不进行定义,所有用户将会都是Viewer角色。每个角色Role要求一个不重复的ID,可以使用uudigen或者powershell的New-Giud命令,具体示例如下:

    "appRoles": [
          {
            "allowedMemberTypes": [
              "User"
            ],
            "description": "Grafana org admin Users",
            "displayName": "Grafana Org Admin",
            "id": "SOME_UNIQUE_ID",
            "isEnabled": true,
            "lang": null,
            "origin": "Application",
            "value": "Admin"
          },
          {
            "allowedMemberTypes": [
              "User"
            ],
            "description": "Grafana read only Users",
            "displayName": "Grafana Viewer",
            "id": "SOME_UNIQUE_ID",
            "isEnabled": true,
            "lang": null,
            "origin": "Application",
            "value": "Viewer"
          },
          {
            "allowedMemberTypes": [
              "User"
            ],
            "description": "Grafana Editor Users",
            "displayName": "Grafana Editor",
            "id": "SOME_UNIQUE_ID",
            "isEnabled": true,
            "lang": null,
            "origin": "Application",
            "value": "Editor"
          }
        ],

  2. 在Azure Active Directory页面找到Enterprise Application,然后搜索并单击进入您的应用。

  3. 单击Users and Groups,并添加用户和权限。

步骤三:Grafana参数设置

  1. 登录可观测可视化 Grafana 版控制台,在左侧导航栏单击工作区管理
  2. 工作区管理页面,单击目标工作区ID。
  3. 在左侧导航栏单击参数设置

  4. 在左侧参数列表选择auth.azuread,然后单击修改参数

  5. 参考以下配置,修改参数的运行参数,然后单击保存并生效

    [auth.azuread]
    name = Azure AD
    enabled = true
    allow_sign_up = true
    client_id = <client_id>
    client_secret = <client_secret>
    scopes = openid email profile
    auth_url= https://login.microsoftonline.com/<application-id>/oauth2/v2.0/authorize
    token_url = https://login.microsoftonline.com/<application-id>/oauth2/v2.0/token
    allowed_domains =
    allowed_groups =
    说明

    client_id,client_secret,application-id为您自己在Azure中创建的。

    其中:

    • Azure Client id和Secret id,您可以在Certificates & secret页面查找。image.png

    • Auth URL和Token URL,您可以在Overview页面中单击end-point查找。image.png

步骤四:登录Grafana

Azure参数设置完成后大约等待1分钟,打开Grafana地址,并单击Sign in with Azure AD,即可登录成功。表示已成功通过AzureAD统一认证登录Grafana。image.png

  • 本页导读 (1)
文档反馈