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/database/hyperscale-named-replica-security-configure.md
+42-31Lines changed: 42 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,37 +1,42 @@
1
1
---
2
-
title: Configure Hyperscale named replicas security to allow isolated access
2
+
title: Configure Hyperscale Named Replicas Security to Allow Isolated Access
3
3
description: Learn the security considerations for configuring and managing Hyperscale named replicas so that a user can access the named replica but not other replicas.
4
4
author: WilliamDAssafMSFT
5
5
ms.author: wiassaf
6
-
ms.reviewer: atsingh, vanto
7
-
ms.date: 02/26/2024
6
+
ms.reviewer: atsingh, vanto, randolphwest
7
+
ms.date: 01/02/2026
8
8
ms.service: azure-sql-database
9
9
ms.subservice: scale-out
10
10
ms.topic: how-to
11
11
---
12
12
# Configure isolated access for Hyperscale named replicas
This article describes the procedure to grant access to an Azure SQL Database Hyperscale [named replica](service-tier-hyperscale-replicas.md) without granting access to the primary replica or other named replicas. This scenario allows resource and security isolation of a named replica - as the named replica will be running using its own compute node - and it is useful whenever isolated read-only access to an Azure SQL Hyperscale database is needed. Isolated, in this context, means that CPU and memory are not shared between the primary and the named replica, queries running on the named replica do not use compute resources of the primary or of any other replicas, and principals accessing the named replica cannot access other replicas, including the primary.
16
+
This article describes the procedure to grant access to an Azure SQL Database Hyperscale [named replica](service-tier-hyperscale-replicas.md) without granting access to the primary replica or other named replicas. This scenario allows resource and security isolation of a named replica - as the named replica will be running using its own compute node - and it's useful whenever isolated read-only access to an Azure SQL Hyperscale database is needed. Isolated, in this context, means that CPU and memory aren't shared between the primary and the named replica, queries running on the named replica don't use compute resources of the primary or of any other replicas, and principals accessing the named replica can't access other replicas, including the primary.
16
17
17
18
[!INCLUDE [entra-id](../includes/entra-id.md)]
18
19
19
-
## <aid="create-a-login-in-the-master-database-on-the-primary-server"></a> Create a login on the primary server
@@ -66,21 +73,20 @@ ALTER LOGIN [bob@contoso.com] DISABLE;
66
73
67
74
---
68
75
69
-
70
76
## Create a user in the primary read-write database
71
77
72
-
Once the login has been created, connect to the primary read-write replica of your database, for exampleWideWorldImporters (you can find a sample script to restore it here: [Restore Database in Azure SQL](https://github.com/yorek/azure-sql-db-samples/tree/master/samples/01-restore-database)) and create a database user for that login:
78
+
Once the login has been created, connect to the primary read-write replica of your database. For example, restore `WideWorldImporters` with the details available in [Installation and configuration](/sql/samples/wide-world-importers-oltp-install-configure). Then, create a database user for that login:
73
79
74
80
# [SQL authentication](#tab/SQL-Authentication)
75
81
76
82
```sql
77
-
CREATE USER [third-party-user] FROM LOGIN [third-party-login];
83
+
CREATE USER [third-party-user] FOR LOGIN [third-party-login];
CREATE USER [bob@contoso.com] FROM LOGIN [bob@contoso.com];
89
+
CREATE USER [bob@contoso.com] FOR LOGIN [bob@contoso.com];
84
90
```
85
91
86
92
---
@@ -105,10 +111,10 @@ DROP LOGIN [bob@contoso.com];
105
111
106
112
Create a new Azure SQL logical server that to be used to isolate access to the named replica. Follow the instructions available at [Create and manage servers and single databases in Azure SQL Database](single-database-manage.md). To create a named replica, this server must be in the same Azure region as the server hosting the primary replica.
107
113
108
-
In the following sample, replace `strong_password_here` with your strong password. For example, using Azure CLI:
114
+
Replace `<password>` with a strong password. For example, using Azure CLI:
109
115
110
116
```azurecli
111
-
az sql server create -g MyResourceGroup -n MyNamedReplicaServer -l MyLocation --admin-user MyAdminUser --admin-password strong_password_here
117
+
az sql server create -g MyResourceGroup -n MyNamedReplicaServer -l MyLocation --admin-user MyAdminUser --admin-password <password>
112
118
```
113
119
114
120
Then, create a named replica for the primary database on this server. For example, using Azure CLI:
@@ -117,22 +123,25 @@ Then, create a named replica for the primary database on this server. For exampl
117
123
az sql db replica create -g MyResourceGroup -n WideWorldImporters -s MyPrimaryServer --secondary-type Named --partner-database WideWorldImporters_NR --partner-server MyNamedReplicaServer
118
124
```
119
125
120
-
## <aid="create-a-login-in-the-master-database-on-the-named-replica-server"></a> Create a login on the named replica server
Connect to the `master` database on the logical server hosting the named replica, created in the previous step. Replace `strong_password_here` with your strong password. Add the login using the SID retrieved from the primary replica:
132
+
Connect to the `master` database on the logical server hosting the named replica, created in the previous step. Replace `<password>` with a strong password. Add the login using the SID retrieved from the primary replica:
125
133
126
134
```sql
127
-
CREATE LOGIN [third-party-login] WITH PASSWORD ='strong_password_here', sid = 0x0...1234;
135
+
CREATE LOGIN [third-party-login] WITH PASSWORD ='<password>', sid = 0x0...1234;
Connect to the `master` database on the logical server hosting the named replica, created in the previous step and add the login.
133
141
134
142
```sql
135
-
CREATE LOGIN [bob@contoso.com] FROM EXTERNAL PROVIDER;
143
+
CREATE LOGIN [bob@contoso.com]
144
+
FROM EXTERNAL PROVIDER;
136
145
```
137
146
138
147
---
@@ -143,18 +152,20 @@ At this point, users and applications using `third-party-login` or `bob@contoso.
143
152
144
153
Once you have set up login authentication as described, you can use regular `GRANT`, `DENY` and `REVOKE` statements to manage authorization, or object-level permissions within the database. In these statements, reference the name of the user you created in the database, or a database role that includes this user as a member. Remember to execute these commands on the primary replica. The changes propagate to all secondary replicas, but they will only be effective on the named replica where the server-level login was created.
145
154
146
-
Remember that by default a newly created user has a minimal set of permissions granted (for example, it cannot access any user tables). If you want to allow `third-party-user` or `bob@contoso.com` to read data in a table, you need to explicitly grant the `SELECT` permission:
155
+
Remember that by default a newly created user has a minimal set of permissions granted (for example, it can't access any user tables). If you want to allow `third-party-user` or `bob@contoso.com` to read data in a table, you need to explicitly grant the `SELECT` permission:
147
156
148
157
# [SQL authentication](#tab/SQL-Authentication)
149
158
150
159
```sql
151
-
GRANTSELECTON [Application].[Cities] to [third-party-user];
GRANTSELECTON [Application].[Cities] to [bob@contoso.com];
167
+
GRANTSELECT
168
+
ON [Application].[Cities] TO [bob@contoso.com];
158
169
```
159
170
160
171
---
@@ -163,29 +174,29 @@ As an alternative to granting permissions individually on every table, you can a
163
174
164
175
## Test access
165
176
166
-
You can test this configuration by using any client tool and attempt to connect to the primary and the named replica. For example, using `sqlcmd`, you can try to connect to the primary replica using the `third-party-login` user. Replace `strong_password_here` with your strong password.
177
+
You can test this configuration by using any client tool and attempt to connect to the primary and the named replica. For example, using `sqlcmd`, you can try to connect to the primary replica using the `third-party-login` user. Replace `<password>` with a strong password.
0 commit comments