› Support Forums › Product Support › Retrieving additional fields/claims from Azure AD
Tagged: Azure AD, Claims, ProfileService
- This topic has 2 replies, 2 voices, and was last updated 2 months, 1 week ago by loada.
- March 25, 2023 at 2:34 pm #52903loadaMember
I purchased your template for a project and it’s been really great. It runs perfectly and has saved me a ton amount of time.
I’m using it with Azure and I’ll like to retrieve some extra fields/claims in addition to the email from active directory. In the project the email is already present when you login with Microsoft and I’ll like to add some additional claims from Azure AD.
Any tips as to how to accomplish this in code?
SamMarch 25, 2023 at 7:52 pm #52906Eben MonneyAdmin
Thank you for choosing QuickApp for your project and thank you for your purchase!
Please follow the below steps to add your additional fields from Azure AD
- In Azure AD, ensure your extra claims are included in the idToken. See this Azure post on how to do that: Provide optional claims to Azure AD apps – Microsoft Learn
- In QuickApp, in the “ProfileService.cs” file add the below lines to the method
GetProfileDataAsync. This will add your Azure AD claims to the accessToken and your Azure claims will be accessible from code:
List azureADClaims = context.Subject.Claims .Where(c => c.Type == "Your_AzureAD_Claim1" || c.Type == "Your_AzureAD_Claim2").ToList(); claims.AddRange(azureADClaims)
Hope this helpsMarch 28, 2023 at 11:58 am #52964loadaMemberTopic Author
Many thanks for your help. I have it working now!
- You must be logged in to reply to this topic.