Share via


Configure Azure and create dynamics 365 apps using OAuth, WebAPI (C#)

Hey Everyone

This blog covers the configuration steps that are required for app registration in Azure console and then consume WebAPI for creating and search existing records in CRM.

Prerequisites :

  1. Using Azure Management Console
  2. Json Serialize using Newtonsoft
  3. Basic understanding of HttpClient and WebAPI in general
  4. ADAL (Azure Active Directory Authentication Library)

CONFIGURE YOUR APPLICATION USING AZURE MANAGEMENT CONSOLE:

  1. Sign-up for Azure Trial/Office 365/Dynamics 365 (Formerly called as CRM Online) in a single tenant.
  2. Launch your Azure Management Console and Navigate to Active Directory.
  3. main-ad-screen
  4. Register your application in Azure AD
  5. app-type-selectiontell-us-about-your-app
  6. Choose Native Client Application. You can read more about this in Azure Documentation.
  7. Once you've provided the information including Redirect Url. You should see the app dashboard as below
  8. azure-app-dash
  9. You've completed configuration! :)

 

USING CONSOLE APPLICATION TO START YOUR VISUAL STUDIO PROJECT

//Retrieve Authentication Token from Azure obtainauthtoken

You will need to pass your ClientId and RedirectUrl from the azure management console. Step 7 shows the clientID which is hidden. That would 32 digit GUID. Here's the flow how OAUTH works. Read more on this post.

To learn more about recording records in CRM see this post. If you'd like to understand the troubleshooting part with this sample, please read this post.

Hope you've had fun reading this. Happy WebAPI'ng :)

Thanks

Apurv

Comments

  • Anonymous
    December 21, 2016
    The comment has been removed
    • Anonymous
      January 14, 2017
      Is your azure and crm on same Office 365 tenant?
  • Anonymous
    January 07, 2017
    Hi there would you mind letting me know which web host you're working with?I've loaded your blog in 3 completely different browsers and I must say this blog loads a lot quicker then most. Can you suggest a good hosting provider at a reasonable price? Kudos, I appreciate it!
  • Anonymous
    January 08, 2017
    Hello, I believe your website might be having internet browser compatibility issues.When I take a look at your blog in Safari, it looks fine but when opening in I.E., it's got some overlapping issues. I merely wanted to provide you with a quick heads up!Apart from that, fantastic site!