Establishing a Connection
Enabling SSIS in Visual Studio 2022
If you're using Visual Studio 2022, you will need to install the SQL Server Integration Services Projects extension to use SSIS.
- Navigate to Extensions > Manage Extensions.
- In the Manage Extensions window's search box, search for "SQL Server Integration Services Projects 2022" and select the extension in the list.
- Click Download.
- Close Visual Studio and run the downloaded Microsoft.DataTools.IntegrationServices.exe installer. Proceed through the installer with default settings.
- Open Visual Studio. There should now be an "Integration Services Project" project template available.
Adding the Microsoft Dynamics 365 Connection Manager
Create a new connection manager as follows:
- Create a Visual Studio project with the "Integration Services Project" template.
- In the project, right-click within the Connection Managers window and select New Connection from the menu.
- In the Description column, select CData Microsoft Dynamics 365 Connection Manager and click Add...
- Configure the component as described in the next section.
Alternatively, if you have an existing project and CData Microsoft Dynamics 365 Source or CData Microsoft Dynamics 365 Destination:
- Right-click your CData Microsoft Dynamics 365 source or destination component in your data flow
- Select Edit... to open an editor window.
- Click the New... button next to the Connection manager: dropdown selector to create a connection manager.
- Configure the component as described in the next section.
Connecting to Microsoft Dynamics 365
The Microsoft Dynamics 365 driver supports connecting to the following Microsoft Dynamics 365 editions:
- CustomerService
- FieldService
- FinOpsOnline (Default)
- FinOpsOnPremise
- HumanResources
- Marketing
- ProjectOperations
- Sales
Notes:
- Supply Chain Management is the same as Finance and Operations. To connect to either of these, set Edition to either FinOpsOnline or FinOpsOnPremise.
- For Microsoft Dynamics 365 Business Central, use the separate Microsoft Dynamics 365 Business Central driver.
To connect, set these parameters:
- RSBDynamics365_p_OrganizationURL: The URL to your Microsoft Dynamics 365 organization; for example, https://orgcb42e1d0.crm.dynamics.com.
- Edition: As shown in the list of editions above.
Authenticating to Microsoft Dynamics 365
Microsoft Dynamics 365 supports authentication via Azure AD, Azure Service Principal, or Azure Managed Service Identity (MSI). All of these are based on the OAuth standard.
Azure AD
Authenticating via Azure AD requires you to create a custom AzureAD application, as described in Creating an Azure AD Application. You can authenticate with either a client secret or a JWT certificate.To connect, set these properties:
- AuthScheme: AzureAD.
- InitiateOAuth: GETANDREFRESH. This setting enables you to use InitiateOAuth to avoid repeating the AzureAD exchange and manually setting the OAuthAccessToken.
- AzureTenant: The Azure tenant to which you will connect.
- OAuthClientId: The Client Id assigned when you created your custom application.
- OAuthClientSecret (Client Secret only): The Client Secret assigned when you created your custom application.
- OAuthJWTCert (Certificate only): The JWT Certificate store.
- OAuthJWTCertType (Certificate only): The type of the certificate store specified by OAuthJWTCert.
Admin Consent
Admin consent refers to permissions granted by an Azure AD Tenant's admin to a custom application, as required for the use case. (Since the embedded application within the CData SSIS Components for Microsoft Dynamics 365 contains no permissions that require Admin consent, admin consent only applies to custom applications.)If your organization requires admin consent for authorizing any new OAuth application for your Azure Tenant, it means that the first time someone in your organization installs and uses an OAuth application, an administrator for the organization must explicitly grant that application access.
(Your organization can choose to disable this requirement.)
Granting Admin Consent
When creating a new OAuth application in the Azure Portal (see Creating an Azure AD Application), you must specify which permissions the application requires. If you know that your organization requires admin consent for new custom applications, you can start by specifying permissions that are already labeled Admin Consent Required. (For example, all Groups permissions require admin consent.)
There are two ways to grant admin consent:
- The easiest way to grant admin consent is to just have an admin log into portal.azure.com and navigate to the application you have created in App Registrations. Under API Permissions, click Grant Consent. This grants your application the necessary permissions on the tenant on which it was created.
- If your organization has multiple tenants or the application needs to be granted permissions for other tenants outside your organization, you can use the GetAdminConsentURL to generate the Admin Authorization URL. Unlike the GetOAuthAuthorizationUrl, there is no important information returned from this endpoint. If the tenant grants access, it returns a Boolean confirming that permissions were granted.
After an admin grants consent, authentication is performed as usual.
Client Credentials Auth Flow
Client credentials refers to a flow in OAuth where there is no direct user authentication taking place. Instead, credentials are created for just the application itself. All tasks taken by the application are done without a default user context. This makes the authentication flow a bit different from standard.All permissions related to the client OAuth flow require admin consent. This means the application embedded with the CData SSIS Components for Microsoft Dynamics 365 cannot be used in the client OAuth flow. You must create your own OAuth application to use client credentials, as described in Creating an Azure AD Application.
To do this:
- Login to portal.azure.com.
- Navigate to App Registration > API Permissions.
- Select the Microsoft Graph permissions. There are two distinct sets of permissions: Delegated Permissions and Application permissions. The permissions used during client credential authentication are under Application Permissions. Select the applicable permissions you require for your integration.
To connect, set these properties:
- InitiateOAuth: GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- AzureTenant: The tenant to which you will connect.
- OAuthClientId: The Client Id assigned when you created your custom application.
- OAuthClientSecret (Client Secret only): The Client Secret assigned when you created your custom application.
- OAuthJWTCert (Certificate only): The JWT Certificate store.
- OAuthJWTCertType (Certificate only): The type of the certificate store specified by OAuthJWTCert.
Azure Service Principal
Actions in Azure AD can be run by either user accounts or service principals. A service principal is a non-interactive account with elevated permissions, that performs tasks based on the roles and permissions assigned. Authentication as an Azure Service Principal is handled via the OAuth Client Credentials flow, without user involvementy Authentication as an Azure Service Principal requires you to create a custom AzureAD Service Principal application, as described in Creating a Custom AzureAD Service Principal App.When you are ready to connect, set these properties:
- AuthScheme: AzureServicePrincipal for using a Client Secret or AzureServicePrincipalCert for using a JWT certificate.
- InitiateOAuth: GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- AzureTenant: The tenant you want to connect to.
- OAuthClientId (Client Secret only): The Client Id in your application settings.
- OAuthClientSecret (Client Secret only): The Client Secret assigned when you created your custom application.
- OAuthJWTCert (Certificate only): The JWT Certificate store.
- OAuthJWTCertType (Certificate only): The type of the certificate store specified by OAuthJWTCert.
Managed Service Identity (MSI)
If you are running Microsoft Dynamics 365 on an Azure VM and want to automatically obtain Managed Service Identity (MSI) credentials to connect, set AuthScheme to AzureMSI.
User-Managed Identities
To obtain a token for a managed identity, use the OAuthClientId property to specify the managed identity's client_id.If your VM has multiple user-assigned managed identities, you must also specify OAuthClientId.