Skip to content

Commit 5089618

Browse files
committed
Merge branch 'main' into release-arc-data
2 parents 9d45ca6 + baf8a2c commit 5089618

22 files changed

Lines changed: 2486 additions & 4964 deletions

azure-sql/database/authentication-azure-ad-logins-tutorial.md

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ description: This article guides you through creating and utilizing Microsoft En
55
author: nofield
66
ms.author: nofield
77
ms.reviewer: vanto, mathoma
8-
ms.date: 09/27/2023
8+
ms.date: 06/11/2024
99
ms.service: sql-db-mi
1010
ms.subservice: security
1111
ms.topic: tutorial
12-
monikerRange: "= azuresql || = azuresql-db || = azuresql-mi"
12+
monikerRange: "=azuresql || =azuresql-db || =azuresql-mi"
1313
---
1414

1515
# Tutorial: Create and utilize Microsoft Entra server logins
1616

17-
[!INCLUDE[appliesto-sqldb-sqlmi-asa-dedicated-only](../includes/appliesto-sqldb-sqlmi-asa-dedicated-only.md)]
18-
17+
[!INCLUDE [appliesto-sqldb-sqlmi-asa-dedicated-only](../includes/appliesto-sqldb-sqlmi-asa-dedicated-only.md)]
1918

2019
This article guides you through creating and utilizing [logins](authentication-azure-ad-logins.md) backed by Microsoft Entra ID ([formerly Azure Active Directory](/entra/fundamentals/new-name)) within the virtual `master` database of Azure SQL.
2120

@@ -27,14 +26,13 @@ In this tutorial, you learn how to:
2726
> - Grant server roles to a Microsoft Entra user
2827
> - Disable a Microsoft Entra login
2928
30-
> [!NOTE]
29+
> [!NOTE]
3130
> Microsoft Entra server principals (logins) are currently in public preview for Azure SQL Database. Azure SQL Managed Instance can already utilize Microsoft Entra logins.
3231
33-
3432
## Prerequisites
3533

3634
- A SQL Database or SQL Managed Instance with a database. See [Quickstart: Create an Azure SQL Database single database](single-database-create-quickstart.md) if you haven't already created an Azure SQL Database, or [Quickstart: Create an Azure SQL Managed Instance](../managed-instance/instance-create-quickstart.md).
37-
- Microsoft Entra authentication set up for SQL Database or Managed Instance. For more information, see [Configure and manage Microsoft Entra authentication with Azure SQL](authentication-aad-configure.md).
35+
- Microsoft Entra authentication set up for SQL Database or SQL Managed Instance. For more information, see [Configure and manage Microsoft Entra authentication with Azure SQL](authentication-aad-configure.md).
3836
- This article instructs you on creating a Microsoft Entra login and user within the virtual `master` database. Only a Microsoft Entra admin can create a user within the virtual `master` database, so we recommend you use the Microsoft Entra admin account when going through this tutorial. A Microsoft Entra principal with the `loginmanager` role can create a login, but not a user within the virtual `master` database.
3937

4038
<a name='create-azure-ad-login'></a>
@@ -43,7 +41,7 @@ In this tutorial, you learn how to:
4341

4442
1. Create an Azure SQL Database login for a Microsoft Entra account. In our example, we'll use `bob@contoso.com` that exists in our Microsoft Entra domain called `contoso`. A login can also be created from a Microsoft Entra group or [service principal (applications)](authentication-aad-service-principal.md). For example, `mygroup` that is a Microsoft Entra group consisting of Microsoft Entra accounts that are a member of that group. For more information, see [CREATE LOGIN (Transact-SQL)](/sql/t-sql/statements/create-login-transact-sql?view=azuresqldb-current&preserve-view=true).
4543

46-
> [!NOTE]
44+
> [!NOTE]
4745
> The first Microsoft Entra login must be created by the Microsoft Entra admin. The Microsoft Entra admin can be a Microsoft Entra user or group. A SQL login cannot create Microsoft Entra logins.
4846
4947
1. Using [SQL Server Management Studio (SSMS)](/sql/ssms/download-sql-server-management-studio-ssms), log into your SQL Database with the Microsoft Entra admin account set up for the server.
@@ -58,16 +56,16 @@ In this tutorial, you learn how to:
5856
1. Check the created login in `sys.server_principals`. Execute the following query:
5957

6058
```sql
61-
SELECT name, type_desc, type, is_disabled
59+
SELECT name, type_desc, type, is_disabled
6260
FROM sys.server_principals
63-
WHERE type_desc like 'external%'
61+
WHERE type_desc like 'external%'
6462
```
6563

6664
You would see a similar output to the following:
6765

6866
```output
69-
Name type_desc type is_disabled
70-
bob@contoso.com EXTERNAL_LOGIN E 0
67+
Name type_desc type is_disabled
68+
bob@contoso.com EXTERNAL_LOGIN E 0
7169
```
7270

7371
1. The login `bob@contoso.com` has been created in the virtual `master` database.
@@ -85,14 +83,14 @@ In this tutorial, you learn how to:
8583
CREATE USER [bob@contoso.com] FROM LOGIN [bob@contoso.com]
8684
```
8785

88-
> [!TIP]
89-
> Although it is not required to use Microsoft Entra user aliases (for example, `bob@contoso.com`), it is a recommended best practice to use the same alias for Microsoft Entra users and Microsoft Entra logins.
86+
> [!TIP]
87+
> Although it is not required to use Microsoft Entra user aliases (for example, `bob@contoso.com`), it is a recommended best practice to use the same alias for Microsoft Entra users and Microsoft Entra logins.
9088
9189
1. Check the created user in `sys.database_principals`. Execute the following query:
9290

9391
```sql
94-
SELECT name, type_desc, type
95-
FROM sys.database_principals
92+
SELECT name, type_desc, type
93+
FROM sys.database_principals
9694
WHERE type_desc like 'external%'
9795
```
9896

@@ -103,18 +101,20 @@ In this tutorial, you learn how to:
103101
bob@contoso.com EXTERNAL_USER E
104102
```
105103

106-
> [!NOTE]
104+
> [!NOTE]
107105
> The existing syntax to create a Microsoft Entra user without a Microsoft Entra login is still supported. Executing the following syntax creates a database contained user inside the specific database you are connected to. Importantly, this user is not associated to any login, even if a login of the same name exists in the virtual `master` database.
108106
>
109107
> For example, `CREATE USER [bob@contoso.com] FROM EXTERNAL PROVIDER`.
108+
>
109+
> You can create a Microsoft Entra login using a service principal with a nonunique display name. For more information, see [Microsoft Entra logins and users with nonunique display names](authentication-microsoft-entra-create-users-with-nonunique-names.md)
110110
111111
<a name='grant-server-level-roles-to-azure-ad-logins'></a>
112112

113113
## Grant server-level roles to Microsoft Entra logins
114114

115115
You can add logins to the [fixed server-level roles](security-server-roles.md#fixed-server-level-roles), such as the **##MS_DefinitionReader##**, **##MS_ServerStateReader##**, or **##MS_ServerStateManager##** role.
116116

117-
> [!NOTE]
117+
> [!NOTE]
118118
> The server-level roles mentioned here are not supported for Microsoft Entra groups.
119119
120120
```sql
@@ -133,7 +133,7 @@ Permissions aren't effective until the user reconnects. Flush the DBCC cache as
133133

134134
```sql
135135
DBCC FLUSHAUTHCACHE
136-
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
136+
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
137137
```
138138

139139
To check which Microsoft Entra logins are part of server-level roles, run the following query:
@@ -144,7 +144,7 @@ SELECT roles.principal_id AS RolePID,roles.name AS RolePName,
144144
FROM sys.server_role_members AS server_role_members
145145
INNER JOIN sys.server_principals AS roles
146146
ON server_role_members.role_principal_id = roles.principal_id
147-
INNER JOIN sys.server_principals AS members
147+
INNER JOIN sys.server_principals AS members
148148
ON server_role_members.member_principal_id = members.principal_id;
149149
```
150150

@@ -154,18 +154,18 @@ SELECT roles.principal_id AS RolePID,roles.name AS RolePName,
154154

155155
[Special roles for SQL Database](/sql/relational-databases/security/authentication-access/database-level-roles#special-roles-for--and-azure-synapse) can be assigned to users in the virtual `master` database.
156156

157-
In order to grant one of the special database roles to a user, the user must exist in the virtual `master` database.
157+
In order to grant one of the special database roles to a user, the user must exist in the virtual `master` database.
158158

159159
To add a user to a role, you can run the following query:
160160

161161
```sql
162-
ALTER ROLE [dbmanager] ADD MEMBER [AzureAD_object]
162+
ALTER ROLE [dbmanager] ADD MEMBER [AzureAD_object]
163163
```
164164

165165
To remove a user from a role, run the following query:
166166

167167
```sql
168-
ALTER ROLE [dbmanager] DROP MEMBER [AzureAD_object]
168+
ALTER ROLE [dbmanager] DROP MEMBER [AzureAD_object]
169169
```
170170

171171
`AzureAD_object` can be a Microsoft Entra user, group, or service principal in Microsoft Entra ID.
@@ -175,27 +175,27 @@ In our example, we created the user `bob@contoso.com`. Let's give the user the *
175175
1. Run the following query:
176176

177177
```sql
178-
ALTER ROLE [dbmanager] ADD MEMBER [bob@contoso.com]
179-
ALTER ROLE [loginmanager] ADD MEMBER [bob@contoso.com]
178+
ALTER ROLE [dbmanager] ADD MEMBER [bob@contoso.com]
179+
ALTER ROLE [loginmanager] ADD MEMBER [bob@contoso.com]
180180
```
181181

182182
1. Check the database role assignment by running the following query:
183183

184184
```sql
185-
SELECT DP1.name AS DatabaseRoleName,
186-
isnull (DP2.name, 'No members') AS DatabaseUserName
187-
FROM sys.database_role_members AS DRM
188-
RIGHT OUTER JOIN sys.database_principals AS DP1
189-
ON DRM.role_principal_id = DP1.principal_id
190-
LEFT OUTER JOIN sys.database_principals AS DP2
191-
ON DRM.member_principal_id = DP2.principal_id
192-
WHERE DP1.type = 'R'and DP2.name like 'bob%'
185+
SELECT DP1.name AS DatabaseRoleName,
186+
isnull (DP2.name, 'No members') AS DatabaseUserName
187+
FROM sys.database_role_members AS DRM
188+
RIGHT OUTER JOIN sys.database_principals AS DP1
189+
ON DRM.role_principal_id = DP1.principal_id
190+
LEFT OUTER JOIN sys.database_principals AS DP2
191+
ON DRM.member_principal_id = DP2.principal_id
192+
WHERE DP1.type = 'R'and DP2.name like 'bob%'
193193
```
194194

195195
You would see a similar output to the following:
196196

197197
```output
198-
DatabaseRoleName DatabaseUserName
198+
DatabaseRoleName DatabaseUserName
199199
dbmanager bob@contoso.com
200200
loginmanager bob@contoso.com
201201
```
@@ -212,22 +212,20 @@ For the `DISABLE` or `ENABLE` changes to take immediate effect, the authenticati
212212

213213
```sql
214214
DBCC FLUSHAUTHCACHE
215-
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
215+
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
216216
```
217217

218218
Check that the login has been disabled by executing the following query:
219219

220220
```sql
221-
SELECT name, type_desc, type
222-
FROM sys.server_principals
221+
SELECT name, type_desc, type
222+
FROM sys.server_principals
223223
WHERE is_disabled = 1
224224
```
225225

226226
A use case for this would be to allow read-only on [geo-replicas](active-geo-replication-overview.md), but deny connection on a primary server.
227227

228-
## See also
229-
230-
For more information and examples, see:
228+
## Related content
231229

232230
- [Microsoft Entra server principals](authentication-azure-ad-logins.md)
233231
- [CREATE LOGIN (Transact-SQL)](/sql/t-sql/statements/create-login-transact-sql?view=azuresqldb-current&preserve-view=true)

azure-sql/managed-instance/log-replay-service-migrate.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ To achieve a predictable time for database migrations, consider configuring a [m
8888
> - LRS doesn't support read-only access to databases during the migration.
8989
> - After the migration finishes, the migration process is final and can't be resumed with additional differential backups.
9090
91+
> [!NOTE]
92+
> After the cutover, SQL Managed Instance with Business Critical service tier can take significantly longer than General Purpose to be available as three secondary replicas have to be seeded for the availability group. The operation duration depends on the size of data. For more information, see [Management operations duration](/azure/azure-sql/managed-instance/management-operations-overview#duration).
93+
9194
## Migrate multiple databases
9295

9396
If you're migrating multiple databases by using the same Azure Blob Storage container, you must place backup files for different databases in separate folders inside the container. All backup files for a single database must be placed in a flat-file structure inside a database folder, and the folders can't be nested. Nesting folders inside database folders isn't supported.

azure-sql/managed-instance/log-replay-service-overview.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To get started, review [Migrate databases from SQL Server to Azure SQL Managed I
2222

2323
## When to use Log Replay Service
2424

25-
[Azure Database Migration Service](/azure/dms/tutorial-sql-server-to-managed-instance), the [Azure SQL migration extension for Azure Data Studio](/azure-data-studio/extensions/azure-sql-migration-extension), and LRS all use the same underlying migration technology and APIs. LRS further enables complex custom migrations and hybrid architectures between on-premises SQL Server instances and SQL Managed Instance deployments.
25+
[Azure Database Migration Service](/azure/dms/tutorial-sql-server-managed-instance-online), the [Azure SQL migration extension for Azure Data Studio](/azure-data-studio/extensions/azure-sql-migration-extension), and LRS all use the same underlying migration technology and APIs. LRS further enables complex custom migrations and hybrid architectures between on-premises SQL Server instances and SQL Managed Instance deployments.
2626

2727
When you can't use Azure Database Migration Service, or the Azure SQL extension for migration, you can use LRS directly with PowerShell, Azure CLI cmdlets, or APIs to manually build and orchestrate database migrations to SQL Managed Instance.
2828

@@ -51,7 +51,6 @@ The following sources are supported:
5151
> - We recommend that you automate the migration of databases from SQL Server to Azure SQL Managed Instance by using the Azure SQL migration extension for Azure Data Studio. Consider using LRS to orchestrate migrations when the Azure SQL migration extension doesn't fully support your scenarios.
5252
> - LRS is the only method to restore differential backups on managed instances. It isn't possible to manually restore differential backups on managed instances or to manually set the `NORECOVERY` mode by using T-SQL.
5353
54-
5554
## How LRS works
5655

5756
Building a custom solution to migrate databases to the cloud with LRS requires several orchestration steps, as shown in the diagram and table later in this section.
@@ -108,6 +107,9 @@ Use continuous mode migration when you don't have the entire backup chain in adv
108107
| **2.2. Stop the operation if required (optional)**. | If you need to stop the migration process, use PowerShell ([stop-azsqlinstancedatabaselogreplay](/powershell/module/az.sql/stop-azsqlinstancedatabaselogreplay)) or the Azure CLI ([az_sql_midb_log_replay_stop](/cli/azure/sql/midb/log-replay#az-sql-midb-log-replay-stop)). <br /><br /> Stopping the operation deletes the database that you're restoring to SQL Managed Instance. After you stop an operation, you can't resume LRS for a database. You need to restart the migration process from the beginning. |
109108
| **3. Cut over to the cloud when you're ready**. | If LRS was started in autocomplete mode, the migration automatically finishes after the specified last backup file has been restored. <br /><br /> If LRS was started in continuous mode, stop the application and workload. Take the last log-tail backup and upload it to the Azure Blob Storage deployment. Ensure that the last log-tail backup has been restored on the managed instance. Complete the cutover by initiating an LRS `complete` operation with PowerShell ([complete-azsqlinstancedatabaselogreplay](/powershell/module/az.sql/complete-azsqlinstancedatabaselogreplay)) or the Azure CLI [az_sql_midb_log_replay_complete](/cli/azure/sql/midb/log-replay#az-sql-midb-log-replay-complete). This operation stops LRS and brings the database online for read/write workloads on SQL Managed Instance. <br /><br /> Repoint the application connection string from the SQL Server instance to SQL Managed Instance. You need to orchestrate this step yourself, either through a manual connection string change in your application, or automatically (for example, if your application can read the connection string from a property, or a database). |
110109

110+
> [!IMPORTANT]
111+
> After the cutover, SQL Managed Instance with Business Critical service tier can take significantly longer than General Purpose to be available as three secondary replicas have to be seeded for the availability group. The operation duration depends on the size of data. For more information, see [Management operations duration](/azure/azure-sql/managed-instance/management-operations-overview#duration).
112+
111113
### Migrating large databases
112114

113115
If you're migrating large databases of several terabytes in size, consider the following:
@@ -116,7 +118,6 @@ If you're migrating large databases of several terabytes in size, consider the f
116118
- Migration jobs that are interrupted by system updates are automatically suspended and resumed for General Purpose managed instances, and they're restarted for Business Critical managed instances. These updates will affect the timeframe of your migration.
117119
- To increase the upload speed of your SQL Server backup files to the Blob Storage account, if your infrastructure has sufficient network bandwidth, consider using parallelization with multiple threads.
118120

119-
120121
## Start the migration
121122

122123
You start the migration by starting LRS. You can start the service in either autocomplete or continuous mode. For specific details, review [Migrate with LRS](log-replay-service-migrate.md).

0 commit comments

Comments
 (0)