[Yandex Cloud documentation](../../../../index.md) > [Yandex Identity Hub](../../../index.md) > [Tutorials](../../index.md) > [Setting up single sign-on (SSO) for apps](../index.md) > Grafana Cloud > OpenID Connect

# Creating an OIDC application in Yandex Identity Hub for integration with Grafana Cloud


[Grafana Cloud](https://grafana.com/products/cloud/) is a managed cloud monitoring and observability platform that brings together Grafana, Prometheus, Loki, and other tools for data visualization and analysis. Grafana Cloud supports [OpenID Connect](https://en.wikipedia.org/wiki/OpenID#OpenID_Connect_(OIDC)) (OIDC) authentication to provide secure SSO for your organization's users.

To authenticate your [organization's](../../../concepts/organization.md) users to Grafana Cloud with OpenID Connect SSO, create an [OIDC app](../../../concepts/applications.md#oidc) in Yandex Identity Hub and configure it appropriately both in Yandex Identity Hub and Grafana Cloud.

OIDC apps can be managed by users with the `organization-manager.oauthApplications.admin` [role](../../../security/index.md#organization-manager-oauthApplications-admin) or higher.

For the users of your organization to be able to access Grafana Cloud:

1. [Create a Grafana Cloud account](#grafana-account).
1. [Create an app](#create-app).
1. [Set up the integration](#setup-integration).
1. [Make sure the application works correctly](#validate).

## Create a Grafana Cloud account {#grafana-account}

If you do not have a Grafana Cloud account, create one:

1. Go to the [Grafana Cloud sign up page](https://grafana.com/auth/sign-up/).
1. Fill out the registration form:
    - Enter your email address.
    - Create a secure password.
1. Click **Create my account**.
1. Verify your new account by following the instructions sent to the email address you provided.
1. Select a name for your organization; this name will be part of your instance's URL, e.g., `your-org`.
1. Once logged in, make sure you have administrator permissions to configure OIDC in your Grafana Cloud organization.
1. Write down your Grafana Cloud instance’s URL, e.g., `https://your-org.grafana.net`, as you will need it to set up the integration.

{% note info %}

To configure OIDC in Grafana Cloud, you need organization administrator permissions. If you do not have the required permissions, contact your organization's administrator in Grafana Cloud.

{% endnote %}

## Create an app {#create-app}

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

    1. Log in to [Yandex Identity Hub](https://center.yandex.cloud/organization).
    1. In the left-hand panel, select ![shapes-4](../../../../_assets/console-icons/shapes-4.svg) **Apps**.
    1. In the top-right corner, click ![Circles3Plus](../../../../_assets/console-icons/circles-3-plus.svg) **Create application** and in the window that opens:
        1. Select the **OIDC (OpenID Connect)** single sign-on method.
        1. In the **Name** field, specify a name for your new app: `grafana-cloud-oidc-app`.
        1. In the **Folder** field, select the folder where you want to create an OAuth client for your app.
        1. Optionally, in the **Description** field, enter a description for the new app.
        1. Optionally, add [labels](../../../../resource-manager/concepts/labels.md):

            1. Click **Add label**.
            1. Enter a label in `key: value` format.
            1. Press **Enter**.
        1. Click **Create application**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the CLI command for creating an OIDC app:

     ```bash
     yc organization-manager idp application oauth application create --help
     ```

  1. Create an OAuth client:

     ```bash
     yc iam oauth-client create \
       --name grafana-cloud-oauth-client \
       --scopes openid,email,profile
     ```

     Where:

     * `--name`: OAuth client name.
     * `--scopes`: User attributes that will be available to Grafana Cloud. The specified attributes are:
       * `openid`: User ID. Required attribute.
       * `email`: User email address.
       * `profile`: Additional user details, such as first name, last name, and avatar.

     Result:

     ```text
     id: ajeqqip130i1********
     name: grafana-cloud-oauth-client
     folder_id: b1g500m2195v********
     status: ACTIVE
     ```

     Save the `id` field value: you will need it to create and configure your app.

  1. Create a secret for your OAuth client:

     ```bash
     yc iam oauth-client-secret create \
       --oauth-client-id <OAuth_client_ID>
     ```

     Result:

     ```text
     oauth_client_secret:
       id: ajeq9jfrmc5t********
       oauth_client_id: ajeqqip130i1********
       masked_secret: yccs__939233b8ac****
       created_at: "2025-10-21T10:14:17.861652377Z"
     secret_value: yccs__939233b8ac********
     ```

     Save the `secret_value` field value: you will need it to configure your Grafana Cloud.
  
  1. Create an OIDC app:

     ```bash
     yc organization-manager idp application oauth application create \
       --organization-id <organization_ID> \
       --name grafana-cloud-oidc-app \
       --description "OIDC application for integration with Grafana Cloud" \
       --client-id <OAuth_client_ID> \
       --authorized-scopes openid,email,profile \
       --group-distribution-type none
     ```

     Where:

     * `--organization-id`: [ID of the organization](../../../operations/organization-get-id.md) you want to create your OIDC app in. This is a required setting.
     * `--name`: OIDC app name. This is a required setting.
     * `--description`: OIDC app description. This is an optional setting.
     * `--client-id`: OAuth client ID you got in Step 2. This is a required setting.
     * `--authorized-scopes`: Specify the same attributes as when creating the OAuth client.
     * `--group-distribution-type`: Set to `none` as user groups are not provided to Grafana Cloud.

     Result:

     ```text
     id: ek0o663g4rs2********
     name: grafana-cloud-oidc-app
     organization_id: bpf2c65rqcl8********
     group_claims_settings:
       group_distribution_type: NONE
     client_grant:
       client_id: ajeqqip130i1********
       authorized_scopes:
         - openid
         - email
         - profile
     status: ACTIVE
     created_at: "2025-10-21T10:51:28.790866Z"
     updated_at: "2025-10-21T12:37:19.274522Z"
     ```

{% endlist %}

## Set up the integration {#setup-integration}

To integrate Grafana Cloud with the OIDC app you created in Yandex Identity Hub, complete the setup both on the Grafana Cloud side and in Yandex Identity Hub.

### Configure your OIDC application in Yandex Identity Hub {#setup-idp}

#### Get the application’s credentials {#get-credentials}

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Log in to [Yandex Identity Hub](https://center.yandex.cloud/organization).
  1. In the left-hand panel, select ![shapes-4](../../../../_assets/console-icons/shapes-4.svg) **Apps** and then, the OIDC app.
  1. On the **Overview** tab, under **Identity provider (IdP) configuration**, expand the **Additional attributes** section and copy the parameter values you need to specify in Grafana Cloud:

        * `ClientID`: Unique application ID.
        * `OpenID Configuration`: URL with the configuration of all parameters required to set up the integration.

  1. Under **App secrets**, click **Add secret**, and in the window that opens:
     
     1. Optionally, add a description for the new secret.
     1. Click **Create**.
     
     The window will display the generated [application secret](../../../concepts/applications.md#oidc-secret). Save this value.
     
     {% note warning %}
     
     If you refresh or close the application information page, you will not be able to view the secret again.
     
     {% endnote %}
     
     If you closed or refreshed the page before saving the secret, click **Add secret** to create a new one.
     
     To delete a secret, in the list of secrets on the OIDC app page, click ![ellipsis](../../../../_assets/console-icons/ellipsis.svg) in the secret row and select ![trash-bin](../../../../_assets/console-icons/trash-bin.svg) **Delete**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. Get information about your new OIDC application:

     ```bash
     yc organization-manager idp application oauth application get <app_ID>
     ```

     Where `<app_ID>` is your OIDC app ID you got when creating the app.

     This will return the application information, including the following:

     ```text
     id: ek0o663g4rs2********
     name: grafana-cloud-oidc-app
     organization_id: bpf2c65rqcl8********
     client_grant:
       client_id: ajeqqip130i1********
       authorized_scopes:
         - openid
         - email
         - profile
     ```

     Save the `client_id` value: this is the Client ID you will need to configure your Grafana Cloud.

  1. Get the OpenID Connect Discovery configuration URL:

     ```bash
     yc organization-manager idp application oauth application get <app_ID> \
       --format json | jq -r '.client_grant.issuer_uri'
     ```

     The result will look as follows:

     ```text
     https://auth.yandex.cloud/oauth/<OAuth_client_ID>
     ```

     Save this URL: this is the OpenID Connect Discovery URL you will need to configure your Grafana Cloud.

  1. Use the OAuth client secret that you saved when creating the app in the previous step. If you have not saved the secret, create a new one:

     ```bash
     yc iam oauth-client-secret create \
       --oauth-client-id <OAuth_client_ID>
     ```

     Save the `secret_value` value from the command output: this is the Client Secret you will need to configure your Grafana Cloud.

{% endlist %}

#### Configure the redirect URI {#setup-redirect}

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Log in to [Yandex Identity Hub](https://center.yandex.cloud/organization).
  1. In the left-hand panel, select ![shapes-4](../../../../_assets/console-icons/shapes-4.svg) **Apps** and then, the OIDC app.
  1. At the top right, click ![pencil](../../../../_assets/console-icons/pencil.svg) **Edit** and in the window that opens:
      1. In the **Redirect URI** field, specify the authentication endpoint for your Grafana Cloud instance formatted as follows:

        ```text
        <Grafana_Cloud_instance_URL>/login/generic_oauth
        ```

        For example: `https://your-org.grafana.net/login/generic_oauth`.

      1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. Update your OAuth client by providing the redirect URI:

     ```bash
     yc iam oauth-client update \
       --id <OAuth_client_ID> \
       --redirect-uris "<Grafana_Cloud_instance_URL>/login/generic_oauth"
     ```

     Where:
     
     * `<OAuth_client_ID>`: OAuth client ID you got when you created it.
     * `--redirect-uris`: Authentication endpoint for your Grafana Cloud instance. For example: `https://your-org.grafana.net/login/generic_oauth`.

     Result:

     ```text
     id: ajeiu3otac08********
     name: grafana-cloud-oidc-app
     redirect_uris:
       - https://your-org.grafana.net/login/generic_oauth
     scopes:
       - openid
       - email
       - profile
     folder_id: b1gkd6dks6i1********
     status: ACTIVE
     ```

{% endlist %}

### Set up the OIDC application in Grafana Cloud {#setup-sp}

To configure OpenID Connect authentication in Grafana Cloud, in the left-hand panel, navigate to **Administration** and then to **Authentication**.
In the main window, select **Generic OAuth**.

In the Generic OAuth settings:

1. Under **Name**, specify `OpenID Connect`.
1. In the **Scopes** field, enter the following, one by one: `openid`, `email`, `profile`.
1. Under **Client ID**, specify the value you copied from the **ClientID** field when setting up the OIDC application in Yandex Identity Hub.
1. In the **Client Secret** field, specify the value you copied from the **App secrets** section when setting up the OIDC application in Yandex Identity Hub.
1. Click **Enter OpenID Connect Discovery URL** and then, in the window that opens, specify the URL you copied from the **OpenID Configuration** field when setting up the OIDC application in Yandex Identity Hub.
1. Enable **Allow sign up** to automatically create users on first sign-in.

### Add a user {#add-user}

For your organization's users to be able to authenticate in Grafana Cloud with Yandex Identity Hub's OIDC app, you need to explicitly add these users and/or [user groups](../../../concepts/groups.md) to the OIDC application.

{% note info %}

Users and groups added to an OIDC application can be managed by a user with the `organization-manager.oidcApplications.userAdmin` [role](../../../security/index.md#organization-manager-oidcApplications-userAdmin) or higher.

{% endnote %}

Add a user to the application:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

    1. Log in to [Yandex Identity Hub](https://center.yandex.cloud/organization).
    1. In the left-hand panel, select ![shapes-4](../../../../_assets/console-icons/shapes-4.svg) **Apps** and select the required app.
    1. Navigate to the **Users and groups** tab.
    1. Click ![person-plus](../../../../_assets/console-icons/person-plus.svg) **Add users**.
    1. In the window that opens, select the required user or user group.
    1. Click **Add**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. Get the [user ID](../../../operations/users-get.md) or [user group ID](../../../operations/group-get-id.md).

  1. To add a user or user group to the app:
   
     1. See the description of the CLI command for adding users to an app:
   
        ```bash
        yc organization-manager idp application oauth application add-assignments --help
        ```
   
     1. Run this command:
   
        ```bash
        yc organization-manager idp application oauth application add-assignments \
          --id <app_ID> \
          --subject-id <user_or_group_ID>
        ```
   
        Where:
   
        * `--id`: OIDC app ID.
        * `--subject-id`: User or user group ID.
   
        Result:
   
        ```text
        assignment_deltas:
          - action: ADD
            assignment:
              subject_id: ajetvnq2mil8********
        ```

{% endlist %}

## Make sure your application works correctly {#validate}

To make sure both your OIDC app and Grafana Cloud integration work correctly, authenticate to Grafana Cloud as one of the users you added to the app.

Proceed as follows:

1. In your browser, navigate to the address of your Grafana Cloud instance, e.g., `https://your-org.grafana.net`.
1. If you were logged in to Grafana Cloud, log out.
1. On the Grafana Cloud sign in page, click **Sign in with OpenID Connect**.
1. On the Yandex Cloud sign in page, enter the user email and password. The user or group they belong to must be added to the application.
1. Make sure you have successfully authenticated in Grafana Cloud.