It seems that you are encountering the AADSTS50034 error, which indicates that the user account does not exist in the Azure Active Directory (AAD) directory. Here are some key points to consider when configuring Keycloak as an IdP for Azure:
- SAML Attributes: Ensure that the SAML attributes you are sending from Keycloak match the required attributes in Azure. Specifically, the
NameID
should be the same as the user's ImmutableID in Azure. TheIDPEmail
should be the User Principal Name (UPN) of the user in Azure. - Required Claims: According to the documentation, the following claims are necessary for the SAML 2.0 token issued by the IdP:
-
NameID Format
:urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
-
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress
: This should contain the user's email address.
-
- Guest Accounts: Since you mentioned that the user is added as a guest, ensure that the identifier claims of the enterprise application are updated to use a consistent attribute for all guest users. You might want to check if the
user.localuserprincipalname
is being used instead ofuser.userprincipalname
. - Debugging the Handshake: If the handshake appears correct but the user is not recognized, double-check the configurations in both Keycloak and Azure. Ensure that the certificates and endpoints are correctly set up and that any required signing is properly configured.
- Testing with Different Claims: If you are still facing issues, try testing with different combinations of claims and ensure that the values being sent are in the expected format.
By ensuring that these configurations are correct, you should be able to resolve the issue with the SAML External Provider setup.
References: