We have a crm online instance and have some task scheduler jobs that connects using the crm using the tooling connection string.
We are changing the application users from an online user (username@orgname.onmicrosoft.com) to an AD user (username@domain.com) but we are receiving error messages when we try the new user in the connection string.
I tried changing the AuthType attribute of the connection string but keep getting errors.
The current connection string is:
Url=https://orgname.crm4.dynamics.com; Username= username@orgname.onmicrosoft.com; Password=pass; ClientId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX; AuthType=OAuth; RedirectUri=http://localhost:55162/;
After changing the connection string to:
Url=https://orgname.crm4.dynamics.com; Username= username@domain.com; Password=pass; ClientId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX; AuthType=OAuth; RedirectUri=http://localhost:55162/;
The OrganizationWebProxyClient attribute is null and in the LastCrmError we are getting:
ERROR REQUESTING Token FROM THE Authentication context - General ADAL Error
parsing_ws_metadata_exchange_failed: Parsing WS metadata exchange failed => The ';' character, hexadecimal value 0x3B, cannot be included in a name. Line 14, position 223.Unable to connect to CRM: The ';' character, hexadecimal value 0x3B, cannot be included in a name. Line 14, position 223.
Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
When I change the AuthType to Office365 I'm getting the error:
Unable to connect to CRM: CData elements not valid at top level of an XML document. Line 1, position 3.
Metadata contains a reference that cannot be resolved: 'adfs.domain.com/.../mex'. => CData elements not valid at top level of an XML document. Line 1, position 3.Unable to Login to Dynamics CRM
Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
And when I change the AuthType to AD I'm getting the error:
Unable to login to Dynamics CRM, Error was :
Data[0 = "The provided uri did not return any Service Endpoints!
{0}"
Data[1 = ""
Data[0 = "The provided uri did not return any Service Endpoints!
{0}"
Data[1 = ""Unable to Login to Dynamics CRM
Unable to Login to Dynamics CRMOrganizationWebProxyClient is null
The new user name and password are correct since I'm able to login to the crm using the browser without any issue.
Thanks in advanced for the help
Hey!
I think there are a few things here.
1. O365 Authentication is deprecated. Most connection tools have updated versions, and you should download the latest package, so the new classes are in place.
2. on OAuth, I'm not sure you should use ClientID but AppId. On this documentation Use Office365 authentication with Microsoft Dataverse (Microsoft Dataverse) - Power Apps | Microsoft Docs the example is:
connectionString = "AuthType=OAuth;Username=jsmith@contoso.onmicrosoft.com; Password=passcode;Url=contosotest.crm.dynamics.com;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d; RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Auto".
3. Please also ensure that the "RedirectUri" value is correct and you can reach it from internet (should not be "localhost:port" but the app where you want to login.
Regards
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156