# Microsoft AD FS

{% hint style="success" %}
Please complete the steps in the [Admin Console Configuration](https://docs.keeper.io/en/sso-connect-cloud/admin-console-configuration) section first.
{% endhint %}

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FFgOPrQVrAUIxwYhEnt4c%2FMicrosoft%20AD%20FS.jpg?alt=media&#x26;token=f6e153da-e64f-47c6-af8f-4d40570ad1ae" alt=""><figcaption></figcaption></figure>

### Microsoft AD FS

#### Obtain Federation Metadata XML

Inside the AD FS Management application, locate the Federation Metadata xml file. This can be found by clicking on AD FS > Service > Endpoints then locate the URL path in the "Metadata" section. The path is typically **/FederationMetadata/2007-06/FederationMetadata.xml** as seen below:

![Locate the Federation Metadata XML File](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FdEUEo9eHiVtpsOYCNaTU%2Fadfs8.jpeg?alt=media\&token=13c788bc-14c8-4742-95f0-444ade44ad98)

![Metadata Path](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2Fsfvb9K4NTTmwIyOJlo0m%2FScreen%20Shot%202022-08-08%20at%209.42.55%20AM.png?alt=media\&token=69527695-91d5-43f7-8eef-d9973f676d85)

#### Download the Metadata

To download the metadata file, this can typically be found by loading the URL in the browser on the server. For example:\
\
<https://localhost/FederationMetadata/2007-06/FederationMetadata.xml\\>
\
Download this file and save to the computer.

![Download the Metadata XML File](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FwFmTe26PqHbd31zpjxH1%2Fadfs9.jpeg?alt=media\&token=d3b11966-e98e-4670-8384-fe02d700373d)

### Import Federation Metadata

From the Keeper Admin Console SSO Cloud configuration screen, select "ADFS" as the IdP type and import the Federation Metadata file saved in the previous step.

![Select IDP Type and Upload SAML Metadata](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FaygaOsJZpXNWzPj0kzGr%2FScreen%20Shot%202022-08-08%20at%203.44.48%20PM.png?alt=media\&token=c0ce7c48-06a6-4c3a-8a80-beafd73cf605)

#### Export Keeper Metadata

Go back to the Provisioning screen and click on View.

![View Settings](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FJvsgfYFgGEEl2S2bb4qT%2FScreen%20Shot%202022-08-08%20at%203.46.13%20PM.png?alt=media\&token=32b81d75-50cd-4695-a47a-c26d9ad335db)

####

Next download the Keeper metadata file so it can be imported during the Relying Part Trust Wizard. Navigate to the view screen of the Keeper SSO Connect Cloud™ provisioning.

![](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MF6qXz87_x0Liy5MwqV%2F-MF6wuzY9HNPfwoC_vLk%2FView.png?alt=media\&token=7bd082f3-56ba-4ede-b3c6-25ff0767cc6d)

Click the "Export Metadata" button to download the config.xml file. This will be used in a few steps ahead.

![Export Metadata](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2Fq0jj6ewIaSOkSj035YYz%2FScreen%20Shot%202022-08-08%20at%203.47.44%20PM.png?alt=media\&token=710fd05b-7fd3-4d78-8ad9-4b7f703e23cc)

### Finish AD FS Configuration <a href="#finish-adfs-config" id="finish-adfs-config"></a>

{% hint style="warning" %}
Important: Keeper's Cloud SSO SP Certificate is only valid for a year. On an annual basis, you will need to download the latest Keeper SP Cert from the Admin Console and upload this into the Relying Trust Party settings in AD FS.

Keeper notifies all affected customers when the certificate expiration is coming soon.
{% endhint %}

#### Create Relying Trust Party

Create Keeper SSO Connect as a Relying Party Trust:

![Add Relying Party Trust](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2Fih04VLO0sX5lJe3Do2zN%2Fadfs10.jpeg?alt=media\&token=b52fd358-c1da-40bc-b3ee-24748f4d7f59)

#### Import Keeper Metadata

Import the Keeper Metadata file that was exported previously from Keeper SSO Connect Cloud view screen by completing the Relying Party Trust Wizard as seen in the steps below.

Select "Claims aware" in the Welcome screen and then select the metadata file saved from Keeper.

![Import Keeper Metadata](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2F39ikdXrd3Eey0ro9AUhd%2Fadfs12.jpeg?alt=media\&token=fed9cd1d-da90-4ffa-ad5c-dbe160f07ae9)

![Enter a Display Name: Keeper SSO Connect Cloud](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNQk5pWatNHCfAhRi%2Fsso-step-35b.png?alt=media\&token=766b5d81-0731-4fb2-b520-937f5cbf81f0)

![Choose an access control policy](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNSf8o2Y9l5O_iDlD%2Fsso-step-36b.png?alt=media\&token=95b3352f-0c9d-4960-961e-401402af76cd)

![SAML Logout Endpoints](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNUc979TA72Cx4UFr%2Fsso-step-37b.png?alt=media\&token=4dbdb58e-ad4c-4d8c-a1bd-6a12981b1bc2)

{% hint style="danger" %}
To prevent a logout error, change the SAML Logout Endpoints on the Relying Party Trust to: https\://**\<YourADFSserverDomain>**/adfs/ls/?wa=wsignout1.0
{% endhint %}

![Configure Claims issuance policy](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNePiAObddm6FEJJe%2Fsso-step-38b.png?alt=media\&token=9cdf2e1f-db0f-4634-91e1-8d4bc0a57549)

![Relying Party Trusts](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNftnJ9zPx-PNHm_S%2Fsso-step-39b.png?alt=media\&token=bb82318c-d117-4d5f-87c5-5f7f13ee3fd5)

#### Create Claim Issuance Policy Rules <a href="#claim-issuance-policy" id="claim-issuance-policy"></a>

To map attributes between AD FS and Keeper, you need to create a Claim Issuance Policy with **Send LDAP Attributes as Claims** and map the LDAP attributes to Keeper Connect attributes.

![Edit Claim Issuance Policy](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNw9zDYpTAjc15BJ-%2Fsso-step-40b.png?alt=media\&token=beddbab1-049b-46ba-a469-f9492a199cad)

![Add Rule...](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNxKVltK3IYEeNusx%2Fsso-step-41b.png?alt=media\&token=907ad397-451a-4f8b-8610-534415117395)

![Choose Rule Type](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuNzVs4U-zAl3PerqH%2Fsso-step-42b.png?alt=media\&token=de86d7db-eea2-4870-a7ce-621ffa96268b)

![Claim Rule Name - Mapping](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuOF0q7MgyThqOc46Z%2Fsso-step-43b.png?alt=media\&token=e4e245a2-dedc-468a-85b9-76602ea4f25a)

{% hint style="info" %}
**Important: Ensure that 3 attributes ("First", "Last" and "Email") are configured with the exact spelling as seen above**.
{% endhint %}

![Issuance Transform Rules](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuOZ_G7xmVizBc9OtE%2Fsso-step-44b.png?alt=media\&token=7bcbed8f-df61-437d-92e9-c9200db4f7e9)

For Logout support we need to add two more Claim Issuance Policy rules:

![Send Claims Using a Custom Rule](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuOaPn08WqATxQ01QU%2Fsso-step-45b.png?alt=media\&token=d6589e03-dfd9-41a1-90d7-5aa7a32dea63)

![Create Opaque Persistent ID](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuOby0sXrf3aMZZnSC%2Fsso-step-46b.png?alt=media\&token=dfe38765-8f43-4816-b646-a5116ff09762)

To copy the syntax to add in the claims rule, copy the following text and paste it into the custom rule:

```
c1:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]
 && c2:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant"]
 => add(store = "_OpaqueIdStore", types = ("http://mycompany/internal/sessionid"), query = "{0};{1};{2};{3};{4}", param = "useEntropy", param = c1.Value, param = c1.OriginalIssuer, param = "", param = c2.Value);
```

![](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuOyw8fm5erliGrFw3%2Fsso-step-47b.png?alt=media\&token=240a5fc8-cebc-4126-90d5-df17823d77b0)

![Transform an Incoming Claim](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuP-TleK7w73gU7g1D%2Fsso-step-48b.png?alt=media\&token=d3ea3834-7bd9-4696-a658-9810b2da7c29)

![Create Persistant Name Identifier](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuP3NKyZp__RWNE3nR%2Fsso-step-49b.png?alt=media\&token=584fa84e-ece0-4d46-b1dd-fb9bb1f5458e)

Incoming claim type: \*\*<http://mycompany/internal/sessionid**\\>
Outgoing claim type: **Name ID**\
Outgoing name ID format: **Transient Identifier**

![Set Outgoing Claim and Name ID Format](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuP8bi6mA1KdxhJ2-9%2Fsso-step-50b.png?alt=media\&token=171c4858-f0af-4fe7-96c3-e9295f8d82e6)

#### SAML Signing Configuration

a. Open Powershell as Administrator on the AD FS server.\
\
b. Identify your SSO Connect Relying Party Trust "Identifier" string which you can obtain by running:

```
Get-ADFSRelyingPartyTrust
```

Running this command will generate a long list of output, you are looking for the SSO Connect section and the "Identifier" string. This string will look something like:\
<https://keepersecurity.com/api/rest/sso/saml/459561502484>

c. Run the below command, replacing \<Identifier> with the string found in step (b).

```
Set-ADFSRelyingPartyTrust -TargetIdentifier <Identifier> -samlResponseSignature MessageAndAssertion
```

If you run Get-ADFSRelyingPartyTrust again, you'll see that the SamlResponseSignature section is set to "MessageAndAssertion".

#### Restart AD FS services

From the services manager, restart AD FS service.

![](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MBuG8lPowYSH8fqBdm2%2F-MBuPUNcmtjGDMJKW6Md%2Frestart_adfs.png?alt=media\&token=5a5d484e-b674-4268-a933-bb1d26ead458)

{% hint style="info" %}
SAML assertion signing must be configured properly on your AD FS environment. If signing has not been configured, you will need to set this up, then exchange metadata again between AD FS and Keeper SSO Connect after the re-configuration.
{% endhint %}

### Troubleshooting

If you need to disable certificate validation on the IdP for testing purposes or for internal PKI certificates, you can use the below Powershell commands. Replace \<Identifier> with the string found in the "SAML Signing Configuration" instructions above.

```
Set-ADFSRelyingPartyTrust -TargetIdentifier 
<Identifier> -EncryptionCertificateRevocationCheck None
```

```
Set-ADFSRelyingPartyTrust -TargetIdentifier 
<Identifier> -SigningCertificateRevocationCheck None
```

Note: Any changes made to signing configuration may require exchange of XML metadata between IdP and SSO Connect.

#### Move existing users/initial admin to SSO authentication

Users created in the root node (top level) will need to be migrated to the sub node that the SSO integration was configured on. If users remain in the root node, they will be prompted for the master password when accessing the vault and/or admin console.

{% hint style="warning" %}
An admin can not move themselves to the SSO enabled node. It requires another admin to perform this action.
{% endhint %}

After the user is moved to the SSO enabled node, they need to log into the Keeper vault initially by selecting the "Enterprise SSO" pull down and inputting in the Enterprise Domain configured on the SSO integration. The user may get prompted to confirm by entering in the master password.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FfFPNzWDvSwH48ebLJOeY%2FSSO_Login.png?alt=media&#x26;token=f7bc0249-986d-427d-9746-0e7873ff7840" alt=""><figcaption><p>Initially select 'Enterprise SSO Login'</p></figcaption></figure>

Once the user has authenticated with SSO, they only need to use their email address moving forward to initiate SSO authentication.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FDrVwIHQiMQDtlxeJey0G%2Fvault_Login.PNG?alt=media&#x26;token=2e435451-c23e-41bd-91e2-8ec49a216c16" alt=""><figcaption></figcaption></figure>

They won't have to enter the Enterprise Domain. If typing in the email address and clicking Next does not route the user to the desired SSO, ensure that just-in-time provisioning is enabled in the Keeper SSO configuration and ensure that your email domain is reserved by Keeper. More information regarding routing and domain reservation [can be found here](https://docs.keeper.io/enterprise-guide/domain-reservation).
