I would like to connect to CRM 2016 server using PowerShell cmdlet Get-CrmConnection
included in the SDK.
I am having trouble finding the correct connection string.
Connecting to the server in in the local network works normally:
Get-CrmConnection -ConnectionString "Url=http://<server>/OrganizationName;"
But connecting to the server configured for IFD fails:
Get-CrmConnection -ConnectionString "Url=https://crm.ourdomain.com/"
Get-CrmConnection : Organization cannot be null or empty.
Parameter name: Organization Name
At line:1 char:1
+ Get-CrmConnection -ConnectionString "Url=https://crm.ourdomain.com/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SyntaxError: (:) [Get-CrmConnection], ArgumentNullException
+ FullyQualifiedErrorId : -9,Microsoft.Xrm.Tooling.CrmConnector.Powershell.Commands.GetCrmConnectionCommand
I tried adding AuthType parameter in the connection string, providing Organization name, but no success. Important thing is that I can connect using the interactive mode:
Get-CrmConnection -InteractiveMode
This returns the following connection:
IsReady : True
IsBatchOperationsAvailable : True
Authority :
OAuthUserId :
ActiveAuthenticationType : AD
OrganizationServiceProxy : Microsoft.Xrm.Tooling.Connector.CrmWebSvc+ManagedTokenOrganizationServiceProxy
OrganizationWebProxyClient :
LastCrmError : OrganizationWebProxyClient is null
LastCrmException :
CrmConnectOrgUriActual : https://crm.ourdomain.com/XRMServices/2011/Organization.svc
ConnectedOrgFriendlyName : OrganizationName
ConnectedOrgUniqueName : OrganizationName
ConnectedOrgPublishedEndpoints : {[WebApplication, https://crm.ourdomain.com/], [OrganizationService,
https://crm.ourdomain.com/XRMServices/2011/Organization.svc],
[OrganizationDataService,
https://crm.ourdomain.com/XRMServices/2011/OrganizationData.svc]}
ConnectionLockObject : System.Object
ConnectedOrgVersion : 8.0.1.79
There are some big gotchas with the
microsoft.xrm.tooling.connector
CrmConnection
that can have you banging your head against the wall.To quote from http://crmtipoftheday.com/2016/01/14/rumors-about-microsoft-xrm-client-death-are-exaggerated/
The following works for me
so does the slightly modified username as UPN