--- layout: docs page_title: "Troubleshoot ADFS and SAML: automatic group mapping fails" description: >- Fix connection problems in Vault due to a bad mapping between groups and policies when using Active Directory Federation Services (ADFS) as an SAML provider. --- > [!IMPORTANT] > **Documentation Update:** Product documentation, which were located in this repository under `/website`, are now located in [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs), colocated with all other product documentation. Contributions to this content should be done in the `web-unified-docs` repo, and not this one. Changes made to `/website` content in this repo will not be reflected on the developer.hashicorp.com website. # Automatic group mapping fails Troubleshoot problems where the debugging data suggests a bad or nonexistent mapping between your Vault role and AD FS the Claim Issuance Policy. ## Example debugging data ```json [DEBUG] auth.saml.auth_saml_1d2227e7: validating user context for role: api=callback role_name=default-saml role="{ "token_bound_cidrs":null, "token_explicit_max_ttl":0, "token_max_ttl":0, "token_no_default_policy":false, "token_num_uses":0, "token_period":0, "token_policies":["default"], "token_type":0, "token_ttl":0, "BoundSubjects":["*@example.com","*@ext.example.com"], "BoundSubjectsType":"glob", "BoundAttributes":{"http://schemas.xmlsoap.org/claims/Group":["VaultAdmin","VaultUser"]}, "BoundAttributesType":"string", "GroupsAttribute":"groups" }" user context="{ "attributes": { "http://schemas.xmlsoap.org/claims/Group":["Domain Users","VaultAdmin"], "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress":["rs@example.com"] }, "subject":"rs@example.com" }" ``` ## Analysis Use `vault read` to review the current role configuration: ```shell-session $ vault read auth//role/ Key Value --- ----- bound_attributes map[http://schemas.xmlsoap.org/claims/Group:[VaultAdmin VaultUser]] bound_attributes_type string bound_subjects [*@example.com *@ext.example.com] bound_subjects_type glob groups_attribute groups token_bound_cidrs [] token_explicit_max_ttl 0s token_max_ttl 0s token_no_default_policy false token_num_uses 0 token_period 0s token_policies [default] token_ttl 0s token_type default ``` The Vault role uses `groups` for the group attribute, so Vault expects user context in the SAML response to include a `groups` attribute with the form: ```text user context="{ "attributes": { "groups":[]", ... } }" ``` But the SAML response indicates the Claim Issuance Policy uses `Group` for the group attribute, so the user context uses `Group` to key the bound groups: ```text user context="{ "attributes": { "http://schemas.xmlsoap.org/claims/Group":["Domain Users","VaultAdmin"], ... }, "subject":"rs@example.com" }" ``` ## Solution The first option to resolve the problem is update `group_attribute` for the Vault role to use `Group`: ```shell-session $ vault write auth//role/ \ groups_attribute=http://schemas.xmlsoap.org/claims/Group ``` For example: ```shell-session $ vault write auth/saml/role/adfs-default \ groups_attribute=http://schemas.xmlsoap.org/claims/Group ``` The second option to resolve the problem is to update your AD FS configuration to use `groups` and confirm the bound attributes in Vault match the expected groups: 1. Update your AD FS the Claim Issuance Policy to use `groups` for unqualified names: | LDAP attribute | Outgoing claim type |------------------------------------|-------------------- | `Token-Groups - Unqualified Names` | `groups` 1. Verify the bound attribute for your Vault role match the groups listed in the SAML response: ```shell-session $ vault write auth//role/ \ bound_attributes=groups="" ``` For example: ```shell-session $ vault write auth/saml/role/default-adfs \ bound_attributes=groups="VaultAdmin,VaultUser" ``` ## Additional resources - [SAML auth method Documentation](/vault/docs/auth/saml) - [SAML API Documentation](/vault/api-docs/auth/saml) - [Set up an AD FS lab environment](https://learn.microsoft.com/en-us/windows-server/identity/ad-fs/operations/set-up-an-ad-fs-lab-environment)