I'm trying to execute Get-CrmConnection
to connect to Dynamics 365 from Powershell, but the command returns the following when executed from a non-administrative Powershell context:
Get-CrmConnection -ConnectionString "AuthType=Office365;Username=xxx;Password=xxx;Url=https://xxx.crm.dynamics.com"
Get-CrmConnection : Failed to connect to CRM: Unable to Login to Dynamics CRM
At line:1 char:1
+ Get-CrmConnection -ConnectionString "AuthType=Office365;Username=crm_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Get-CrmConnection], Exception
+ FullyQualifiedErrorId : -10,Microsoft.Xrm.Tooling.CrmConnector.Powershell.Commands.GetCrmConnectionCommand
I have version 3.3.0.857 of the connector installed.
Additional Info
If I execute the same command within the context of an Administrator prompt, I'm able to connect without issue.
I need this command to work outside of an Administrator context because this script will be called as part of an Azure DevOps pipeline. When executing this code within the pipeline, hosted in Azure DevOps, the same issue occurs.