Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

ASP.NET MVC: How can I query Dynamics 365 as the logged in user, authenticated with AAD?

(0) ShareShare
ReportReport
Posted on by 35

I'm not sure if this is the best place to ask this question, but it seems to be? I'm creating an ASP.NET MVC website that authenticates with Azure Active Directory. This site will interact with Dynamics 365 entities and I'd like to query and update Dynamics 365 entities with the identity that the user used to log into my site. This is not a multi-tenant application; just an internal tool to help with Dynamics 365 adoption.

I made a post on StackOverflow looking for advice. https://stackoverflow.com/questions/65313201/how-can-i-query-dynamics-365-as-the-logged-in-user-in-an-asp-net-mvc-site-authen

Long story short, I'm using Microsoft.Xrm.Tooling.Connector.CrmServiceClient to connect right now, but this requires a username and password in the connection string and I want to connect with the identity that the user logged in with, but I don't know how to do this. I'm open to changing to a different SDK or package.

I'm having a hard time finding a modern example or documentation that is intended for programmers rather than IT configuration.

When registering the website in Azure, I indicated that the user will need grant permission to interact with Dynamics 365 on their behalf, and I was prompted for this permission when I logged in, but as the programmer, I'm not sure how to actually use this permission.

Any suggestions, documentation links or advice?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans