{"id":94384,"date":"2022-05-24T16:00:30","date_gmt":"2022-05-24T16:00:30","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=94384"},"modified":"2022-05-20T19:51:44","modified_gmt":"2022-05-20T19:51:44","slug":"azure-synapse-link-for-sql-from-production-to-a-data-warehouse-in-a-few-clicks","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/azure-synapse-link-for-sql-from-production-to-a-data-warehouse-in-a-few-clicks\/","title":{"rendered":"Azure Synapse Link for SQL: From production to a data warehouse in a few clicks"},"content":{"rendered":"<p>The <strong>Link<\/strong> technology in <strong>Synapse<\/strong> is used to synchronize data from different data sources to <strong>Synapse Analytics<\/strong>. <strong>Synapse Link for CosmoDB<\/strong> and <strong>Synapse Link for Dataverse<\/strong> were already released. Now it\u2019s time for a new and very important one: <strong>Azure Synapse Link for SQL<\/strong>.<\/p>\n<p>The <strong>Azure Synapse Link for SQL<\/strong> can be used with <strong>Azure SQL Database<\/strong> and <strong>SQL Server 2022<\/strong> to synchronize tables using <strong>these databases as sources and a Synapse Dedicated Pool as a destination.<\/strong><\/p>\n<p><strong>When using Synapse Link<\/strong>, you are not really creating a <strong>Data Warehouse<\/strong>, but you are executing a big step in this direction.<\/p>\n<p>The process between production and the <strong>Data Warehouse<\/strong> is called <strong>ETL<\/strong> \u2013 <strong>E<\/strong>xtract, <strong>T<\/strong>ransform and <strong>L<\/strong>oad. You must execute these three steps: <strong>E<\/strong>xtract from production, <strong>T<\/strong>ransform the extracted data for the data warehouse structure, and <strong>L<\/strong>oad the data into the data warehouse.<\/p>\n<p>Sometimes these steps can be executed in a different sequence and many times it\u2019s more complex with even more steps. The steps can also be expressed as an <strong>ELT<\/strong> process, Extract, Load and Transform. As you may notice, the difference is the sequence of the steps. In this case, you first load the data, and, after that, you transform the data.<\/p>\n<p>The Load process is usually done to a staging area, where you will execute the transformation of the data to the format required by a data warehouse.<\/p>\n<p><strong>Synapse Link<\/strong> doesn\u2019t execute any transformation on the data. It extracts the data from the source and loads it into the destination. In summary, using <strong>Synapse Link, <\/strong>you create a staging environment using very simple steps to transfer the data.<\/p>\n<p>The staging environment is important because it reduces the workload over the production environment. If you transform the data before loading, the production environment would be affected by the transformation workload. On the other hand, loading the data to a staging environment and leaving the transformation for later, the transformation workload will be executed over the staging environment.<\/p>\n<p>Another benefit of this staging environment is the possibility to use this environment for reporting, instead of run reports over production. In some cases, you may would like to use <strong>Synapse Link<\/strong> specially for that, even if you are not planning the further transformations into a data warehouse yet.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1136\" height=\"647\" class=\"wp-image-94385\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/diagram-description-automatically-generated-4.png\" alt=\"Diagram\n\nDescription automatically generated\" \/><\/p>\n<p>Besides relieving the production environment from the transformation workload, the staging environment can also help in scenarios with multiple data sources with similar structures. For example, imagine a company with a main office and many different branches. Each branch has its own database, but the data stored has the same schema, for the same business.<\/p>\n<p>In this scenario, <strong>Azure Synapse Link for SQL<\/strong> can be used to synchronize the data from all the branches to a centralized staging environment. This becomes an additional benefit of <strong>Azure Synapse Link for SQL<\/strong> and the staging area it can easily create.<\/p>\n<h2>Azure Synapse Link for SQL basic elements<\/h2>\n<p>The structure of <strong>Azure Synapse Link for SQL<\/strong> uses two key elements which are always present in the different scenarios where you can implement it.<\/p>\n<p><strong>Change Feed:<\/strong> The change feed is a new feature included in <strong>Azure SQL Database<\/strong> and <strong>SQL Server 2022<\/strong> to provide support to <strong>Azure Synapse Link for SQL<\/strong>. You may already know <strong>SQL Server <\/strong>has two different features to allow the control of changes in a production environment: the <strong>Change Data Capture<\/strong>, also known as <strong>CDC<\/strong> and <strong>Change Tracking<\/strong>. However, Microsoft decided to implement a third method to ensure the workload over the production environment would be as light as possible. This is the purpose of the <strong>Change Feed<\/strong>.<\/p>\n<p><strong>Integration Runtime<\/strong>: The <strong>IR<\/strong> is the same one used for pipeline execution. The <strong>IR<\/strong> is responsible for the start\/stop operations on the source database. It can be used as an <strong>autoresolved IR<\/strong> or a <strong>self-hosted IR<\/strong>, according to the scenario which will be implemented.<\/p>\n<h2>Azure Synapse Link for SQL Scenarios<\/h2>\n<p><strong>Azure Synapse Link for SQL<\/strong> can be implemented in 3 different scenarios:<\/p>\n<p><strong>Azure SQL Database<\/strong>: The fact both services are online inside Azure makes the implementation easier. Azure SQL Database makes some steps easier.<\/p>\n<p><strong>SQL Server 2022 in an Azure VM<\/strong>: SQL Server 2022 requires some additional steps for the use of Azure Synapse Link for SQL. The fact it\u2019s installed in an Azure VM makes the process easier, allowing use of an Autoresolved integration runtime. This scenario worked well during my tests, but it\u2019s not confirmed yet as a fully supported scenario. Officially, for SQL Server 2022, a self-hosted integration runtime is required.<\/p>\n<p><strong>SQL Server 2022 on premises<\/strong>: This is the scenario requiring the most work. Since the server is on premises, you will need to use a self-hosted integration runtime installed on premises to send the data to the landing zone in the cloud. The services in the cloud will not access the on-premises environment. The self-hosted IR will be the responsible for start\/stop operations, and the SQL Server on premises will send the data to the cloud.<\/p>\n<h2>Azure Synapse Link for SQL Architecture<\/h2>\n<p>The basic architecture is always the same: an integration runtime is used to control the start\/stop of the Link on the source database. The source database needs to support the change feed feature, it means it needs to be an <strong>Azure SQL Database<\/strong> or <strong>SQL Server 2022<\/strong>.<\/p>\n<p>The source database will send all the new or changed records to a landing zone. The Synapse Workspace will load the data from the landing zone to the target database.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1018\" height=\"567\" class=\"wp-image-94386\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/diagram-description-automatically-generated-5.png\" alt=\"Diagram\n\nDescription automatically generated\" \/><\/p>\n<p>If the source database is an <strong>Azure SQL Database<\/strong>, the landing zone will be internal to the <strong>Synapse Workspace<\/strong>. There will not be access to the landing zone. The <strong>Azure SQL Database<\/strong> will need to have a system managed identity which will be used to access and save the data in this internal landing zone.<\/p>\n<p>Internally, <strong>Synapse Analytics<\/strong> has an <strong>Ingestion Service<\/strong> responsible for loading the data from the landing zone to the <strong>Dedicated SQL Pool<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"636\" class=\"wp-image-94387\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/diagram-description-automatically-generated-6.png\" alt=\"Diagram\n\nDescription automatically generated\" \/><\/p>\n<p>If the source database is a <strong>SQL Server 2022<\/strong>, the landing zone will be explicitly created as an <strong>ADLS Gen 2 Account<\/strong>. During the start of the link the integration runtime (IR) will create a database scoped credential to allow SQL Server to access the <strong>ADLS Gen 2 Account<\/strong>. This credential will be using a SAS token to authenticate to the <strong>ADLS Gen 2 Account<\/strong>.<\/p>\n<p>The start\/stop process is executed by the IR, which will connect to the source database using the authentication provided on the linked service.<\/p>\n<p>The authentication to the source SQL can use <strong>SQL Standard Authentication<\/strong> or <strong>Managed Identity<\/strong>. If it uses managed identity, the <strong>Azure AD<\/strong> user will need to receive access the source SQL.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"658\" class=\"wp-image-94388\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/diagram-description-automatically-generated-7.png\" alt=\"Diagram\n\nDescription automatically generated\" \/><\/p>\n<p>Finally, if the source SQL is on premises, the IR will need to be a self-hosted IR in the on-premises environment.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"634\" class=\"wp-image-94389\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/chart-diagram-description-automatically-generate.png\" alt=\"Chart, diagram\n\nDescription automatically generated with medium confidence\" \/><\/p>\n<h2>Provisioning the Azure Synapse Link for SQL<\/h2>\n<p>The <strong>Azure Synapse Link for SQL<\/strong> provisioning is done using <strong>Synapse Studio<\/strong>. Some steps are slightly different depending on the provisioning scenario.<\/p>\n<ol>\n<li>On the <strong>Synapse Studio<\/strong> left toolbar, click the <em>Integrate<\/em> button<\/li>\n<li>Click the <em>Add<\/em> button <em>\u2018+\u2019<\/em><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"252\" class=\"wp-image-94390\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-word-descr-5.png\" alt=\"Graphical user interface, application, Word\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"3\">\n<li>Click the <em>Link Connection<\/em> menu item<\/li>\n<li>On the <em>New Link Connection<\/em> window select <em>Azure SQL<\/em> as the source type<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"498\" class=\"wp-image-94391\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-email-7.png\" alt=\"Graphical user interface, text, application, email\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"5\">\n<li>On <em>Source Linked Service<\/em>, select <em>New<\/em> to create a new linked service<\/li>\n<\/ol>\n<p><strong>Linked Services<\/strong> are used by <strong>Synapse Analytics<\/strong> to establish a connection to external services. Every linked service uses an integration runtime (IR) to execute actions on the connected service.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"720\" class=\"wp-image-94392\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-email-8.png\" alt=\"Graphical user interface, text, application, email\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"6\">\n<li>On the <em>Name<\/em> textbox, type the name <em>AdventureSQL<\/em><\/li>\n<li>Choose the integration runtime to be used. For Azure SQL, the auto-resolved runtime works, you don\u2019t need to use a self-hosted one.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"718\" height=\"157\" class=\"wp-image-94393\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/table-description-automatically-generated-with-me-2.png\" alt=\"Table\n\nDescription automatically generated with medium confidence\" \/><\/p>\n<ol start=\"8\">\n<li>Select the <strong>Azure SQL<\/strong> you will be connecting to.<\/li>\n<\/ol>\n<p>You can select the <strong>Azure SQL<\/strong> from a subscription you have access to, or you can manually insert a connection string. The result for the service will be the same. This creates an interesting level of flexibility:<\/p>\n<ul>\n<li>You can configure the Link Connection even if your azure account doesn\u2019t have access to the source server. The connection string can be inserted manually, and the authentication can be recovered from an <strong>Azure Key Vault<\/strong><\/li>\n<li>Theoretically, the connection could be established to any <strong>SQL Server<\/strong>, including <strong>SQL Server<\/strong> on premise or in other clouds. In practice, Link Connections can only be established with <strong>Azure SQL Database<\/strong> or <strong>SQL Server 2022<\/strong>. Anyway, the creation of a linked service can have other purposes beyond the use for the Synapse Link.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"620\" class=\"wp-image-94394\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-email-9.png\" alt=\"Graphical user interface, text, application, email\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"9\">\n<li>Choose the <em>Authentication Type<\/em> which will be used.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"280\" class=\"wp-image-94395\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-email-10.png\" alt=\"Graphical user interface, text, application, email\n\nDescription automatically generated\" \/><\/p>\n<p><strong>SQL authentication<\/strong> is a very well-know authentication. The other types are the following:<\/p>\n<p><strong>System Assigned Managed Identity:<\/strong> This is the Managed Identity automatically assigned to the <strong>Synapse Workspace<\/strong> by <strong>Azure<\/strong><\/p>\n<p><strong>User Assigned Managed Identity:<\/strong> This is the customized managed identity assigned to the workspace by the developer. You can assign custom managed identities on the Identity menu item on the workspace, as you may notice on the images below. You can assign multiple managed identities, because in it\u2019s possible to control the permissions to each linked service in an isolated way. <strong><em>This option is not supported by Synapse Link at the moment<\/em><\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"273\" height=\"299\" class=\"wp-image-94396\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-descr-12.png\" alt=\"Graphical user interface, text, application\n\nDescription automatically generated\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"234\" class=\"wp-image-94397\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/application-description-automatically-generated-w.png\" alt=\"Application\n\nDescription automatically generated with low confidence\" \/><\/p>\n<p><strong>Service Principal:<\/strong> Service principal is a special kind of identity. This identity is often used by applications to connect to azure resources. Create this kind of identity by creating an app registration on the <strong>Azure Active Directory. <em>This option is not supported by Synapse Link at the moment<\/em><\/strong><\/p>\n<p>Even if the authentication used is the <strong>SQL authentication<\/strong>, the user making the configuration doesn\u2019t need to know the password, the password could be retrieved from <strong>Azure Key Vault<\/strong>.<\/p>\n<p>You may notice that although a linked service has 4 authentication options to an Azure SQL Database, only two of them, <strong>SQL authentication<\/strong> and <strong>System Assigned Managed Identity<\/strong>, are supported at the moment. This once again highlights the fact that Linked Services are used for many purposes in Synapse Analytics, not only for <strong>Azure Synapse Link for SQL<\/strong>.<\/p>\n<p>When using a <strong>System Assigned Managed Identity<\/strong>, Identity with <strong>Azure SQL Database<\/strong>, you will need to add it as <strong>db_owner<\/strong> of the <strong>Azure SQL Database<\/strong>. The code bellow illustrates this with a <strong>System Managed Identity<\/strong>.<\/p>\n<pre class=\"lang:tsql decode:true \">CREATE USER maltasynapselink FROM EXTERNAL PROVIDER;\r\n\r\nALTER ROLE [db_owner] ADD MEMBER maltasynapselink;<\/pre>\n<p>&nbsp;<\/p>\n<ol start=\"10\">\n<li>Click the <em>Test Connection<\/em> link<\/li>\n<\/ol>\n<p>The access to <strong>Azure SQL Database<\/strong> is controlled by a firewall. Using <strong>Azure Synapse Link for SQL<\/strong>, it\u2019s <strong>Synapse <\/strong>which will access the <strong>Azure SQL Database<\/strong>. In order to allow this access, there are three options:<\/p>\n<p><strong>Enable access to Azure Services<\/strong>: This option opens the firewall to any service inside <strong>Azure<\/strong>, either the service is in your tenant or not. It\u2019s the easiest option, used very often, but has the highest risk. I wrote about this in this article <a href=\"https:\/\/www.red-gate.com\/simple-talk\/cloud\/azure\/eight-azure-sql-configurations-you-may-have-missed\/\">https:\/\/www.red-gate.com\/simple-talk\/cloud\/azure\/eight-azure-sql-configurations-you-may-have-missed\/<\/a> <br \/>\n<strong>Open the firewall to the Synapse Ips<\/strong>: <strong>Synapse<\/strong> has a specific range of Ips in <strong>Azure<\/strong>. You can open the <strong>Azure SQL Database<\/strong> firewall to this specific range of Ips. It\u2019s safer than enabling access to all <strong>Azure<\/strong> services, but you can\u2019t be sure that only your <strong>Synapse Workspace<\/strong> will be able to pass through the firewall.<\/p>\n<p>In the future, the use of Private Endpoints may become available for Azure Synapse Link for SQL, but at the moment it\u2019s not supported.<\/p>\n<p>I delivered a technical session about Azure SQL networking, you can watch on this link <a href=\"https:\/\/www.youtube.com\/watch?v=RKZy5MkqFDQ&amp;list=PLNbt9tnNIlQ5pVwZFRVpoBG8uQTs8aIcz&amp;index=20\">https:\/\/www.youtube.com\/watch?v=RKZy5MkqFDQ&amp;list=PLNbt9tnNIlQ5pVwZFRVpoBG8uQTs8aIcz&amp;index=20<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"759\" height=\"89\" class=\"wp-image-94398\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/background-pattern-description-automatically-gene.png\" alt=\"Background pattern\n\nDescription automatically generated with low confidence\" \/><\/p>\n<ol start=\"11\">\n<li>Click the <em>Create<\/em> button<\/li>\n<li>Select the tables you would like to include in your Link Connection<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"720\" class=\"wp-image-94399\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-19.png\" alt=\"Graphical user interface, application\n\nDescription automatically generated\" \/><\/p>\n<p>The image above contains the Source managed identity ID. When using <strong>Azure SQL Database<\/strong> as a source, it needs to have a managed identity. <strong>Synapse<\/strong> will provide access permissions to this identity to access the internal landing zone, as explained before in this article.<\/p>\n<p>You can read more about Azure SQL Managed Identity here <a href=\"https:\/\/www.red-gate.com\/simple-talk\/blogs\/azure-sql-and-managed-identity\/\">https:\/\/www.red-gate.com\/simple-talk\/blogs\/azure-sql-and-managed-identity\/<\/a><\/p>\n<ol start=\"13\">\n<li>Select the target dedicated SQL Pool and database<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"322\" class=\"wp-image-94400\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/a-picture-containing-graphical-user-interface-des-1.png\" alt=\"A picture containing graphical user interface\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"14\">\n<li>On the <em>New Link Connection<\/em> window, in the <em>Link Connection Name<\/em> textbox, type <em>sqldbconnection<\/em><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"291\" class=\"wp-image-94401\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-email-11.png\" alt=\"Graphical user interface, text, application, email\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"15\">\n<li>Select the number of cores you would like to use for the ingestion service running behind the Link Connection.<\/li>\n<\/ol>\n<p>You don\u2019t need to use one single Link Connection for all your tables. You can break down your tables in multiples Link Connections. One reason to do so is the number of transactions each table receives. You can create Link Connections with a higher number of cores for the heaviest tables and a different Link Connection for the tables with a smaller number of transactions.<\/p>\n<ol start=\"16\">\n<li>Click the <em>Ok<\/em> button. This will complete the initial Link Connection creation, and you will see the Link Connection configuration window as the image below.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"310\" class=\"wp-image-94402\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-20.png\" alt=\"Graphical user interface, application\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"17\">\n<li>On the following window, you have the option to select the distribution type (<strong>Round Robin<\/strong>, <strong>Hash<\/strong> or <strong>Replicated<\/strong>).<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"173\" height=\"232\" class=\"wp-image-94403\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-chat.png\" alt=\"Graphical user interface, text, application, chat or text message\n\nDescription automatically generated\" \/><\/p>\n<p>You can read more about table distribution here: <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/synapse-analytics\/sql-data-warehouse\/sql-data-warehouse-tables-distribute?WT.mc_id=DP-MVP-4014132\">https:\/\/docs.microsoft.com\/en-us\/azure\/synapse-analytics\/sql-data-warehouse\/sql-data-warehouse-tables-distribute?WT.mc_id=DP-MVP-4014132<\/a><\/p>\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"18\">\n<li>On the same window, you have the option to select the table structure (<strong>Clustered Columnstore Index<\/strong>, <strong>Heap<\/strong> or <strong>Clustered Index<\/strong>)<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"259\" height=\"200\" class=\"wp-image-94404\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-chat-1.png\" alt=\"Graphical user interface, text, application, chat or text message\n\nDescription automatically generated\" \/><\/p>\n<p>You can read more about table design here: <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/synapse-analytics\/sql-data-warehouse\/sql-data-warehouse-tables-overview?WT.mc_id=DP-MVP-4014132\">https:\/\/docs.microsoft.com\/en-us\/azure\/synapse-analytics\/sql-data-warehouse\/sql-data-warehouse-tables-overview?WT.mc_id=DP-MVP-4014132<\/a><\/p>\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"19\">\n<li>Still on the same window, you can customize the schema and table name.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><strong>Important:<\/strong> Initially the schema and table name will be the same as in the source system. However, the schema will not be created by <strong>Azure Synapse Link for SQL<\/strong>. If the schema doesn\u2019t exist in the target dedicated pool the execution will generate an error. If you are using a schema other than <strong>DBO<\/strong>, you need to create the schema before starting the link<\/p>\n<h2>Additional Options<\/h2>\n<p>There are two additional options you can set before publishing the Link Connection. The image below illustrates these options<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"539\" class=\"wp-image-94405\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-21.png\" alt=\"Graphical user interface, application\n\nDescription automatically generated\" \/><\/p>\n<h3>Drop and recreate table on target<\/h3>\n<p>When this option is selected, if the target tables already exist, they will be dropped. This means the synchronization will need to start again, transferring all the data from the source to the target.<\/p>\n<p>This is something you would not like to happen. However, it\u2019s important to keep in mind how the Stop button for the Link Connection works. It\u2019s easy: Don\u2019t stop the link. Every time you stop the link, when you start it again, it will be required to drop the destination tables and start from the beginning.<\/p>\n<p>There is no need to stop the link. If you would like to include or exclude tables, you can do this without stopping the link. If you remove a table from the Link Connection and add it again, the table will be re-seeded, but only this single table, not all tables in the Link Connection.<\/p>\n<p><strong>Very Important:<\/strong> You never stop a Link Connection. If you stop a Link Connection, you will need to drop the target tables and start the synchronization again from the beginning and this will be heavy. Interruptions can happen, you can stop the SQL Pool, but there is no need to stop the Link Connection and you shouldn\u2019t do it.<\/p>\n<h3>Enable transaction consistency across tables<\/h3>\n<p>This option will ensure the records will be transaction consistent across the tables in the same Link connection.<\/p>\n<p>Of course, not all tables in your source database will have this transactional relation. You don\u2019t need to limit yourself to a single link connection for each source. You can break down your tables among multiple link connections, grouping the tables according to the transactional consistency needed.<\/p>\n<h3>Starting the Link Connection<\/h3>\n<p>After configuring the Link Connection, you must publish the changes on the workspace before starting the link.<\/p>\n<p>The Publish button is always highlighted when there are pending changes in the workspace. Once you click the Publish button, you can review the changes on the Publish All window and click the new Publish button on this window.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"251\" class=\"wp-image-94406\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-description-automaticall-3.png\" alt=\"Graphical user interface\n\nDescription automatically generated with low confidence\" \/><\/p>\n<p>After publishing, you can click the Start button on the Link Connection. Once started, as mentioned before on this article, you don\u2019t stop the Link Connection. If you stop the Link Connection, you will need to start the synchronization again from the beginning.<\/p>\n<h3>Monitoring the Link Connection<\/h3>\n<p>Once you start the Link Connection, you can monitor it on the Monitor tab, Link Connections menu item.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"322\" height=\"352\" class=\"wp-image-94407\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-22.png\" alt=\"Graphical user interface, application\n\nDescription automatically generated\" \/><\/p>\n<p>The monitoring information is displayed in two different levels: The existing link connections and the tables inside each link connection.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"234\" class=\"wp-image-94408\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-23.png\" alt=\"Graphical user interface, application\n\nDescription automatically generated\" \/><\/p>\n<p>There are two levels of possible errors:<\/p>\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>Link Level errors:<\/strong> Errors on the level of the link. For example, if the link can\u2019t reach the source machine to start the configuration, this is a link level error. The link level errors are also highlighted on the Link window on the Integrate tab.<\/li>\n<li><strong>Table Level errors:<\/strong> Any error specific to one table. For example, if the primary key of the table is not acceptable for the table, it will appear as a table level error.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><strong>Important:<\/strong> Even if all the tables have errors, they will not appear as errors on the Link window. The message on the Link window advises you to check the monitoring even if it appears the Link is running correctly. This is a good advice, as you may notice in the image below, from the Link window, in the Integrate tab.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"134\" class=\"wp-image-94409\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/word-image-8.png\" \/><\/p>\n<p>Once you click one existing link connection inside the <em>Link Connections<\/em> monitoring window, you can see the tables inside the link connection, like the example below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"280\" class=\"wp-image-94410\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-24.png\" alt=\"Graphical user interface, application\n\nDescription automatically generated\" \/><\/p>\n<p>There are three possible statuses for the tables inside the Link Connection:<\/p>\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>Snapshotting<\/strong>, when the initial table snapshot is being created to initialize the link.<\/li>\n<li><strong>Replicating<\/strong>, when the replication is running correctly.<\/li>\n<li><strong>Error<\/strong>, when an error has happened<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2>Azure Synapse Link for SQL and SQL Server 2022<\/h2>\n<p>There are very few differences when implementing the <strong>Azure Synapse Link for SQL<\/strong> with <strong>SQL Server 2022<\/strong>. Let\u2019s analyse them.<\/p>\n<h3>The source database requires a master key<\/h3>\n<p>As explained before, a database scoped credential will be created to allow <strong>SQL Server<\/strong> to access the landing <strong>ADLS Gen 2 account<\/strong>. If your database doesn\u2019t have a master key yet, you can create it using the statement below.<\/p>\n<pre class=\"lang:tsql decode:true \">create master key encrypt by password='YourPassword'<\/pre>\n<p>&nbsp;<\/p>\n<p>After starting the Link Connection, you can check the database scoped credential by using the query below.<\/p>\n<pre class=\"lang:tsql decode:true \">select * from sys.database_credentials<\/pre>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1131\" height=\"81\" class=\"wp-image-94411\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-descr-13.png\" alt=\"Graphical user interface, text, application\n\nDescription automatically generated\" \/><\/p>\n<h3>The source database requires an Owner<\/h3>\n<p>Sometimes, when restoring a database from a backup or after some other activities, the database can end up without a database owner.<\/p>\n<p>This is not a good practice and the lack of the owner in the configuration can cause some other problems as well.<\/p>\n<p>You can use the statement below to set the owner for the database. In the statement below, I\u2019m defining <strong>SA<\/strong> as the owner. This is not a good practice. You may need to plan better which login you will set as the database owner.<\/p>\n<pre class=\"lang:tsql decode:true \">alter authorization on Database::AdvWorks2019 to sa<\/pre>\n<p>&nbsp;<\/p>\n<p>You can read more about the importance of the database owner choice on this article: <a href=\"https:\/\/www.red-gate.com\/simple-talk\/blogs\/careful-trustworthy-setting\/\">https:\/\/www.red-gate.com\/simple-talk\/blogs\/careful-trustworthy-setting\/<\/a><\/p>\n<h3>The landing area is explicitly created as an ADLS Gen 2 Account<\/h3>\n<p>When creating a Link Connection using <strong>SQL Server<\/strong> as a source, the landing area is provisioned together the Link Connection. As you may notice on the image below, you will need to configure an <strong>ADLS Gen 2 Account<\/strong> as a landing area.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"612\" height=\"720\" class=\"wp-image-94412\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-email-description.png\" alt=\"Graphical user interface, text, email\n\nDescription automatically generated with medium confidence\" \/><\/p>\n<p>Some considerations at this point:<\/p>\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ul>\n<li>The <strong>ADLS Gen 2 Account <\/strong>will be connected to the <strong>Synapse Workspace<\/strong> using a linked service.<\/li>\n<li>The connection from SQL Server to the landing zone will be made using a <strong>SAS<\/strong> key which will be created in the source SQL Server during the process of starting the link<\/li>\n<li>The Link Connection will use the IR configured in the linked service to access the landingzone. It will use the linked service authentication to access the landing zone<\/li>\n<li>The ADLS Gen 2 account needs to be created before the Azure Synapse Link for SQL provisioning process.<\/li>\n<li>You can create the <strong>SAS<\/strong> key during the Link Connection provisioning process by clicking the <em>Generate Token<\/em> link. This will open the window you can see on the image below.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"689\" height=\"415\" class=\"wp-image-94413\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/word-image-9.png\" \/><\/p>\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ul>\n<li>As every <strong>SAS<\/strong> key, this one also has an expiration date and will need to be rotated.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>You rotate the key without stopping the <strong>Azure Synapse Link for SQL<\/strong> (what is something you should never do, as mentioned before). The image below shows the <em>Rotate Token<\/em> button on the Link Connection properties window.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"355\" height=\"324\" class=\"wp-image-94414\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-chat-2.png\" alt=\"Graphical user interface, text, application, chat or text message\n\nDescription automatically generated\" \/><\/p>\n<p>The <em>Rotate Token<\/em> window is slightly different than the window to create the token. When rotating the token, you have the option to create a new <strong>SAS<\/strong> key or input one manually. This means that you can decide about using an <strong>Azure Storage Account Policy<\/strong> later, after the container is already in use.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"428\" class=\"wp-image-94415\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-application-email-12.png\" alt=\"Graphical user interface, text, application, email\n\nDescription automatically generated\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"689\" height=\"210\" class=\"wp-image-94416\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2022\/05\/graphical-user-interface-text-description-automa.png\" alt=\"Graphical user interface, text\n\nDescription automatically generated\" \/><\/p>\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ol start=\"18\">\n<li style=\"list-style-type: none;\">\n<ul>\n<li>You can create the <strong>SAS<\/strong> key manually instead of letting the provisioning process create the key for you.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>Creating the key manually allows you to create the key linked to an azure storage policy, which can make it easier to automate the rotation of the key. You can read more about the benefit of <strong>Storage Account<\/strong> policies on this link: <a href=\"https:\/\/www.red-gate.com\/simple-talk\/blogs\/azure-storage-policies-control-sas-from-the-server-side\/\">https:\/\/www.red-gate.com\/simple-talk\/blogs\/azure-storage-policies-control-sas-from-the-server-side\/<\/a><\/p>\n<p>If you decide to create the SAS key manually, it\u2019s important to mind the SAS key will need the following permissions: RACWDL (Read, Add, Create, Write, Delete and List)<\/p>\n<h2>Summary<\/h2>\n<p>The <strong>Azure Synapse Link for SQL<\/strong> is not the entire way from production to a data warehouse, but it makes the <strong>ETL\/ELT<\/strong> process way easier by synchronizing the data with the <strong>Synapse dedicated SQL Pool<\/strong>, relieving the production environment from further <strong>ETL<\/strong> workload, and allowing you to proceed from this point with the transformation of the data for the data warehouse.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft announced Azure Synapse Link for SQL. In this article, MVP Dennes Torres explains the new feature.&hellip;<\/p>\n","protected":false},"author":50808,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143528,53],"tags":[5966],"coauthors":[6810],"class_list":["post-94384","post","type-post","status-publish","format-standard","hentry","category-bi-sql-server","category-featured","tag-monitor"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/94384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/50808"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=94384"}],"version-history":[{"count":5,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/94384\/revisions"}],"predecessor-version":[{"id":94421,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/94384\/revisions\/94421"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=94384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=94384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=94384"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=94384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}