Get-CrmConnection

Applies To: CRM 2016 on-prem, Dynamics 365 (online), Dynamics 365 (on-premises)

Get-CrmConnection

Returns a connection to a Microsoft Dynamics 365 instance.

Syntax

Parameter Set: 
Get-CrmConnection [-ConnectionString <String> ] [ <CommonParameters>]

Parameter Set: ConnectionStringOnly
Get-CrmConnection [-MaxCrmConnectionTimeOutMinutes <Int32> ] [ <CommonParameters>]

Parameter Set: OnLine
Get-CrmConnection [-OnLineType] <CommonAuth+OnlineType> {Office365} [[-Credential] <PSCredential> ] [-DeploymentRegion] <String> -OrganizationName <String> [-LogWriteDirectory <String> ] [-MaxCrmConnectionTimeOutMinutes <Int32> ] [ <CommonParameters>]

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

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




Detailed Description

The Get-CrmConnection cmdlet returns a connection to a Dynamics 365 instance. Upon successful connection to Dynamics 365, it returns an initialized instance of the Microsoft.Xrm.Tooling.CrmServiceClient class.

This cmdlet applies to Microsoft Dynamics 365 (online) and Microsoft Dynamics 365 (on-premises).

Parameters

-ConnectionString<String>

Connection string used to connect to Dynamics 365.

Valid values are:

Server/Url/ServiceUri/Service Uri: URL of the Dynamics 365 server.

UserName/User Name/UserId/User Id: Identifier of the user used to connect to Dynamics 365.

Password: Password for the user.

Domain: Domain name for the user.

HomeRealmUri/Home Realm Uri: Home Realm URL used to access the delegated ADFS instance.

AuthType/AuthenticationType: Authentication type to use to connect with Dynamics 365. Default value is AD. Valid values are: AD, Live, IFD, Claims, Office365, and OAuth.

RequireNewInstance: Default value is true. Use false to reuse an instance from in-memory cache.

ClientId/AppId/ApplicationId: ID of your OAuth client app. This parameter is required when you use the OAuth authentication type.

RedirectUri/ReplyUrl: Reply URL created as part of the client Id registration. This parameter is required when you use the OAuth authentication type.

TokenCacheStorePath: Fully qualified file name to store tokens for reuse. Optional when you use the OAuth authentication type.

LoginPrompt: Allow the OAuth system to present a UI for login information. Default value is Auto. Valid values are Auto, Always, Never, and RefreshSession.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<PSCredential>

User credential for signing in to Microsoft Dynamics 365.


Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-LogWriteDirectory<String>

Custom directory location to store the Xrm.Tooling.Connector log files. The directory must already exist, and the user who is running the cmdlet must have Write permission to the directory. You must also use the -Verbose parameter along with the -LogWriteDirectory parameter to be able to store the log files in a custom location.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-DeploymentRegion<String>

Geographic region of your Microsoft Dynamics 365 online deployment. Valid values are NorthAmerica, EMEA, APAC, SouthAmerica, Oceania, JPN, CAN, IND, 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 Dynamics 365 instance.


Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-MaxCrmConnectionTimeOutMinutes<Int32>

Maximum time in minutes that Xrm.Tooling.Connector will wait for any given Dynamics 365 SDK command to complete.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByValue,ByPropertyName)

Accept Wildcard Characters?

false

-OnLineType<CommonAuth+OnlineType>

Type of online deployment. Valid values 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 Dynamics 365 organization to connect to.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-ServerUrl<Uri>

URL of the Dynamics 365 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: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

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

Creates a connection to an on-premises instance of Microsoft Dynamics 365 using the connection string. On successful connection, it returns an initialized instance of Microsoft.Xrm.Tooling.CrmServiceClient.


PS C:\>Get-CrmConnection –ConnectionString "AuthType=AD;Url=http://mycrmserver/Contoso;Domain=mycrmserverdom;Username=user1;Password=password"

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

Creates a connection to an on-premises instance of Microsoft Dynamics 365. On successful connection, it returns an initialized instance of Microsoft.Xrm.Tooling.CrmServiceClient.


PS C:\>Get-CrmConnection -OrganizationName Contoso -ServerUrl http://mycrmserver -Credential $Cred

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

Creates a connection to an online instance of Microsoft Dynamics 365. On successful connection, it returns an initialized instance of Microsoft.Xrm.Tooling.CrmServiceClient.


PS C:\>Get-CrmConnection -OrganizationName org1 -DeploymentRegion Northamerica -OnLineType Office365 -Credential $Cred 

Related topics

Community Additions

ADD
Show: