You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: azure-sql/managed-instance/replication-two-instances-and-sql-server-configure-tutorial.md
+50-36Lines changed: 50 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: "A tutorial that configures replication between a publisher SQL man
4
4
author: MladjoA
5
5
ms.author: mlandzic
6
6
ms.reviewer: mathoma
7
-
ms.date: 08/26/2025
7
+
ms.date: 12/31/2025
8
8
ms.service: azure-sql-managed-instance
9
9
ms.subservice: security
10
10
ms.topic: tutorial
@@ -29,11 +29,11 @@ In this tutorial, you learn how to:
29
29
> - Configure a SQL managed instance as a replication distributor.
30
30
> - Configure SQL Server as a subscriber.
31
31
32
-

32
+
:::image type="content" source="media/replication-two-instances-and-sql-server-configure-tutorial/sqlmi-to-sql-replication.png" alt-text="Diagram showing replication between a SQL managed instance publisher, SQL managed instance distributor, and SQL Server subscriber.":::
33
33
34
34
This tutorial is intended for an experienced audience and assumes the user is familiar with deploying and connecting to both SQL managed instances and SQL Server VMs within Azure.
35
35
36
-
> [!NOTE]
36
+
> [!NOTE]
37
37
> This article describes the use of [transactional replication](/sql/relational-databases/replication/transactional/transactional-replication) in Azure SQL Managed Instance. It's unrelated to [failover groups](failover-group-sql-mi.md), an Azure SQL Managed Instance feature that allows you to create complete readable replicas of individual instances. There are additional considerations when configuring [transactional replication with failover groups](replication-transactional-overview.md#with-failover-groups).
38
38
39
39
## Prerequisites
@@ -67,9 +67,9 @@ Create two SQL managed instances within this new resource group using the [Azure
67
67
- The name of the publisher SQL managed instance should be `sql-mi-publisher` (along with a few characters for randomization), and the name of the virtual network should be `vnet-sql-mi-publisher`.
68
68
- The name of the distributor SQL managed instance should be `sql-mi-distributor` (along with a few characters for randomization), and it should be *in the same virtual network as the publisher SQL managed instance*.
69
69
70
-

70
+
:::image type="content" source="media/replication-two-instances-and-sql-server-configure-tutorial/use-same-vnet-for-distributor.png" alt-text="Screenshot showing the use of the publisher VNet for the distributor.":::
71
71
72
-
For more information about creating a SQL managed instance, see [Create a SQL managed instance in the portal](instance-create-quickstart.md).
72
+
For more information about creating a SQL managed instance, see [Quickstart: Create Azure SQL Managed Instance](instance-create-quickstart.md).
73
73
74
74
> [!NOTE]
75
75
> For the sake of simplicity, and because it's the most common configuration, this tutorial suggests placing the distributor SQL managed instance within the same virtual network as the publisher. However, it's possible to create the distributor in a separate virtual network. To do so, you'll need to configure VNet peering between the virtual networks of the publisher and distributor, and then configure VNet peering between the virtual networks of the distributor and subscriber.
@@ -79,11 +79,11 @@ For more information about creating a SQL managed instance, see [Create a SQL ma
79
79
Create a SQL Server virtual machine using the [Azure portal](https://portal.azure.com). The SQL Server virtual machine should have the following characteristics:
80
80
81
81
- Name: `sql-vm-subscriber`
82
-
- Image: SQL Server 2016 or later
82
+
- Image: SQL Server version that supports transactional replication with Azure SQL Managed Instance, per the [supportability matrix](replication-transactional-overview.md#supportability-matrix)
83
83
- Resource group: the same as the SQL managed instance
84
84
- Virtual network: `sql-vm-subscriber-vnet`
85
85
86
-
For more information about deploying a SQL Server VM to Azure, see [Quickstart: Create a SQL Server VM](../virtual-machines/windows/sql-vm-create-portal-quickstart.md).
86
+
For more information about deploying a SQL Server VM to Azure, see [Quickstart: Create SQL Server on a Windows virtual machine in the Azure portal](../virtual-machines/windows/sql-vm-create-portal-quickstart.md).
Once VNet peering is established, test connectivity by launching SQL Server Management Studio (SSMS) on the SQL Server host and connecting to both SQL managed instances. For more information on connecting to a SQL managed instance using SSMS, see [Use SSMS to connect to SQL Managed Instance](point-to-site-p2s-configure.md#connect-with-ssms).
135
135
136
-

136
+
:::image type="content" source="media/replication-two-instances-and-sql-server-configure-tutorial/test-connectivity-to-mi.png" alt-text="Screenshot showing how to test connectivity to the SQL managed instances.":::
137
137
138
-
<aid="create-a-private-dns-zone"></a>
138
+
<aid="creating-a-private-dns-zone"></a>
139
139
140
-
## Creating a private DNS zone
140
+
## Create a private DNS zone
141
141
142
142
A private DNS zone allows DNS routing between the SQL managed instances and SQL Server.
143
143
144
-
### Create a private DNS zone
144
+
### Create a private zone
145
145
146
146
1. Sign into the [Azure portal](https://portal.azure.com).
147
147
1. Select **Create a resource** to create a new Azure resource.
@@ -150,7 +150,7 @@ A private DNS zone allows DNS routing between the SQL managed instances and SQL
150
150
1. Choose the subscription and resource group from the dropdown list.
151
151
1. Provide an arbitrary name for your DNS zone, such as `repldns.com`.
152
152
153
-

153
+
:::image type="content" source="media/replication-two-instances-and-sql-server-configure-tutorial/create-private-dns-zone.png" alt-text="Screenshot showing the Create private DNS zone in the Azure portal." lightbox="media/replication-two-instances-and-sql-server-configure-tutorial/create-private-dns-zone.png":::
154
154
155
155
1. Select **Review + create**. Review the parameters for your private DNS zone, and then select **Create** to create your resource.
156
156
@@ -160,7 +160,7 @@ A private DNS zone allows DNS routing between the SQL managed instances and SQL
160
160
1. Select **+ Record set** to create a new A record.
161
161
1. Provide the name of your SQL Server VM as well as the private internal IP address.
162
162
163
-

163
+
:::image type="content" source="media/replication-two-instances-and-sql-server-configure-tutorial/configure-a-record.png" alt-text="Screenshot showing how to configure an A record." lightbox="media/replication-two-instances-and-sql-server-configure-tutorial/configure-a-record.png":::
164
164
165
165
1. Select **OK** to create the A record.
166
166
@@ -172,7 +172,7 @@ A private DNS zone allows DNS routing between the SQL managed instances and SQL
172
172
1. Select your subscription from the dropdown list, and then select the virtual network for your publisher SQL managed instance.
173
173
1. Check the box next to **Enable auto registration**.
174
174
175
-

175
+
:::image type="content" source="media/replication-two-instances-and-sql-server-configure-tutorial/configure-vnet-link.png" alt-text="Screenshot showing how to create a VNet link." lightbox="media/replication-two-instances-and-sql-server-configure-tutorial/configure-vnet-link.png":::
176
176
177
177
1. Select **OK** to link your virtual network.
178
178
1. Repeat these steps to add a link for the subscriber virtual network, with a name such as `Sub-link`.
@@ -182,11 +182,13 @@ A private DNS zone allows DNS routing between the SQL managed instances and SQL
182
182
[Create an Azure storage account](/azure/storage/common/storage-account-create#create-a-storage-account) for the working directory, and then create a [file share](/azure/storage/files/storage-how-to-create-file-share) within the storage account.
@@ -290,7 +298,7 @@ Once distribution has been configured, you can create the publication. To do so,
290
298
1. On the **Snapshot Agent** page, check the box next to **Create snapshot immediately and keep the snapshot available to initialize subscriptions**. Select **Next**.
291
299
1. On the **Agent Security** page, select **Security Settings...**. Provide SQL Server login credentials to use for the Snapshot Agent and to connect to the publisher. Select **OK** to close the **Snapshot Agent Security** page. Select **Next**.
292
300
293
-

301
+
:::image type="content" source="media/replication-two-instances-and-sql-server-configure-tutorial/snapshot-agent-security.png" alt-text="Screenshot showing how to configure Snapshot Agent security.":::
294
302
295
303
1. On the **Wizard Actions** page, choose to **Create the publication** and (optionally) choose to **Generate a script file with steps to create the publication** if you want to save this script for later.
296
304
1. On the **Complete the Wizard** page, name your publication `ReplTest`, and select **Next** to create your publication.
@@ -336,22 +344,28 @@ Once replication has been configured, you can test it by inserting new items on
336
344
Run the following T-SQL snippet to view the rows on the subscriber:
337
345
338
346
```sql
339
-
Use ReplSub
340
-
select*fromdbo.ReplTest
347
+
USE ReplSub;
348
+
GO
349
+
350
+
SELECT*
351
+
FROMdbo.ReplTest;
341
352
```
342
353
343
354
Run the following T-SQL snippet to insert additional rows on the publisher, and then check the rows again on the subscriber.
344
355
345
356
```sql
346
-
Use ReplTutorial
347
-
INSERT INTO ReplTest (ID, c1) VALUES (15, 'pub')
357
+
USE ReplTutorial;
358
+
GO
359
+
360
+
INSERT INTO ReplTest (ID, c1)
361
+
VALUES (15, 'pub');
348
362
```
349
363
350
364
## Clean up resources
351
365
352
366
1. Navigate to your resource group in the [Azure portal](https://portal.azure.com).
353
367
1. Select the SQL managed instances, and then select **Delete**. Type `yes` in the text box to confirm you want to delete the resource, and then select **Delete**. This process might take some time to complete in the background, and until it's done, you'll not be able to delete the *virtual cluster* or any other dependent resources. Monitor the delete in the **Activity** tab to confirm your SQL managed instance has been deleted.
354
-
1. Once the SQL managed instance is deleted, delete the _virtual cluster_ by selecting it in your resource group, and then choosing **Delete**. Type `yes` in the text box to confirm you want to delete the resource, and then select **Delete**.
368
+
1. Once the SQL managed instance is deleted, delete the *virtual cluster* by selecting it in your resource group, and then choosing **Delete**. Type `yes` in the text box to confirm you want to delete the resource, and then select **Delete**.
355
369
1. Delete any remaining resources. Type `yes` in the text box to confirm you want to delete the resource, and then select **Delete**.
356
370
1. Delete the resource group by selecting **Delete resource group**, typing in the name of the resource group `myResourceGroup`, and then selecting **Delete**.
357
371
@@ -383,12 +397,12 @@ Using a forward slash instead of backslash in the file path for the file share c
383
397
384
398
### Couldn't connect to Subscriber
385
399
386
-
```error-text
400
+
```output
387
401
The process could not connect to Subscriber 'SQL-VM-SUBSCRIBER
388
402
Could not open a connection to SQL Server [53].
389
403
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections.
0 commit comments