< Back

Get-CrmConnection

Mon Jan 13, 2020 6:49 am

NAME Get-CrmConnection



SYNOPSIS

Returns a connection to a Microsoft Dynamics CRM instance.





SYNTAX

Get-CrmConnection [-ConnectionString <string>] [-ServerUrl] <Uri> [[-Credential] <PSCredential>]

[-OrganizationName] <String> [[-HomeRealmUrl] <Uri>] [[-ProfileName] <String>] [<CommonParameters>]



Get-CrmConnection [[-Credential] <PSCredential>] [-OnLineType] <OnlineType> [-DeploymentRegion] <String>

[[-ProfileName] <String>] -OrganizationName <String> [<CommonParameters>]



Get-CrmConnection [[-InteractiveMode]] [<CommonParameters>]





DESCRIPTION

The Get-CrmConnection cmdlet returns a connection to a CRM instance. Upon successful connection to CRM, it returns

an initialized instance of the Microsoft.Xrm.Tooling.CrmServiceClient class.



This cmdlet applies to Microsoft Dynamics CRM Online and on-premises versions of Microsoft Dynamics CRM.





PARAMETERS

-Credential <PSCredential>

User credential for signing in to Microsoft Dynamics CRM.



Required? false

Position? 2

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-DeploymentRegion <String>

Geographic region of your Microsoft Dynamics CRM online deployment. Valid values are NorthAmerica, EMEA, APAC,

SouthAmerica, Oceania, JPN, CAN, IND, or NorthAmerica2.



Required? true

Position? 5

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-HomeRealmUrl <Uri>

URI of the WS-Trust metadata endpoint.



Required? false

Position? 4

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-InteractiveMode [<SwitchParameter>]

Enables you to use the common sign-in control dialog box to specify credentials for connecting to a CRM

instance.



Required? false

Position? 1

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-OnLineType <OnlineType>

Type of online deployment. Valid value is Office365.



Required? true

Position? 2

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-OrganizationName <String>

Unique or friendly name of the CRM organization to connect to.



Required? true

Position? named

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-ProfileName <String>

For internal use only.



Required? false

Position? 6

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-ConnectionString <string>

Connection string used to connect to CRM. Valid parameters are:



Server/Url/ServiceUri/Service Uri: URL to the Microsoft Dynamics CRM server.



UserName/User Name/UserId/User Id: User name to connect to the CRM server.



Password: Password for the specified user name.



Domain: Domain name for the specified user name.



HomeRealmUri/Home Realm Uri: Home Realm Url to access the delegated AD FS instance.



AuthType/AuthenticationType: Authentication type to use. Default is AD. Valid values are: AD, IFD, Office365,

or OAuth.



RequireNewInstance: Specifies whether to force the creation of a new instance when the connection is created.

Possible values are true or false. Default is true.



CientId/AppId/ApplicationId: Specifies the ClientID assigned when you registered your application in Microsoft

Azure Active Directory or Active Directory Federation Services (AD FS). This is applicable for OAuth

authentication type.



RedirectUri/ReplyUrl: Specifies the redirect URI of the application you registered in Microsoft Azure Active

Directory or Active Directory Federation Services (AD FS). This is applicable for OAuth authentication type.



TokenCacheStorePath: (Optional). Specifies the full path to the location where the user token cache should be

stored. This is applicable for OAuth authentication type.



LoginPrompt = Specifies whether the user is prompted for credentials if the credentials are not supplied.

Default is Auto.

Valid values are: Auto, Always, or Never.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ServerUrl <Uri>

URL of the CRM discovery server specified in the following format: http://<server>:<port>



Required? true

Position? 1

Default value

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS









OUTPUTS

Microsoft.Xrm.Tooling.CrmServiceClient







-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$CRMConn = Get-CrmConnection -InteractiveMode



This example shows how to connect to an instance of CRM using the common sign-in control dialog box. The

connection information is stored in the $CRMConn variable that you can use later.

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$CRMConn = Get-CrmConnection ????????ServerUrl http://<CRM_Server_Host> -Credential $Cred -OrganizationName

<OrgName>



This example shows how to connect to an on-premises instance of CRM. The connection information is stored in the

$CRMConn variable that you can use later.

-------------------------- EXAMPLE 3 --------------------------



PS C:\\>$CRMConn = Get-CrmConnection -Credential $Cred -DeploymentRegion NorthAmerica ????????OnlineType Office365

????????OrganizationName <OrgName>



This example shows how to connect to an online (Office 365) instance of CRM. The connection information is stored

in the $CRMConn variable that you can use later.



RELATED LINKS

Online version: https://technet.microsoft.com/library/dn756303.aspx