How to trim a character in Azure AD SAML claims

Akshay 0 Reputation points
2023-09-07T21:09:04.78+00:00

I have a SAML application which is using emailaddress claim. I have some users who have ' (single quote) in their email addresses and I would like to remove through claim transformations.

For example john.sn**'**ow@google.com should be sent as john.snow@google.com in SAML assertion.

As per the MS official claim transformations article, it may be possible through regexreplace() but the syntax looks so confusing. Can this be achieved at all?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,413 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 29,741 Reputation points Microsoft Employee
    2023-09-12T07:11:42.2166667+00:00

    Hi @Akshay

    Thanks for reaching out.

    You can use the regexReplace() function to transform the mail address.

    You can use below regax to remove the single Quote and concatenate the email address.

    ^(?'firstpart'[^']+)'(?'SingleQuote')|(?'lastpart'[\w\.-]+@[\w\.-]+)$
    
    
    

    User's image

    Hope this will help.

    Thanks,

    Shweta


    Please remember to "Accept Answer" if answer helped you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.