I integrated the grafana with azure ad but during login it was giving login failed bad request

35 Views Asked by At

I want to know why it was happening .I have added client id and secret auth and taken url everything needed for authentication I don't know why this happening.In the app registration also I have given the correct uri .given the enough permissions.

1

There are 1 best solutions below

0
Arko On

Below are the steps required to configure Grafana’s authentication with Azure AD.

  1. Log in to Azure Portal (https://portal.azure.com/), then click Azure Active Directory in the side menu.
  2. Navigate to “Azure Active Directory” and select “App registrations.”
  3. Click “New Registration” to create a new application registration.
  4. Provide a name for the application, and select the appropriate redirect URI for Grafana like https://your-grafana-url/login/azuread and https://your-grafana-url. Ensure the redirect URI in Azure AD exactly matches the URI configured in Grafana. Then click Register.
  5. After registering the application, the app’s Overview page opens. Note down the “Application (client) ID” and the “Directory (tenant) ID.”

enter image description here

  1. Under the “Certificates & secrets” section, generate a client secret, and make sure to note it down securely.

enter image description here

Upto here, above step remains same.

  1. Here I will be using grafana via helmchart on an aks cluster, so with that approach add the helm chart for grafana accordingly

    helm init helm repo add grafana https://grafana.github.io/helm-charts helm repo update

In the Grafana helm chart, we can set configuration values using the values.yaml file. Below is the sample configuration to add in values.yaml under grafana.ini section:

grafana.ini:  
auth.azuread:  
name:  Azure  AD  
enabled:  true  
allow_sign_up:  true  
auto_login  =  false  
client_id:  YOUR_CLIENT_ID  
client_secret:  YOUR_SECRET_ID  
scopes:  openid  email  profile  
auth_url:  
https://login.microsoftonline.com/AZURE_TENENT_ID/oauth2/v2.0/authorize  
token_url:  https://login.microsoftonline.com/AZURE_TENENT_ID/oauth2/v2.0/token  
allowed_groups:  GROUP_OBJECT_ID  
allowed_organizations:  TENANT_ID

These client id and secret you have already saved it from the above AD step. Add those here.

  1. Install or upgrade Grafana using the helm chart
helm upgrade -install chart_name -f values.yaml

and your grafana is ready.

Second option-

If you are just setting up a standard grafana instance, and not deploying it on AKS goto azure portal-> Azure managed Grafana-> Create new and follow the steps provided in the MS doc link. Just ensure you have selected managed identity while setting up grafana via portal or cli.

enter image description here

Once ready you can access it via the provided endpoint enter image description here enter image description here

Reference:

Managed Grafana on AKS MS Doc Managed Grafana