|ExtractMailPrefix|Email or UPN|extracted string|ExtensionAttributes 1-15 or any other Schema Extensions which are storing a UPN or email address value for the user e.g. johndoe@contoso.com. Extracts the local part of an email address. For example: mail:"foo@bar.com" results in outputClaim:"foo". If no \@ sign is present, then the original input string is returned as is.|
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: 195c79a3-ccc5-8c6a-233e-95e344a9b4df
Version Independent ID: 401c7557-5817-bbd3-5bd8-8c97ef5a28cc
There's no documentation on what a ExtractPrefix transformation looks like. After much trial and error I came up with this:
New-AzureADPolicy -Definition @('{"ClaimsMappingPolicy":{"Version":1,"IncludeBasicClaimSet":"true","ClaimsSchema":[{"Source":"user","ID":"userprincipalname"},{"Source":"transformation","ID":"ExtractPrefix","TransformationId":"ExtractThePrefix","JwtClaimType":"username_prefix"}],"ClaimsTransformations":[{"ID":"ExtractThePrefix","TransformationMethod":"ExtractMailPrefix","InputClaims":[{"ClaimTypeReferenceId":"userprincipalname","TransformationClaimType":"mail"}],"OutputClaims":[{"ClaimTypeReferenceId":"ExtractPrefix","TransformationClaimType":"outputClaim"}]}]}}') -DisplayName "Username Prefix Extraction Claims Mapping Policy" -Type "ClaimsMappingPolicy"
This line could also be updated to indicate the InputClaims TransformationClaimType is mail and OutputClaims TransformationClaimType is outputClaim for TransformationMethod ExtractMailPrefix: https://github.com/MicrosoftDocs/azure-docs/blame/main/articles/active-directory/develop/reference-claims-mapping-policy-type.md#L402
|ExtractMailPrefix|Email or UPN|extracted string|ExtensionAttributes 1-15 or any other Schema Extensions which are storing a UPN or email address value for the user e.g. johndoe@contoso.com. Extracts the local part of an email address. For example: mail:"foo@bar.com" results in outputClaim:"foo". If no \@ sign is present, then the original input string is returned as is.|
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.