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
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.
21
20
@@ -27,14 +26,13 @@ In this tutorial, you learn how to:
27
26
> - Grant server roles to a Microsoft Entra user
28
27
> - Disable a Microsoft Entra login
29
28
30
-
> [!NOTE]
29
+
> [!NOTE]
31
30
> Microsoft Entra server principals (logins) are currently in public preview for Azure SQL Database. Azure SQL Managed Instance can already utilize Microsoft Entra logins.
32
31
33
-
34
32
## Prerequisites
35
33
36
34
- 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).
38
36
- 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.
39
37
40
38
<aname='create-azure-ad-login'></a>
@@ -43,7 +41,7 @@ In this tutorial, you learn how to:
43
41
44
42
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).
45
43
46
-
> [!NOTE]
44
+
> [!NOTE]
47
45
> 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.
48
46
49
47
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:
58
56
1. Check the created login in `sys.server_principals`. Execute the following query:
59
57
60
58
```sql
61
-
SELECT name, type_desc, type, is_disabled
59
+
SELECT name, type_desc, type, is_disabled
62
60
FROMsys.server_principals
63
-
WHERE type_desc like'external%'
61
+
WHERE type_desc like'external%'
64
62
```
65
63
66
64
You would see a similar output to the following:
67
65
68
66
```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
71
69
```
72
70
73
71
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:
85
83
CREATE USER [bob@contoso.com] FROM LOGIN [bob@contoso.com]
86
84
```
87
85
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.
90
88
91
89
1. Check the created user in `sys.database_principals`. Execute the following query:
92
90
93
91
```sql
94
-
SELECT name, type_desc, type
95
-
FROMsys.database_principals
92
+
SELECT name, type_desc, type
93
+
FROMsys.database_principals
96
94
WHERE type_desc like'external%'
97
95
```
98
96
@@ -103,18 +101,20 @@ In this tutorial, you learn how to:
103
101
bob@contoso.com EXTERNAL_USER E
104
102
```
105
103
106
-
> [!NOTE]
104
+
> [!NOTE]
107
105
> 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.
108
106
>
109
107
> 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)
## Grant server-level roles to Microsoft Entra logins
114
114
115
115
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.
116
116
117
-
> [!NOTE]
117
+
> [!NOTE]
118
118
> The server-level roles mentioned here are not supported for Microsoft Entra groups.
119
119
120
120
```sql
@@ -133,7 +133,7 @@ Permissions aren't effective until the user reconnects. Flush the DBCC cache as
133
133
134
134
```sql
135
135
DBCC FLUSHAUTHCACHE
136
-
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
136
+
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
137
137
```
138
138
139
139
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,
@@ -154,18 +154,18 @@ SELECT roles.principal_id AS RolePID,roles.name AS RolePName,
154
154
155
155
[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.
156
156
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.
158
158
159
159
To add a user to a role, you can run the following query:
160
160
161
161
```sql
162
-
ALTER ROLE [dbmanager] ADD MEMBER [AzureAD_object]
162
+
ALTER ROLE [dbmanager] ADD MEMBER [AzureAD_object]
163
163
```
164
164
165
165
To remove a user from a role, run the following query:
166
166
167
167
```sql
168
-
ALTER ROLE [dbmanager] DROP MEMBER [AzureAD_object]
168
+
ALTER ROLE [dbmanager] DROP MEMBER [AzureAD_object]
169
169
```
170
170
171
171
`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 *
175
175
1. Run the following query:
176
176
177
177
```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]
180
180
```
181
181
182
182
1. Check the database role assignment by running the following query:
183
183
184
184
```sql
185
-
SELECTDP1.nameAS DatabaseRoleName,
186
-
isnull (DP2.name, 'No members') AS DatabaseUserName
187
-
FROMsys.database_role_membersAS DRM
188
-
RIGHT OUTER JOINsys.database_principalsAS DP1
189
-
ONDRM.role_principal_id=DP1.principal_id
190
-
LEFT OUTER JOINsys.database_principalsAS DP2
191
-
ONDRM.member_principal_id=DP2.principal_id
192
-
WHEREDP1.type='R'andDP2.namelike'bob%'
185
+
SELECTDP1.nameAS DatabaseRoleName,
186
+
isnull (DP2.name, 'No members') AS DatabaseUserName
187
+
FROMsys.database_role_membersAS DRM
188
+
RIGHT OUTER JOINsys.database_principalsAS DP1
189
+
ONDRM.role_principal_id=DP1.principal_id
190
+
LEFT OUTER JOINsys.database_principalsAS DP2
191
+
ONDRM.member_principal_id=DP2.principal_id
192
+
WHEREDP1.type='R'andDP2.namelike'bob%'
193
193
```
194
194
195
195
You would see a similar output to the following:
196
196
197
197
```output
198
-
DatabaseRoleName DatabaseUserName
198
+
DatabaseRoleName DatabaseUserName
199
199
dbmanager bob@contoso.com
200
200
loginmanager bob@contoso.com
201
201
```
@@ -212,22 +212,20 @@ For the `DISABLE` or `ENABLE` changes to take immediate effect, the authenticati
212
212
213
213
```sql
214
214
DBCC FLUSHAUTHCACHE
215
-
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
215
+
DBCC FREESYSTEMCACHE('TokenAndPermUserStore') WITH NO_INFOMSGS
216
216
```
217
217
218
218
Check that the login has been disabled by executing the following query:
219
219
220
220
```sql
221
-
SELECT name, type_desc, type
222
-
FROMsys.server_principals
221
+
SELECT name, type_desc, type
222
+
FROMsys.server_principals
223
223
WHERE is_disabled =1
224
224
```
225
225
226
226
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.
227
227
228
-
## See also
229
-
230
-
For more information and examples, see:
228
+
## Related content
231
229
232
230
-[Microsoft Entra server principals](authentication-azure-ad-logins.md)
Copy file name to clipboardExpand all lines: azure-sql/managed-instance/log-replay-service-migrate.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,9 @@ To achieve a predictable time for database migrations, consider configuring a [m
88
88
> - LRS doesn't support read-only access to databases during the migration.
89
89
> - After the migration finishes, the migration process is final and can't be resumed with additional differential backups.
90
90
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
+
91
94
## Migrate multiple databases
92
95
93
96
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.
Copy file name to clipboardExpand all lines: azure-sql/managed-instance/log-replay-service-overview.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ To get started, review [Migrate databases from SQL Server to Azure SQL Managed I
22
22
23
23
## When to use Log Replay Service
24
24
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.
26
26
27
27
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.
28
28
@@ -51,7 +51,6 @@ The following sources are supported:
51
51
> - 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.
52
52
> - 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.
53
53
54
-
55
54
## How LRS works
56
55
57
56
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
108
107
|**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. |
109
108
| **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). |
110
109
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
+
111
113
### Migrating large databases
112
114
113
115
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
116
118
- 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.
117
119
- 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.
118
120
119
-
120
121
## Start the migration
121
122
122
123
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