Partager via


Get-CrmConnection

Applies To: CRM 2015 on-prem

Get-CrmConnection

Returns a connection to a Microsoft Dynamics CRM instance.

Syntax

Parameter Set: OnLine
Get-CrmConnection [-OnLineType] <OnlineType> [[-Credential] <PSCredential> ] [-DeploymentRegion] <String> [[-ProfileName] <String> ] -OrganizationName <String> [ <CommonParameters>]

Parameter Set: OnPrem
Get-CrmConnection [-ServerUrl] <Uri> [[-Credential] <PSCredential> ] [-OrganizationName] <String> [[-HomeRealmUrl] <Uri> ] [[-ProfileName] <String> ] [ <CommonParameters>]

Parameter Set: UIOnly
Get-CrmConnection [[-InteractiveMode]] [ <CommonParameters>]

Detailed 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.

Aliases

none

Required?

false

Position?

2

Default Value

none

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, and NorthAmerica2.

Aliases

none

Required?

true

Position?

5

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-HomeRealmUrl<Uri>

URI of the WS-Trust metadata endpoint.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-InteractiveMode

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

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-OnLineType<OnlineType>

Type of online deployment. Valid values are Office365 and LiveID. Default is Office365.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-OrganizationName<String>

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

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-ProfileName<String>

For internal use only.

Aliases

none

Required?

false

Position?

6

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-ServerUrl<Uri>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Xrm.Tooling.CrmServiceClient

Examples

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

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.

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

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

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.

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

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

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.

PS C:\>$CRMConn = Get-CrmConnection -Credential $Cred -DeploymentRegion NorthAmerica –OnlineType Office365 –OrganizationName <OrgName>

Get-CrmOrganizations

Use PowerShell cmdlets for XRM tooling to connect to CRM

Blog: PowerShell module for performing data operations and manipulating user and system settings in CRM