Connecting MFA enabled Dynamics 365 V9x by Xrmtooling. Error in connecting : Unable to Login to Dynamics CRMOrganizationServiceProxy is null


I was trying to connect my mfa enabled CRM to my console App but was unable to do so after doing lot of search got many connection ways like by ClientID client Secret blabla….

but they use Rest Apis and our Iorganization service code which is used in plugin cannot be used that way so finally got the solution for connecting it 

To Connect MFA Enabled Dynamics CRM with C# you just need to use App Password instead of your Password remaining every thing remains same as it was

                string connectionString = GetServiceConfigurationfromAppCOnfig();

               ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

               CrmServiceClient conn = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString);                

               _orgService = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

               WhoAmIResponse whoAmIResponse = (WhoAmIResponse)_orgService.Execute(new WhoAmIRequest());

  Follow the below Steps to generate App password 

1 login to and Open My Account


2 Then go to  Security info


4 Then Add Method


5 Then Choose  App Password and Create one Give it a Name


6  Copy The Password  generated and keep it safe 


Source link

Latest articles

Related articles

Leave a reply

Please enter your comment!
Please enter your name here