SAML Authentication Request NameID Policy Issue – Windows Server 2016 ADFS

adfssamlwindows-server-2016

I'm using Issuance Policy as:

Rule 1:

enter image description here

Rule 2 (custom):

c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"]
 => issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", 
Issuer = c.Issuer, 
OriginalIssuer = c.OriginalIssuer, 
Value = c.Value, 
ValueType = c.ValueType,
Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient", 
Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/namequalifier"] = "https://fs.hhres.com/adfs/services/trust", 
Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/spnamequalifier"] = "sp_test");

When I try to login, it gives me error (from Event Viewer)-

The SAML authentication request had a NameID Policy that could not be
satisfied.

Requestor: BambooHR-SAML

Name identifier format:
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
SPNameQualifier:

Exception details: MSIS7070: The SAML request contained a
NameIDPolicy that was not satisfied by the issued token. Requested
NameIDPolicy: AllowCreate: True Format:
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
SPNameQualifier: . Actual NameID properties: Format:
urn:oasis:names:tc:SAML:2.0:nameid-format:transient, NameQualifier:
https://adfs_url/adfs/services/trust SPNameQualifier: sp_test,
SPProvidedId: .

This request failed.

User Action Use the AD FS Management snap-in to configure the
configuration that emits the required name identifier.

Can someone please explain what I'm doing wrong and what needs to be done?

Best Answer

I resolved this by changing the line-

Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient", 

into

Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",