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 :
- Using Azure Management Console
- Json Serialize using Newtonsoft
- Basic understanding of HttpClient and WebAPI in general
- ADAL (Azure Active Directory Authentication Library)
CONFIGURE YOUR APPLICATION USING AZURE MANAGEMENT CONSOLE:
- Sign-up for Azure Trial/Office 365/Dynamics 365 (Formerly called as CRM Online) in a single tenant.
- Launch your Azure Management Console and Navigate to Active Directory.
- Register your application in Azure AD
- Choose Native Client Application. You can read more about this in Azure Documentation.
- Once you've provided the information including Redirect Url. You should see the app dashboard as below
- You've completed configuration! :)
USING CONSOLE APPLICATION TO START YOUR VISUAL STUDIO PROJECT
//Retrieve Authentication Token from Azure
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
- 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!