Skip to content

Commit e67b5e4

Browse files
Merge pull request #36110 from MladjoA/patch-22
Update SQL Server image version and date in tutorial
2 parents 783b74a + fbef2d1 commit e67b5e4

1 file changed

Lines changed: 50 additions & 36 deletions

File tree

azure-sql/managed-instance/replication-two-instances-and-sql-server-configure-tutorial.md

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "A tutorial that configures replication between a publisher SQL man
44
author: MladjoA
55
ms.author: mlandzic
66
ms.reviewer: mathoma
7-
ms.date: 08/26/2025
7+
ms.date: 12/31/2025
88
ms.service: azure-sql-managed-instance
99
ms.subservice: security
1010
ms.topic: tutorial
@@ -29,11 +29,11 @@ In this tutorial, you learn how to:
2929
> - Configure a SQL managed instance as a replication distributor.
3030
> - Configure SQL Server as a subscriber.
3131
32-
![Diagram showing replication between a SQL managed instance publisher, SQL managed instance distributor, and SQL Server subscriber](./media/replication-two-instances-and-sql-server-configure-tutorial/sqlmi-to-sql-replication.png)
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.":::
3333

3434
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.
3535

36-
> [!NOTE]
36+
> [!NOTE]
3737
> 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).
3838
3939
## Prerequisites
@@ -67,9 +67,9 @@ Create two SQL managed instances within this new resource group using the [Azure
6767
- 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`.
6868
- 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*.
6969

70-
![Screenshot showing the use of the publisher VNet for the distributor.](./media/replication-two-instances-and-sql-server-configure-tutorial/use-same-vnet-for-distributor.png)
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.":::
7171

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).
7373

7474
> [!NOTE]
7575
> 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
7979
Create a SQL Server virtual machine using the [Azure portal](https://portal.azure.com). The SQL Server virtual machine should have the following characteristics:
8080

8181
- 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)
8383
- Resource group: the same as the SQL managed instance
8484
- Virtual network: `sql-vm-subscriber-vnet`
8585

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).
8787

8888
## Configure VNet peering
8989

@@ -133,15 +133,15 @@ Get-AzVirtualNetworkPeering `
133133

134134
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).
135135

136-
![Screenshot showing how to test connectivity to the SQL managed instances.](./media/replication-two-instances-and-sql-server-configure-tutorial/test-connectivity-to-mi.png)
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.":::
137137

138-
<a id="create-a-private-dns-zone"></a>
138+
<a id="creating-a-private-dns-zone"></a>
139139

140-
## Creating a private DNS zone
140+
## Create a private DNS zone
141141

142142
A private DNS zone allows DNS routing between the SQL managed instances and SQL Server.
143143

144-
### Create a private DNS zone
144+
### Create a private zone
145145

146146
1. Sign into the [Azure portal](https://portal.azure.com).
147147
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
150150
1. Choose the subscription and resource group from the dropdown list.
151151
1. Provide an arbitrary name for your DNS zone, such as `repldns.com`.
152152

153-
![Screenshot showing the Create private DNS zone in the Azure portal.](./media/replication-two-instances-and-sql-server-configure-tutorial/create-private-dns-zone.png)
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":::
154154

155155
1. Select **Review + create**. Review the parameters for your private DNS zone, and then select **Create** to create your resource.
156156

@@ -160,7 +160,7 @@ A private DNS zone allows DNS routing between the SQL managed instances and SQL
160160
1. Select **+ Record set** to create a new A record.
161161
1. Provide the name of your SQL Server VM as well as the private internal IP address.
162162

163-
![Screenshot showing how to configure an A record.](./media/replication-two-instances-and-sql-server-configure-tutorial/configure-a-record.png)
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":::
164164

165165
1. Select **OK** to create the A record.
166166

@@ -172,7 +172,7 @@ A private DNS zone allows DNS routing between the SQL managed instances and SQL
172172
1. Select your subscription from the dropdown list, and then select the virtual network for your publisher SQL managed instance.
173173
1. Check the box next to **Enable auto registration**.
174174

175-
![Screenshot showing how to create a VNet link.](./media/replication-two-instances-and-sql-server-configure-tutorial/configure-vnet-link.png)
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":::
176176

177177
1. Select **OK** to link your virtual network.
178178
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
182182
[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.
183183

184184
Copy the file share path in the format of:
185+
185186
`\\storage-account-name.file.core.windows.net\file-share-name`
186187

187188
Example: `\\replstorage.file.core.windows.net\replshare`
188189

189190
Copy the storage access key connection string in the format of:
191+
190192
`DefaultEndpointsProtocol=https;AccountName=<Storage-Account-Name>;AccountKey=****;EndpointSuffix=core.windows.net`
191193

192194
Example: `DefaultEndpointsProtocol=https;AccountName=replstorage;AccountKey=123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ==;EndpointSuffix=core.windows.net`
@@ -250,18 +252,20 @@ Once connectivity is established and you have a sample database, you can configu
250252
1. Open a **New Query** window, and run the following Transact-SQL code to configure distribution on the distributor SQL managed instance:
251253

252254
```sql
253-
EXEC sp_adddistributor @distributor = 'sql-mi-distributor.b6bf57.database.windows.net', @password = '<distributor_admin_password>'
254-
255-
EXEC sp_adddistributiondb @database = N'distribution'
256-
257-
EXEC sp_adddistpublisher @publisher = 'sql-mi-publisher.b6bf57.database.windows.net', -- primary publisher
258-
@distribution_db = N'distribution',
259-
@security_mode = 0,
260-
@login = N'azureuser',
261-
@password = N'<publisher_password>',
262-
@working_directory = N'\\replstorage.file.core.windows.net\replshare',
263-
@storage_connection_string = N'<storage_connection_string>'
264-
-- example: @storage_connection_string = N'DefaultEndpointsProtocol=https;AccountName=replstorage;AccountKey=123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ==;EndpointSuffix=core.windows.net'
255+
EXECUTE sp_adddistributor
256+
@distributor = 'sql-mi-distributor.b6bf57.database.windows.net',
257+
@password = '<distributor_admin_password>';
258+
259+
EXECUTE sp_adddistributiondb @database = N'distribution';
260+
261+
EXECUTE sp_adddistpublisher
262+
@publisher = 'sql-mi-publisher.b6bf57.database.windows.net', -- primary publisher@distribution_db = N'distribution',
263+
@security_mode = 0,
264+
@login = N'azureuser',
265+
@password = N'<publisher_password>',
266+
@working_directory = N'\\replstorage.file.core.windows.net\replshare',
267+
@storage_connection_string = N'<storage_connection_string>' -- example:
268+
@storage_connection_string = N'DefaultEndpointsProtocol = https;AccountName = replstorage;AccountKey = 123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ = = ;EndpointSuffix = core.windows.net';
265269
```
266270

267271
> [!NOTE]
@@ -271,8 +275,12 @@ Once connectivity is established and you have a sample database, you can configu
271275
1. Open a **New Query** window, and run the following Transact-SQL code to register the distributor at the publisher:
272276

273277
```sql
274-
Use MASTER
275-
EXEC sys.sp_adddistributor @distributor = 'sql-mi-distributor.b6bf57.database.windows.net', @password = '<distributor_admin_password>'
278+
USE master;
279+
GO
280+
281+
EXECUTE sys.sp_adddistributor
282+
@distributor = 'sql-mi-distributor.b6bf57.database.windows.net',
283+
@password = '<distributor_admin_password>';
276284
```
277285

278286
## Create the publication
@@ -290,7 +298,7 @@ Once distribution has been configured, you can create the publication. To do so,
290298
1. On the **Snapshot Agent** page, check the box next to **Create snapshot immediately and keep the snapshot available to initialize subscriptions**. Select **Next**.
291299
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**.
292300

293-
![Screenshot showing how to configure Snapshot Agent security.](./media/replication-two-instances-and-sql-server-configure-tutorial/snapshot-agent-security.png)
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.":::
294302

295303
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.
296304
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
336344
Run the following T-SQL snippet to view the rows on the subscriber:
337345

338346
```sql
339-
Use ReplSub
340-
select * from dbo.ReplTest
347+
USE ReplSub;
348+
GO
349+
350+
SELECT *
351+
FROM dbo.ReplTest;
341352
```
342353

343354
Run the following T-SQL snippet to insert additional rows on the publisher, and then check the rows again on the subscriber.
344355

345356
```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');
348362
```
349363

350364
## Clean up resources
351365

352366
1. Navigate to your resource group in the [Azure portal](https://portal.azure.com).
353367
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**.
355369
1. Delete any remaining resources. Type `yes` in the text box to confirm you want to delete the resource, and then select **Delete**.
356370
1. Delete the resource group by selecting **Delete resource group**, typing in the name of the resource group `myResourceGroup`, and then selecting **Delete**.
357371

@@ -383,12 +397,12 @@ Using a forward slash instead of backslash in the file path for the file share c
383397

384398
### Couldn't connect to Subscriber
385399

386-
```error-text
400+
```output
387401
The process could not connect to Subscriber 'SQL-VM-SUBSCRIBER
388402
Could not open a connection to SQL Server [53].
389403
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.
390404
```
391-
T
405+
392406
Possible solutions:
393407

394408
- Ensure port 1433 is open.

0 commit comments

Comments
 (0)