Query CDS/CRM Online Data using SQL Query in SSIS

20 November 2020
Chen Huang

[UPDATE - June 19, 2024] We have updated this blog post to use the recently released Premium SQL Server components that were made available in our SSIS Productivity Pack v24.1 release. The newly introduced Premium SQL Server features enable connection to modern SQL Server authentications which include Dynamics 365 TDS endpoints. [/UPDATE - June 19, 2024]

FetchXML is a proprietary query language that is used to retrieve data from a CDS/CRM instance. However, FetchXML query is not as flexible nor extensive as an SQL query and has its own restrictions, which we discussed in a previous blog post (Limitations with CRM FetchXML). Considering these limitations, most users prefer to read CDS/CRM data by connecting to the CDS/CRM database directly, where they can build the query with their most familiar query language – SQL query, and easily fetch data with complex joins. But when it comes to CRM Online and CDS environments, the database accessibility is no longer available requiring users to either use FetchXML query or build the OData query through a WebAPI connection to be able to work with the CDS/CRM Online data. Microsoft has introduced the read-only SQL data connection for CDS/CRM Online. Further details about this feature can be found on the corresponding Microsoft documentation page.

In this blog post, we will demonstrate how to connect to the CDS/CRM Online application through the SQL Server Connection Manager and query data using the Premium SQL Server Source component, a part of our SSIS Productivity Pack.

Enabling TDS Endpoint Feature

To enable the TDS endpoint, you must sign in to the Power Platform Admin center, then head to Environments > [select an environment] > Settings > Product > Features.

Make sure you have the System Administrator or System Customizer security role or equivalent permissions to enable the TDS endpoint.

Enable TDS Endpoint in Power Platform Admin center

Configuring the SQL Server Connection Manager

The SQL data connection becomes available once the TDS endpoint is enabled. You can now configure the SQL Server Connection Manager offered in our Productivity Pack to establish the database connection to the CDS/CRM Online instance.

SQL Server Connection Manager is offered in our 2024 Wave 1 release, it offers support of 10 authentication modes:

  • SQL Server Authentication
  • Windows Integrated Authentication
  • OAuth - Authorization Code
  • OAuth - Client Credentials
  • OAuth - Client Credentials Certificate
  • Azure Active Directory - Password
  • Azure Active Directory - Universal with MFA
  • Azure Active Directory - Service Principal
  • Azure Active Directory - Managed Identity
  • Azure Active Directory - Default

The screenshot below shows an example of the SQL Server Connection Manager configuration. The server name is the organization address URL followed by a comma and the port value of 5558.

Configure SQL Server Connection Manager in SSIS

Note the database discovery is not supported at this moment, so you need to manually specify the database name, which is the CDS/CRM organization name in this case.

Querying Data Using Premium SQL Server Source Component

Once the Server SQL Connection Manager is configured, you can now query CDS/CRM data easily using Premium SQL Server Source component. With the use of SQL query, you can retrieve data from your Dynamics application with ease, which can be more efficient than using FetchXML query, and it is more intuitive to work with Dynamics application data as the source of your integration.

Premium Premium SQL Server Source Component

Closing Note

When faced with limitations of FetchXML, developers can query CDS/CRM Online data using SQL query instead, thus providing much better performance and more flexibility to perform filtering and join entity actions.

 FetchXML   SQL   SQL2FetchXML   SSIS 

Archive

November 2024 3 October 2024 1 September 2024 1 August 2024 2 July 2024 1 June 2024 1 May 2024 1 April 2024 2 March 2024 2 February 2024 2 January 2024 2 December 2023 1 November 2023 1 October 2023 2 August 2023 1 July 2023 2 June 2023 1 May 2023 2 April 2023 1 March 2023 1 February 2023 1 January 2023 2 December 2022 1 November 2022 2 October 2022 2 September 2022 2 August 2022 2 July 2022 3 June 2022 2 May 2022 2 April 2022 3 March 2022 2 February 2022 1 January 2022 2 December 2021 1 October 2021 1 September 2021 2 August 2021 2 July 2021 2 June 2021 1 May 2021 1 April 2021 2 March 2021 2 February 2021 2 January 2021 2 December 2020 2 November 2020 4 October 2020 1 September 2020 3 August 2020 2 July 2020 1 June 2020 2 May 2020 1 April 2020 1 March 2020 1 February 2020 1 January 2020 1 December 2019 1 November 2019 1 October 2019 1 May 2019 1 February 2019 1 December 2018 2 November 2018 1 October 2018 4 September 2018 1 August 2018 1 July 2018 1 June 2018 3 April 2018 3 March 2018 3 February 2018 3 January 2018 2 December 2017 1 April 2017 1 March 2017 7 December 2016 1 November 2016 2 October 2016 1 September 2016 4 August 2016 1 June 2016 1 May 2016 3 April 2016 1 August 2015 1 April 2015 10 August 2014 1 July 2014 1 June 2014 2 May 2014 2 February 2014 1 January 2014 2 October 2013 1 September 2013 2 August 2013 2 June 2013 5 May 2013 2 March 2013 1 February 2013 1 January 2013 1 December 2012 2 November 2012 2 September 2012 2 July 2012 1 May 2012 3 April 2012 2 March 2012 2 January 2012 1

Tags