daryllabar / DLaB.Xrm.XrmToolBoxTools

Plugins for the XrmToolBox
MIT License
78 stars 70 forks source link

Connection issue with enforced 2FA #351

Closed arp-mbender closed 1 year ago

arp-mbender commented 1 year ago

Tool and Version What tool/version is it that you're reporting a bug for? i.e. EarlyBoundGenerator V 1.2022.9.22

Describe the bug Tool cannot seem to connect to CRM (despite proper connection in XrmToolbox).

Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : Unable to connect to CRM: Response status code does not indicate success: 400 (BadRequest).
Source  : Microsoft.IdentityModel.Clients.ActiveDirectory
Method  : MoveNext
Date    : 10.03.2023
Time    : 10:59:02
Error   : AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '00000007-0000-0000-c000-000000000000'.
Trace ID: 17fccb0b-1664-46df-84a3-c0130ff87200
Correlation ID: ead20a34-e58c-4f36-b931-0ea09678f6ff
Timestamp: 2023-03-10 09:59:02Z
Stack Trace : at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.ProcessAdalExecption(Uri serviceUrl, ClientCredentials clientCredentials, X509Certificate2 userCert, UserIdentifier& user, String clientId, Uri redirectUri, PromptBehavior promptBehavior, String tokenCachePath, Boolean isOnPrem, String authority, Uri& targetServiceUrl, AuthenticationContext& authContext, String& resource, CrmLogEntry logSink, Boolean useDefaultCreds, String& authToken, AdalException adalEx)
   at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.ExecuteAuthenticateServiceProcess(Uri serviceUrl, ClientCredentials clientCredentials, X509Certificate2 userCert, UserIdentifier user, String clientId, Uri redirectUri, PromptBehavior promptBehavior, String tokenCachePath, Boolean isOnPrem, String authority, Uri& targetServiceUrl, AuthenticationContext& authContext, String& resource, UserIdentifier& userIdent, CrmLogEntry logSink, Boolean useDefaultCreds, SecureString clientSecret)
   at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.ConnectAndInitCrmOrgService(OrganizationDetail orgdata, Boolean IsOnPrem, Uri homeRealmUri)
   at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.DoDirectLogin(Boolean IsOnPrem)
   at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.InitCRM2011Service()
======================================================================================================================
Inner Exception Level 1 : 
Source  : Not Provided
Method  : Not Provided
Date    : 10.03.2023
Time    : 10:59:02
Error   : Response status code does not indicate success: 400 (BadRequest).
Stack Trace : Not Provided
======================================================================================================================
Inner Exception Level 2 : 
Source  : Not Provided
Method  : Not Provided
Date    : 10.03.2023
Time    : 10:59:02
Error   : {"error":"interaction_required","error_description":"AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '00000007-0000-0000-c000-000000000000'.\r\nTrace ID: 17fccb0b-1664-46df-84a3-c0130ff87200\r\nCorrelation ID: ead20a34-e58c-4f36-b931-0ea09678f6ff\r\nTimestamp: 2023-03-10 09:59:02Z","error_codes":[50076],"timestamp":"2023-03-10 09:59:02Z","trace_id":"17fccb0b-1664-46df-84a3-c0130ff87200","correlation_id":"ead20a34-e58c-4f36-b931-0ea09678f6ff","error_uri":"https://login.microsoftonline.com/error?code=50076","suberror":"basic_action"}: Unknown error
Stack Trace : Not Provided
======================================================================================================================

To Reproduce Steps to reproduce the behavior: Likely due to enforced 2FA from customer IT.

Expected behavior Tool should use 2FA if needed to authenticate and then re-attempt to generate entities / option sets / actions.

Additional context It's worth noting that a standard MS Dynamics Deployment Tool login window does show up, prompting user-name and password and running the 2FA process. However, even if this is completed successfully then a blank console window is opened and the early-bound classes are never actually created.

arp-mbender commented 1 year ago

Never mind - seemed to be some kind of slowness on part of MSCRM. While the initial set of errors does appear (and is rather annoying) it's not blocker as I initially thought.