MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.28k stars 21.46k forks source link

Add example for ExtractMailPrefix transformation claim #93415

Open trs80 opened 2 years ago

trs80 commented 2 years ago

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.

shwetamathur7 commented 2 years ago

@trs80 Thanks for your feedback. We will investigate and update the thread.

JamesTran-MSFT commented 2 years ago

@trs80 Thanks for your feedback! I've assigned this issue to the author who will investigate and update as appropriate.

rwike77 commented 2 years ago

reassign:davidmu1 Reassigning, since you've got this content now. Thanks.

nickludwig commented 2 years ago

reassign:sreyanth