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/authentication-aad-service-principal.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Azure Active Directory (Azure AD) supports user creation in Azure SQL Database (
19
19
20
20
## Service principal (Azure AD applications) support
21
21
22
-
This article applies to applications that are integrated with Azure AD, and are part of Azure AD registration. These applications often need authentication and authorization access to Azure SQL to perform various tasks. This feature allows service principals to create Azure AD users in SQL Database. There was a limitation preventing Azure AD object creation on behalf of Azure AD applications that was removed.
22
+
This article applies to applications that are integrated with Azure AD, and are part of Azure AD registration. These applications often need authentication and authorization access to Azure SQL to perform various tasks. This feature allows service principals to create Azure AD users in SQL Database.
23
23
24
24
When an Azure AD application is registered using the Azure portal or a PowerShell command, two objects are created in the Azure AD tenant:
25
25
@@ -34,7 +34,7 @@ SQL Database and SQL Managed Instance support the following Azure AD objects:
34
34
- Azure AD groups (managed and federated)
35
35
- Azure AD applications
36
36
37
-
The T-SQL command `CREATE USER [Azure_AD_Object] FROM EXTERNAL PROVIDER`on behalf of an Azure AD application is now supported for SQL Database.
37
+
Azure AD users, groups, and applications can all be created on a database using the T-SQL command `CREATE USER [Azure_AD_Object] FROM EXTERNAL PROVIDER`.
38
38
39
39
## Functionality of Azure AD user creation using service principals
40
40
@@ -44,7 +44,7 @@ Supporting this functionality is useful in Azure AD application automation proce
44
44
45
45
To enable an Azure AD object creation in SQL Database on behalf of an Azure AD application, the following settings are required:
46
46
47
-
1. Assign the server identity. The assigned server identity represents the Managed Service Identity (MSI). The server identity can be system-assigned or user-assigned managed identity. For more information, see [User-assigned managed identity in Azure AD for Azure SQL](authentication-azure-ad-user-assigned-managed-identity.md).
47
+
1. Assign the server identity. The assigned server identity represents the Managed Service Identity (MSI). The server identity can be a system-assigned or user-assigned managed identity. For more information, see [User-assigned managed identity in Azure AD for Azure SQL](authentication-azure-ad-user-assigned-managed-identity.md).
48
48
- For a new Azure SQL logical server, execute the following PowerShell command:
49
49
50
50
```powershell
@@ -88,7 +88,7 @@ To enable an Azure AD object creation in SQL Database on behalf of an Azure AD a
88
88
Directory Reader permission to your identity" (https://aka.ms/sqlaadsetup)'"`
89
89
- For the above error, follow the steps to [Assign an identity to the Azure SQL logical server](authentication-aad-service-principal-tutorial.md#assign-an-identity-to-the-azure-sql-logical-server) and [Assign Directory Readers permission to the SQL logical server identity](authentication-aad-service-principal-tutorial.md#assign-directory-readers-permission-to-the-sql-logical-server-identity).
90
90
- Setting the service principal (Azure AD application) as an Azure AD admin for SQL Database is supported using the Azure portal, [PowerShell](authentication-aad-configure.md?tabs=azure-powershell#powershell-for-sql-database-and-azure-synapse), [REST API](/rest/api/sql/2020-08-01-preview/servers), and [CLI](authentication-aad-configure.md?tabs=azure-cli#powershell-for-sql-database-and-azure-synapse) commands.
91
-
- Using an Azure AD application with service principal from another Azure AD tenant will fail when accessing SQL Database or SQL Managed Instance created in a different tenant. A service principal assigned to this application must be from the same tenant as the SQL logical server or Managed Instance.
91
+
- Using an Azure AD application with service principal from another Azure AD tenant will fail when accessing SQL Database or SQL Managed Instance created in a different tenant. A service principal assigned to this application must be from the same tenant as the SQL logical server or SQL Managed Instance.
92
92
- [Az.Sql 2.9.0](https://www.powershellgallery.com/packages/Az.Sql/2.9.0) module or higher is needed when using PowerShell to set up an individual Azure AD application as Azure AD admin for Azure SQL. Ensure you are upgraded to the latest module.
Copy file name to clipboardExpand all lines: docs/relational-databases/security/authentication-access/azure-ad-authentication-sql-server-overview.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,9 @@ You can now connect to SQL Server using the following authentication methods usi
24
24
- Azure Active Directory Password
25
25
- Azure Active Directory Integrated
26
26
- Azure Active Directory Universal with Multi-Factor Authentication
27
+
- Azure Active Directory Service Principal
28
+
- Azure Active Directory Managed Identity
29
+
- Azure Active Directory Default
27
30
- Azure Active Directory access token
28
31
29
32
The current authentication modes, such as [SQL authentication and Windows authentication](../choose-an-authentication-mode.md) remain unchanged.
@@ -48,12 +51,27 @@ Allows specifying the username and password to the client and driver, but this i
48
51
49
52
### Azure Active Directory Integrated
50
53
51
-
When the Windows domain is synchronized with Azure AD, and a user is logged into the Windows domain, the user's Windows credentials are used for Azure AD authentication.
54
+
When the Windows domain is synchronized with Azure AD and a user is logged into the Windows domain, the user's Windows credentials are used for Azure AD authentication.
52
55
53
56
### Azure Active Directory Universal with Multi-Factor Authentication
54
57
55
58
This is the standard interactive method with multi-factor authentication option for Azure AD accounts. This will work in most scenarios.
56
59
60
+
### Azure Active Directory Service Principal
61
+
62
+
A service principal is an identity that can be created for use with automated tools, jobs and applications. With the Service Principal authentication method, you can connect to your SQL instance using the client ID and secret of a service principal identity.
63
+
64
+
### Azure Active Directory Managed Identity
65
+
66
+
Managed identities are special forms of service principals. There are two types of managed identities: system-assigned and user-assigned. System-assigned managed identities are enabled directly on an Azure resource, whereas user-assigned managed identities are a standalone resource that can be assigned to one or more Azure resources.
67
+
68
+
> [!Note]
69
+
> In order to use a managed identity to connect to a SQL resource through GUI clients such as SSMS and ADS, the machine running the client application must have an Azure AD client running with the identity's certificate stored in it. This is most commonly achieved through an Azure VM, as the identity can be easily assigned to the machine through the VM's portal blade.
70
+
71
+
### Azure Active Directory Default
72
+
73
+
The Default authentication option with Azure Active Directory enables authentication that's performed through password-less and non-interactive mechanisms including Managed Identities, Visual Studio, Visual Studio Code, Azure CLI, and more.
74
+
57
75
### Azure Active Directory access token
58
76
59
77
Some non-GUI clients such as [Invoke-sqlcmd](/powershell/module/sqlserver/invoke-sqlcmd) allow providing an access token. The scope or audience of the access token must be `https://database.windows.net/`.
Copy file name to clipboardExpand all lines: docs/relational-databases/security/authentication-access/azure-ad-authentication-sql-server-setup-tutorial.md
+25-24Lines changed: 25 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,12 +40,12 @@ In this tutorial, you learn how to:
40
40
> [!NOTE]
41
41
> Extended functionality has been implemented in Azure to allow the automatic creation of the Azure Key Vault certificate and Azure AD application during setting up an Azure AD admin for the SQL Server. For more information, see [Tutorial: Using automation to set up the Azure Active Directory admin for SQL Server](azure-ad-authentication-sql-server-automation-setup-tutorial.md).
42
42
43
-
-To perform Azure AD authentication, SQL Server needs to be able to query Azure AD and requires an Azure AD app registration, which it can authenticate as. The app registration also needs a handful of permissions for the queries SQL Server will perform.
43
+
-An Azure AD app registration for SQL Server. Registering a SQL Server instance as an Azure AD app allows the instance to query Azure AD, and allows the Azure AD app to authenticate on behalf of the SQL Server instance. The app registration also requires a few permissions, which are used by SQL Server for certain queries.
44
44
45
-
- SQL Server uses a certificate for this authentication, and it is stored in Azure Key Vault (AKV). The Azure Arc agent downloads the certificate to the SQL Server instance host.
45
+
- SQL Server uses a certificate for this authentication, which is stored in Azure Key Vault (AKV). The Azure Arc agent downloads the certificate to the SQL Server instance host.
46
46
47
47
> [!WARNING]
48
-
> Connections authenticated by Azure AD are always encrypted. If SQL Server is using a self-signed certificate, you must add `trust server cert = true` in the connection string. SQL Server and Windows authenticated connections don't require encryption, but it is recommended.
48
+
> Connections authenticated by Azure AD are always encrypted. If SQL Server is using a self-signed certificate, you must add `trust server cert = true` in the connection string. SQL Server and Windows authenticated connections don't require encryption, but it is strongly recommended.
49
49
50
50
## Create and register an Azure AD application
51
51
@@ -86,6 +86,7 @@ Select the newly created application, and on the left side menu, select **API Pe
86
86
1. Go to the [Azure portal](https://portal.azure.com), select **Key vaults**, and select the key vault you wish to use or create a new one. Select **Certificates** > **Generate/Import**
87
87
88
88
1. For the **Method of certificate creation**, use **Generate**.
89
+
89
90
1. Add a certificate name and subject.
90
91
91
92
1. The recommended validity period is at most 12 months. The rest of the values can be left as default.
@@ -136,7 +137,7 @@ Select the newly created application, and on the left side menu, select **API Pe
136
137
137
138
1. Select **Azure Active Directory** on the left-hand column.
138
139
139
-
1. Select **Set Admin**, and choose an account that will be added as an admin login to SQL Server.
140
+
1. Select **Set Admin**, and choose an account to set as an admin login to SQL Server.
140
141
141
142
1. Select **Customer-managed cert** and **Select a certificate**.
142
143
@@ -146,7 +147,7 @@ Select the newly created application, and on the left side menu, select **API Pe
146
147
147
148
1. Select **Change app registration**, and select the app registration you created earlier.
148
149
149
-
1. Select **Save**. This will send a request to the Arc server agent, which will configure Azure AD authentication for that SQL Server instance.
150
+
1. Select **Save**. This sends a request to the Arc server agent, which configures Azure AD authentication for that SQL Server instance.
150
151
151
152
:::image type="content" source="media/configure-azure-ad-for-sql-server-instance.png" alt-text="Screenshot of setting Azure Active Directory authentication in the Azure portal.":::
152
153
@@ -175,18 +176,18 @@ After the Azure Arc agent on the SQL Server host has completed its operation, th
175
176
176
177
### Create login syntax
177
178
178
-
The same syntax that is used for creating Azure AD logins and users on Azure SQL Database and Azure SQL Managed Instance can now be used on SQL Server.
179
+
The same syntax for creating Azure AD logins and users on Azure SQL Database and Azure SQL Managed Instance can now be used on SQL Server.
180
+
179
181
> [!NOTE]
180
-
>
181
-
On SQL Server, any account that has the `ALTER ANY LOGIN` or `ALTER ANY USER` permission can create Azure AD logins respectively users. The account doesn't need to be an Azure AD login.
182
+
> On SQL Server, any account that has the `ALTER ANY LOGIN` or `ALTER ANY USER` permission can create Azure AD logins or users, respectively. The account doesn't need to be an Azure AD login.
182
183
183
-
To create a login for an Azure AD account, execute the T-SQL command below in the `master` database:
184
+
To create a login for an Azure AD account, execute the following T-SQL command in the `master` database:
184
185
185
186
```sql
186
-
CREATE LOGIN [principal name] FROM EXTERNAL PROVIDER;
187
+
CREATE LOGIN [principal_name] FROM EXTERNAL PROVIDER;
187
188
```
188
189
189
-
For users, the principal name should be in the format `user@contoso.com`. For all other account types, the tenant name isn't necessary and either the Azure AD group name or application name must be used.
190
+
For users, the principal name must be in the format `user@tenant.com`. In Azure AD, this is the user principal name. For all other account types, like Azure AD groups or applications, the principal name is the name of the Azure AD object.
190
191
191
192
Here's some examples:
192
193
@@ -202,20 +203,19 @@ CREATE LOGIN [my_app_name] FROM EXTERNAL PROVIDER;
202
203
GO
203
204
```
204
205
205
-
To list the Azure AD logins in `master` database, execute the T-SQL command:
206
+
To list the Azure AD logins in the `master` database, execute the T-SQL command:
206
207
207
208
```sql
208
209
SELECT*FROMsys.server_principals
209
210
WHERE type IN ('E', 'X');
210
211
```
211
212
212
-
To grant an Azure AD user membership to the `sysadmin` role (for example `admin@contoso.com`), execute the following commands in `master` database:
213
+
To grant an Azure AD user membership to the `sysadmin` role (for example `admin@contoso.com`), execute the following commands in `master`:
213
214
214
215
```sql
215
216
CREATE LOGIN [admin@contoso.com] FROM EXTERNAL PROVIDER;
216
217
GO
217
-
ALTER ROLE sysadmin
218
-
ADD MEMBER [admin@contoso.com];
218
+
ALTER SERVER ROLE sysadmin ADD MEMBER [admin@contoso.com];
219
219
GO
220
220
```
221
221
@@ -225,7 +225,7 @@ The `sp_addsrvrolemember` stored procedure must be executed as a member of the S
225
225
226
226
You can create an Azure AD user either as a user with an Azure AD login, or as an Azure AD contained user.
227
227
228
-
To create an Azure AD user from an Azure AD login in a SQL Server database where the user should reside in, use the following syntax:
228
+
To create an Azure AD user from an Azure AD login in a SQL Server database, use the following syntax:
229
229
230
230
```sql
231
231
CREATE USER [principal_name] FROM LOGIN [principal_name];
@@ -275,15 +275,13 @@ To list the users created in the database, execute the following T-SQL command:
275
275
SELECT*FROMsys.database_principals;
276
276
```
277
277
278
-
The newly created user in a database has only the **Connect** permission, by default. All other SQL Server permissions for this user must be explicitly granted by the grantors.
278
+
A new database user is given the **Connect** permission by default. All other SQL Server permissions must be explicitly granted by authorized grantors.
279
279
280
280
### Azure AD guest accounts
281
281
282
-
The `CREATE LOGIN` and `CREATE USER` syntax also supports guest users. For example, if `testuser@outlook.com` was invited to the `contoso.com` tenant, it could be added as a login to SQL Server with the syntax below. In the example, `outlook.com` is provided even though SQL Server will use the account registered in the `contoso.com` tenant.
283
-
284
-
The following section has examples of creating guest users.
282
+
The `CREATE LOGIN` and `CREATE USER` syntax also supports guest users. For example, if `testuser@outlook.com` is invited to the `contoso.com` tenant, it can be added as a login to SQL Server with the following syntax. In the examples, `outlook.com` is provided even though SQL Server uses the account registered in the `contoso.com` tenant.
285
283
286
-
#### Create a guest user with login that exists
284
+
#### Create a guest user from an existing login
287
285
288
286
```sql
289
287
CREATE USER [testuser@outlook.com] FROM LOGIN [testuser@outlook.com];
@@ -297,24 +295,27 @@ CREATE USER [testuser@outlook.com] FROM EXTERNAL PROVIDER;
297
295
298
296
## Connect with a supported authentication method
299
297
300
-
SQL Server supports four authentication methods for Azure AD authentication:
298
+
SQL Server supports several methods of Azure AD authentication:
301
299
302
300
- Azure Active Directory Password
303
301
- Azure Active Directory Integrated
304
302
- Azure Active Directory Universal with Multi-Factor Authentication
303
+
- Azure Active Directory Service Principal
304
+
- Azure Active Directory Managed Identity
305
+
- Azure Active Directory Default
305
306
- Azure Active Directory access token
306
307
307
308
Use one of these methods to connect to the SQL Server instance. For more information, see [Azure Active Directory authentication for SQL Server](azure-ad-authentication-sql-server-overview.md).
308
309
309
310
## Authentication example using SSMS
310
311
311
-
Below is the snapshot of the SQL Server Management Studio (SSMS) connection page using the authentication method,**Azure Active Directory - Universal with MFA**.
312
+
Below is the snapshot of the SQL Server Management Studio (SSMS) connection page using the authentication method **Azure Active Directory - Universal with MFA**.
312
313
313
314
:::image type="content" source="media/sql-server-management-studio-connection.png" alt-text="Screenshot SSMS showing the Connect to Server window.":::
314
315
315
316
During the authentication process, a database where the user was created must be explicitly indicated in SSMS. Expand **Options > Connection Properties > Connect to database: `database_name`**.
316
317
317
-
For more information on **Azure Active Directory - Universal with MFA** authentication, see [Using Azure Active Directory Multi-Factor Authentication](/azure/azure-sql/database/authentication-mfa-ssms-overview).
318
+
For more information, see [Using Azure Active Directory Multi-Factor Authentication](/azure/azure-sql/database/authentication-mfa-ssms-overview).
318
319
319
320
SQL Server tools that support Azure AD authentication for Azure SQL are also supported for [!INCLUDE [sssql22-md](../../../includes/sssql22-md.md)].
Copy file name to clipboardExpand all lines: docs/ssms/f1-help/connect-to-server-connection-properties-page-database-engine.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,10 +31,10 @@ Select a protocol from the list. The available client protocols are configured u
31
31
**Network packet size**
32
32
Enter the size of the network packets to be sent. The default is 4096 bytes.
33
33
34
-
**Connection timeout**
34
+
**Connection time-out**
35
35
Enter the number of seconds to wait for a connection to be established before timing out. The default value is 15 seconds.
36
36
37
-
**Execution timeout**
37
+
**Execution time-out**
38
38
Enter the amount of time in seconds to wait before execution of a task is completed on the server. The default value is zero seconds, which indicates there is no time-out.
39
39
40
40
**Encrypt connection**
@@ -48,9 +48,6 @@ Select to specify the background color for the status bar in a [!INCLUDE[ssDE](.
48
48
- When you specify a color for a server entry in the **Registered Servers** pane, that color is used when you open a Query Editor window. To open a Query Editor window, either right-click the server entry and select **New Query**; or, when the **Registered Server** pane is active and focused on this server, click **New Query** on the toolbar.
49
49
50
50
- On the **File** menu, when you click **New** and then **Database Engine Query**, the color you that you specify in the **Connect to Server** dialog box applies to that Query Editor window.
51
-
52
-
**AD domain name or tenant ID**
53
-
When connecting with **Active Directory - Universal with MFA** authentication, specify the authenticating domain. This option is only available when using SSMS version 17.2 or later.
54
51
55
52
**Reset All**
56
53
Replace all manually entered connection property values with their defaults.
0 commit comments