Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Are Azure credentials enough in an online Asp.net app or token is needed for CRM queries?

Posted on by Microsoft Employee

Hello, I need your advice and help.

I have an account that is successfully connected to Azure and an App which is registered to Active directory. I also added all permissions as instructed so I published the app. Now I can login into this app with my Azure credentials online.

I also tested Postman with success adding all credentials and headers as per instructions here (docs.microsoft.com/.../setup-postman-environment) and I got response from CRM as expected, so this is working good.

As I am new to C# and Azure services I have some questions about next steps:

1. Do I need to obtain token in order to make CRM queries (GET, POST, DELETE...) towards "accounts" and "contacts"? Or is logging into app enough?

2. How can I make Controller to make all REST requests from #1? Can you give me some example?

Please help me, I need to fix this as soon as possible.

Thank you in advance.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Are Azure credentials enough in an online Asp.net app or token is needed for CRM queries?

    Hello and thank you very much for your answer, it was helpful.

    I looked at this documentation earlier, but there is no example of I can ca obtain token and use it in asp.net mvc project.

    Can you please give me an example? I need token obtaining code, and controller/model classes just as an example.

    Thank you in advance.

  • Verified answer
    Kalpavruksh D365 CoE Profile Picture
    Kalpavruksh D365 CoE 2,545 on at
    RE: Are Azure credentials enough in an online Asp.net app or token is needed for CRM queries?

    Hi,

    There are two ways to connect D365 from external application.

    1. Xrm Tooling

    2. Web API

    In Xrm Tooling, only D365 connection string required for authentication and performing CRUD operations.

    https://wp.me/p7Thij-8K

    Web API requires the below steps:

    1. Register the application under azure AD and get application ID and client key.

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/walkthrough-register-app-azure-active-directory

    2. In c#. Net code, Authenticate your request using Azure AD and get the access token.

    3. Using access token, perform the WebAPI operations in D365. Please refer below documentation

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/quick-start-console-app-csharp

    If found useful, please mark this answer as a verified answer.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans