Get-CrmConnection

Get-CrmConnection

Returns a connection to a 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 instance. Upon successful connection to , it returns an initialized instance of the Microsoft.Xrm.Tooling.CrmServiceClient class.

Parameters

-Credential<PSCredential>

User credential for signing in to .

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 online deployment. Valid values are NorthAmerica, EMEA, and APAC.

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 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 organization to connect to.

Aliases

none

Required?

true

Position?

3

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 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 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 . 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 () instance of . 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