Please wait, loading...

 

Dynamics CRM V9 / D365 Connection through Console without Prompt

January 16, 2018
There are 2 major steps involved in the process.
  • Register the application with your Azure subscription
  • Build the Console Application
Register the application with your Azure subscription

Build the Console Application 
You need to change only the below authentication method in step 3 rest remains same

Pass user credentials with service URL and client id in Authentication Context

string authority = "https://login.microsoftonline.com/68e86d2-65ed-4666-8ee-f8ce245d20de/oauth2/authorize";
AuthenticationContext authContext = new AuthenticationContext(authority, false);
var credentials = new UserCredential("shashank@s.onmicrosoft.com", "pas@wrd1");
//without prompt
AuthenticationResult authResult = authContext.AcquireToken(serviceUrl, clientId, credentials);
authHeader = new AuthenticationHeaderValue("Bearer", authResult.AccessToken);

You can have a look at my code here :Sample Code

Happy Coding and CRMing 😊


SOURCE : mscrm.com

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/Microsoftdynamics365.png?fit=640%2C651&ssl=1
Microsoft Dynamics Community Profile

Learn more