SAML configuration options
Grafana Cloud Enterprise RSS

SAML configuration options

This page provides a comprehensive guide to configuring SAML authentication in Grafana. You’ll find detailed configuration examples, available settings, and their descriptions to help you set up and customize SAML authentication for your Grafana instance.

The table below describes all SAML configuration options. Continue reading below for details on specific options. Like any other Grafana configuration, you can apply these options as environment variables.

SettingRequiredDescriptionDefault
enabledNoWhether SAML authentication is allowed.false
nameNoName used to refer to the SAML authentication in the Grafana user interface.SAML
entity_idNoThe entity ID of the service provider. This is the unique identifier of the service provider.https://{Grafana URL}/saml/metadata
single_logoutNoWhether SAML Single Logout is enabled.false
allow_sign_upNoWhether to allow new Grafana user creation through SAML login. If set to false, then only existing Grafana users can log in with SAML.true
auto_loginNoWhether SAML auto login is enabled.false
allow_idp_initiatedNoWhether SAML IdP-initiated login is allowed.false
certificate or certificate_pathYesBase64-encoded string or Path for the SP X.509 certificate.
private_key or private_key_pathYesBase64-encoded string or Path for the SP private key.
signature_algorithmNoSignature algorithm used for signing requests to the IdP. Supported values are rsa-sha1, rsa-sha256, rsa-sha512.
idp_metadata, idp_metadata_path, or idp_metadata_urlYesBase64-encoded string, Path or URL for the IdP SAML metadata XML.
max_issue_delayNoMaximum time allowed between the issuance of an AuthnRequest by the SP and the processing of the Response.90s
metadata_valid_durationNoDuration for which the SP metadata remains valid.48h
relay_stateNoRelay state for IdP-initiated login. This should match the relay state configured in the IdP.
assertion_attribute_nameNoFriendly name or name of the attribute within the SAML assertion to use as the user name. Alternatively, this can be a template with variables that match the names of attributes within the SAML assertion.displayName
assertion_attribute_loginNoFriendly name or name of the attribute within the SAML assertion to use as the user login handle.mail
assertion_attribute_emailNoFriendly name or name of the attribute within the SAML assertion to use as the user email.mail
assertion_attribute_groupsNoFriendly name or name of the attribute within the SAML assertion to use as the user groups.
assertion_attribute_roleNoFriendly name or name of the attribute within the SAML assertion to use as the user roles.
assertion_attribute_orgNoFriendly name or name of the attribute within the SAML assertion to use as the user organization
allowed_organizationsNoList of comma- or space-separated organizations. User should be a member of at least one organization to log in.
org_mappingNoList of comma- or space-separated Organization:OrgId:Role mappings. Organization can be * meaning “All users”. Role is optional and can have the following values: None, Viewer, Editor or Admin.
role_values_noneNoList of comma- or space-separated roles which will be mapped into the None role.
role_values_viewerNoList of comma- or space-separated roles which will be mapped into the Viewer role.
role_values_editorNoList of comma- or space-separated roles which will be mapped into the Editor role.
role_values_adminNoList of comma- or space-separated roles which will be mapped into the Admin role.
role_values_grafana_adminNoList of comma- or space-separated roles which will be mapped into the Grafana Admin (Super Admin) role.
skip_org_role_syncNoWhether to skip organization role synchronization.false
name_id_formatNoSpecifies the format of the requested NameID element in the SAML AuthnRequest.urn:oasis:names:tc:SAML:2.0:nameid-format:transient
client_idNoClient ID of the IdP service application used to retrieve more information about the user from the IdP. (Microsoft Entra ID only)
client_secretNoClient secret of the IdP service application used to retrieve more information about the user from the IdP. (Microsoft Entra ID only)
token_urlNoURL to retrieve the access token from the IdP. (Microsoft Entra ID only)
force_use_graph_apiNoWhether to use the IdP service application retrieve more information about the user from the IdP. (Microsoft Entra ID only)false

Example SAML configuration

ini
[auth.saml]
enabled = true
auto_login = false
certificate_path = "/path/to/certificate.cert"
private_key_path = "/path/to/private_key.pem"
idp_metadata_path = "/my/metadata.xml"
max_issue_delay = 90s
metadata_valid_duration = 48h
assertion_attribute_name = displayName
assertion_attribute_login = mail
assertion_attribute_email = mail

assertion_attribute_groups = Group
assertion_attribute_role = Role
assertion_attribute_org = Org
role_values_viewer = external
role_values_editor = editor, developer
role_values_admin = admin, operator
role_values_grafana_admin = superadmin
org_mapping = Engineering:2:Editor, Engineering:3:Viewer, Sales:3:Editor, *:1:Editor
allowed_organizations = Engineering, Sales

Example SAML configuration in Terraform

Note

Available in Public Preview in Grafana v11.1 behind the ssoSettingsSAML feature toggle. Supported in the Terraform provider since v2.17.0.

terraform
resource "grafana_sso_settings" "saml_sso_settings" {
  provider_name = "saml"
  saml_settings {
    name                       = "SAML"
    auto_login                 = false
    certificate_path           = "/path/to/certificate.cert"
    private_key_path           = "/path/to/private_key.pem"
    idp_metadata_path          = "/my/metadata.xml"
    max_issue_delay            = "90s"
    metadata_valid_duration    = "48h"
    assertion_attribute_name   = "displayName"
    assertion_attribute_login  = "mail"
    assertion_attribute_email  = "mail"
    assertion_attribute_groups = "Group"
    assertion_attribute_role   = "Role"
    assertion_attribute_org    = "Org"
    role_values_editor         = "editor, developer"
    role_values_admin          = "admin, operator"
    role_values_grafana_admin  = "superadmin"
    org_mapping                = "Engineering:2:Editor, Engineering:3:Viewer, Sales:3:Editor, *:1:Editor"
    allowed_organizations      = "Engineering, Sales"
  }
}

Go to Terraform Registry for a complete reference on using the grafana_sso_settings resource.