Dynamics 365 connection settings

Connection dialog

To connect to Dynamics 365, select an authentication method in the Authentication list and enter the Dynamics 365 sign-in URL in Server.

The following authentication types are available: UserNamePassword (the default), RefreshToken, and RefreshTokenInteractive.

Username and password authentication

For the UserNamePassword authentication type, specify the following parameters:

  • User Id - The Dynamics 365 login account.
  • Password - The password for the Dynamics 365 login account.

OAuth 2.0 authentication

For RefreshToken and RefreshTokenInteractive (OAuth 2.0), the dialog box displays Refresh Token, Client Id, Client Secret, and Sign In. To sign in:

1. Click Sign In.

2. In the window that opens, sign in to your Dynamics 365 account.

3. Review the list of required permissions, select the Consent on behalf of your organization checkbox, and click Accept.

You can also configure Advanced connection options to customize the connection.

Signing in again

If you need to sign in again, for example, because the refresh token is missing or has expired, Devart Excel Add-in for Dynamics 365 automatically opens the sign-in window when testing the connection, such as when you click Test Connection. Sign in to continue. If you cancel, the connection is not established.

Advanced connection options

The following table describes the options that you can include in the Connection String using the Advanced Connection Editor dialog box:

Option Description
Authentication Type Determines the authentication type to use - UserNamePassword or RefreshToken (OAuth 2.0).
Client Id Specifies one of the pair of OAuth 2.0 credentials that you can obtain when you register an OAuth app in your Azure AD tenant.
Client Secret Specifies the second one of the pair of OAuth 2.0 credentials that you can obtain when you register an OAuth app in your Azure AD tenant.
Connection Lifetime Specifies the time span (in seconds), compared against a connection’s creation time when it is returned to the pool; the connection is destroyed if this span is exceeded. The default value is 0 (connection always returns to pool).
Connection Timeout Specifies the length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. The default value is 60.
Default Command Timeout Specifies the time in seconds to wait while trying to execute a command before terminating the attempt and generating an error.
Failover Retries Specifies the number of retry attempts to automatically re-run a command before displaying an error message in case when the command failed because of an error that may be temporary.
Initialization Command Specifies a command to execute after establishing the connection.
Local SQL Engine Determines whether to use local SQL engine for SELECT queries, that are too complex to translate them directly to Dynamics 365 API calls or to show an error message.
Max Pool Size Specifies the maximum number of connections allowed in the pool. Setting the Max Pool Size value in the connection string can affect performance. The default value is 100.
Min Pool Size Specifies the minimum number of connections allowed in the pool. The default value is 0.
NormalizeDbNames Determines whether database object names are normalized when retrieved from the database.
Password Specifies the password for the account.
Persist Security Info Indicates if security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.
Pooling Draws the connection from the appropriate pool, or creates and adds it to the appropriate pool, when set to true. This is the default behavior.
Proxy Host Specifies the host name or IP address of the proxy server.
Proxy Password Specifies the password for the proxy server account.
Proxy Port Specifies the port number of the proxy server. The default value is 3128.
Proxy User Specifies the proxy server account name.
Readonly Indicates whether the connection is read-only (allows only SELECT statements).
Refresh Token Specifies the OAuth 2.0 refresh token for Dynamics 365. Obtained automatically when you click Sign In.
Run Once Command Specifies a command to execute after establishing the connection. Unlike Initialization Command, it is not executed for connections obtained from the connection pool.
Server Specifies the login URL to Dynamics 365 service.
Token Server Specifies the path to a file to store the refresh token between sessions. Used for RefreshToken authentication. This parameter is specified automatically when performing web login, and in most cases there is no need to modify it. If you want, you may specify a custom path to use instead of the default one.
User ID Specifies the Dynamics login account.
UTC Dates Converts dates to UTC format during import when set to True; the date values entered in Excel are then considered UTC dates when saving them to the data source.