Monday, November 18, 2019

ADFS error - The audience restriction was not valid because the specified audience identifier is not present in the acceptable identifiers list of this Federation Service.

After adding a claims provider trust in ADFS, we got the following error message when trying to use the configured 3th party IP-STS.

The audience restriction was not valid because the specified audience identifier is not present in the acceptable identifiers list of this Federation Service.

User Action

See the exception details for the audience identifier that failed validation. If the audience identifier identifies this Federation Service, add the audience identifier to the acceptable identifiers list by using Windows PowerShell for AD FS.  Note that the audience identifier is used to verify whether the token was sent to this Federation Service. If you think that the audience identifier does not identify your Federation Service, adding it to the acceptable identifiers list may open a security vulnerability in your system.

Exception details:

Microsoft.IdentityServer.AuthenticationFailedException: ID1038: The AudienceRestrictionCondition was not valid because the specified Audience is not present in AudienceUris.

Audience: 'http://adfs4.example.be/adfs/services/trust' ---> Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException: ID1038: The AudienceRestrictionCondition was not valid because the specified Audience is not present in AudienceUris.

Audience: 'http://adfs4.example.be/adfs/services/trust'

To solve this problem we had to add the audience uri of our ADFS server to the list of acceptable identifiers(as well explained in the error message):

 set-ADFSProperties -AcceptableIdentifier 'http://adfs4.example.be/adfs/services/trust'