ADFS SAML2 UserID Claim Rule

I was recently asked to setup SSO with a third-party vendor. The vendor required SAML2 with IdP initiated login, which in itself isn’t all that strange. The unusual requirement was the vendor required a claim called “UserID” that would match the users login credentials for the third-party product. This claim rule could not be achieved using any of the built-in ADFS claims, so I had to write a custom claim rule.

The following claim rule will pass the sAMAccountName (<domain>\<user id> as the claim.