Lifetime of login token - Azure Managed Grafana

Bart van Dooren 25 Reputation points
2023-07-11T12:32:02.1933333+00:00

Hello All,

I am interested in how the login procedure works for an Azure Managed Grafana instance, focused on the token used.

Within Azure AD, the token has a lifetime of 1 hour by default, after which the token will become invalid (correct me if I am wrong). I am wondering how does work in the case of Azure Managed Grafana, given that it used Azure AD synced with Grafana to login to the Grafana instance.

I assume Grafana still makes use of it's own bearer token, but I can't find what the lifetime of this token is or what the exact login procedure is.

Thanks in advance for the help!

Azure Managed Grafana
Azure Managed Grafana
An Azure service used to deploy Grafana dashboards for analytics and monitoring solutions.
134 questions
{count} votes

Accepted answer
  1. AnuragSingh-MSFT 21,551 Reputation points Moderator
    2023-07-14T05:17:39.3633333+00:00

    @Bart van Dooren , Please find below details of the token/access management as used in Azure Managed Grafana

    1. We keep a login session cookie for 24 hours so that user doesn't need to log in frequently. If the session cookie times out, the client (normally browser) will automatically be redirected to AAD for login. Once the user logs in, the browser will be automatically redirected back to the previous location of the Grafana instance (together with user's access token/refresh token). Since it's based on single-signon, as long as the client has been logged into AAD, typically user doesn't need to do anything explicitly or even notice it.
    2. Once the user logs into Grafana, we will do Azure RBAC to check user's permission. This permission check result is normally cached for 5min only, i.e., if the user is granted different permission, there may be delay of up to 5min for the new role to be effective.
    3. We use some of the information in the user's access token for Azure RBAC check-in as mentioned in point 2. From Managed Grafana standpoint, there are no changes with token lifetime, so it accepts whatever lifetime is received for the token from Azure Active Directory, and this is stored in a cookie. Managed Grafana instance refreshes the token when it’s less than 30 sec from expiration and the new token gets put back into the cookie. This is done only if a refresh token is available in the cookie which was available in the very first original authentication process.

    Therefore, from usage of view, two time matters here:

    1. session cookie for Azure Grafana instance times out after 24 hours. There will be automatic re-login
    2. Role assignment change may take up to 5min to be effective (once it's propagated by Azure RBAC, which is normally fast but could take longer)

    Hope this helps.

    If the answer did not help, please add more context/follow-up question for it, and we will help you out. Else, if the answer helped, please click Accept answer so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.