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/active-directory-interactive-connect-azure-sql-db.md
+12-14Lines changed: 12 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
---
2
-
title: Connect .NET with Microsoft Entra multifactor authentication
2
+
title: "Connect .NET with Microsoft Entra Multifactor Authentication"
3
3
description: "C# Code example, with explanations, for connecting to Azure SQL Database by using SqlAuthenticationMethod.ActiveDirectoryInteractive mode."
This article provides a C# program that connects to Azure SQL Database. The program uses interactive mode authentication, which supports [multifactor authentication](/azure/active-directory/authentication/concept-mfa-howitworks) using Microsoft Entra ID ([formerly Azure Active Directory](/entra/fundamentals/new-name)).
@@ -24,21 +25,21 @@ For more information about multifactor authentication support for SQL tools, see
## Multifactor authentication for Azure SQL Database
30
31
31
32
`Active Directory Interactive` authentication supports multifactor authentication using [Microsoft.Data.SqlClient](/sql/connect/ado-net/introduction-microsoft-data-sqlclient-namespace) to connect to Azure SQL data sources. In a client C# program, the enum value directs the system to use the Microsoft Entra interactive mode that supports multifactor authentication to connect to Azure SQL Database. The user who runs the program sees the following dialog boxes:
32
33
33
-
* A dialog box that displays a Microsoft Entra user name and asks for the user's password.
34
+
- A dialog box that displays a Microsoft Entra user name and asks for the user's password.
34
35
35
36
If the user's domain is federated with Microsoft Entra ID, the dialog box doesn't appear, because no password is needed.
36
37
37
38
If the Microsoft Entra policy imposes multifactor authentication on the user, a dialog box to sign in to your account will display.
38
39
39
-
* The first time a user goes through multifactor authentication, the system displays a dialog box that asks for a mobile phone number to send text messages to. Each message provides the *verification code* that the user must enter in the next dialog box.
40
+
- The first time a user goes through multifactor authentication, the system displays a dialog box that asks for a mobile phone number to send text messages to. Each message provides the *verification code* that the user must enter in the next dialog box.
40
41
41
-
* A dialog box that asks for a multifactor authentication verification code, which the system has sent to a mobile phone.
42
+
- A dialog box that asks for a multifactor authentication verification code, which the system has sent to a mobile phone.
42
43
43
44
For information about how to configure Microsoft Entra ID to require multifactor authentication, see [Getting started with Microsoft Entra multifactor authentication in the cloud](/azure/active-directory/authentication/howto-mfa-getstarted).
44
45
@@ -49,11 +50,11 @@ For screenshots of these dialog boxes, see [Using Microsoft Entra multifactor au
49
50
>
50
51
> You can also search directly with the [optional ?term=<search value> parameter](/dotnet/api/?term=SqlAuthenticationMethod).
51
52
52
-
## Prerequisite
53
+
## Prerequisites
53
54
54
55
Before you begin, you should have a [logical SQL server](logical-servers.md) created and available.
@@ -78,7 +79,7 @@ Before you run the C# example, it's a good idea to check that your setup and con
78
79
79
80
Run SSMS from the same computer, in the same building, where you plan to run the C# example. For this test, any **Authentication** mode is OK. If there's any indication that the server isn't accepting your IP address, see [server-level and database-level firewall rules](firewall-configure.md) for help.
This article describes the authentication requirements to configure and control [active geo-replication](active-geo-replication-overview.md) and [failover groups](failover-group-sql-db.md). It also provides the steps required to set up user access to the secondary database. Finally, it also describes how to enable access to the recovered database after using [geo-restore](recovery-using-backups.md#geo-restore). For more information on recovery options, see [Business Continuity Overview](business-continuity-high-availability-disaster-recover-hadr-overview.md).
18
+
This article describes the authentication requirements to configure and control [active geo-replication](active-geo-replication-overview.md) and [failover groups](failover-group-sql-db.md). It also provides the steps required to set up user access to the secondary database. Finally, it also describes how to enable access to the recovered database after using [geo-restore](recovery-using-backups.md#geo-restore). For more information on recovery options, see [Business continuity in Azure SQL Database](business-continuity-high-availability-disaster-recover-hadr-overview.md).
17
19
18
20
## Disaster recovery with contained users
19
21
20
22
Unlike traditional users, which must be mapped to logins in the `master` database, a contained user is managed completely by the database itself. This has two benefits. In the disaster recovery scenario, the users can continue to connect to the new primary database or the database recovered using geo-restore without any additional configuration, because the database manages the users. There are also potential scalability and performance benefits from this configuration from a login perspective. For more information, see [Contained Database Users - Making Your Database Portable](/sql/relational-databases/security/contained-database-users-making-your-database-portable).
21
23
22
-
The main trade-off is that managing the disaster recovery process at scale is more challenging. When you have multiple databases that use the same login, maintaining the credentials using contained users in multiple databases may negate the benefits of contained users. For example, the password rotation policy requires that changes be made consistently in multiple databases rather than changing the password for the login once in the `master` database. For this reason, if you have multiple databases that use the same user name and password, using contained users is not recommended.
24
+
The main trade-off is that managing the disaster recovery process at scale is more challenging. When you have multiple databases that use the same login, maintaining the credentials using contained users in multiple databases might negate the benefits of contained users. For example, the password rotation policy requires that changes be made consistently in multiple databases rather than changing the password for the login once in the `master` database. For this reason, if you have multiple databases that use the same user name and password, using contained users is not recommended.
23
25
24
26
## How to configure logins and users
25
27
26
28
If you are using logins and users (rather than contained users), you must take extra steps to ensure that the same logins exist in the `master` database. The following sections outline the steps involved and additional considerations.
27
29
28
30
>[!NOTE]
29
-
> It's also possible to use logins created from Microsoft Entra ID ([formerly Azure Active Directory](/entra/fundamentals/new-name)) to manage your databases. For more information, see [Azure SQL logins and users](./logins-create-manage.md).
31
+
> It's also possible to use logins created from Microsoft Entra ID ([formerly Azure Active Directory](/entra/fundamentals/new-name)) to manage your databases. For more information, see [Authorize database access](logins-create-manage.md).
30
32
31
33
### Set up user access to a secondary or recovered database
32
34
33
35
In order for the secondary database to be usable as a read-only secondary database, and to ensure proper access to the new primary database or the database recovered using geo-restore, the `master` database of the target server must have the appropriate security configuration in place before the recovery.
34
36
35
-
The specific permissions for each step are described later in this topic.
36
-
37
-
Preparing user access to a geo-replication secondary should be performed as part configuring geo-replication. Preparing user access to the geo-restored databases should be performed at any time when the original server is online (e.g. as part of the DR drill).
37
+
Preparing user access to a geo-replication secondary should be performed as part configuring geo-replication. Preparing user access to the geo-restored databases should be performed at any time when the original server is online (as part of the disaster recovery test).
38
38
39
39
> [!NOTE]
40
40
> If you fail over or geo-restore to a server that does not have properly configured logins, access to it will be limited to the server admin account.
41
41
42
-
Setting up logins on the target server involves three steps outlined below:
42
+
Setting up logins on the target server involves three steps:
43
43
44
44
#### 1. Determine logins with access to the primary database
45
45
46
46
The first step of the process is to determine which logins must be duplicated on the target server. This is accomplished with a pair of SELECT statements, one in the logical `master` database on the source server and one in the primary database itself.
47
47
48
-
Only the server admin or a member of the **LoginManager** server role can determine the logins on the source server with the following SELECT statement.
48
+
Only the server admin or a member of the **LoginManager** server role can determine the logins on the source server with the following `SELECT` statement.
49
49
50
50
```sql
51
51
SELECT [name], [sid]
@@ -74,7 +74,7 @@ WHERE [type_desc] = 'SQL_USER'
74
74
```
75
75
76
76
> [!NOTE]
77
-
> The **INFORMATION_SCHEMA** and **sys** users have *NULL* SIDs, and the **guest** SID is **0x00**. The **dbo** SID may start with *0x01060000000001648000000000048454*, if the database creator was the server admin instead of a member of **DbManager**.
77
+
> The `INFORMATION_SCHEMA` and `sys` users have `NULL` SIDs, and the `guest` SID is `0x00`. The `dbo` SID might start with `0x01060000000001648000000000048454` if the database creator was the server admin instead of a member of **DbManager**.
78
78
79
79
#### 3. Create the logins on the target server
80
80
@@ -97,10 +97,10 @@ On the target server, do not create a new login with the server admin SID from t
97
97
>
98
98
> DISABLE doesn't change the password, so you can always enable it if needed.
99
99
100
-
## Next steps
100
+
## Related content
101
101
102
-
* For more information on managing database access and logins, see [SQL Database security: Manage database access and login security](logins-create-manage.md).
103
-
* For more information on contained database users, see [Contained Database Users - Making Your Database Portable](/sql/relational-databases/security/contained-database-users-making-your-database-portable).
104
-
* To learn about active geo-replication, see [Active geo-replication](active-geo-replication-overview.md).
105
-
* To learn about failover groups, see [Failover groups](failover-group-sql-db.md).
106
-
* For information about using geo-restore, see [geo-restore](recovery-using-backups.md#geo-restore)
102
+
- [Authorize database access to SQL Database, SQL Managed Instance, and Azure Synapse Analytics](logins-create-manage.md)
103
+
- [Contained Database Users - Making Your Database Portable](/sql/relational-databases/security/contained-database-users-making-your-database-portable)
Copy file name to clipboardExpand all lines: azure-sql/database/always-encrypted-enclaves-configure-attestation.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
1
---
2
-
title: "Configure attestation for Always Encrypted using Azure Attestation"
2
+
title: "Configure Attestation for Always Encrypted Using Azure Attestation"
3
3
description: Configure Azure Attestation for Always Encrypted with secure enclaves in Azure SQL Database.
4
4
author: Pietervanhove
5
5
ms.author: pivanho
6
6
ms.reviewer: vanto, mathoma
7
-
ms.date: 11/14/2023
7
+
ms.date: 06/10/2025
8
8
ms.service: azure-sql-database
9
9
ms.subservice: security
10
-
ms.custom: ignite-2023
11
10
ms.topic: how-to
11
+
ms.custom:
12
+
- ignite-2023
12
13
keywords:
13
14
- "encrypt data"
14
15
- "sql encryption"
@@ -30,7 +31,7 @@ To use Azure Attestation for attesting Intel SGX enclaves used for [Always Encry
30
31
31
32
1. Create an [attestation provider](/azure/attestation/basic-concepts#attestation-provider) and configure it with the recommended attestation policy.
32
33
33
-
2. Determine the attestation URL and share it with application administrators.
34
+
1. Determine the attestation URL and share it with application administrators.
34
35
35
36
> [!IMPORTANT]
36
37
>With Intel SGX enclaves in Azure SQL Database, attestation is mandatory and it requires Microsoft Azure Attestation.
@@ -71,23 +72,23 @@ authorizationrules
71
72
The policy verifies:
72
73
73
74
- The enclave inside Azure SQL Database doesn't support debugging.
74
-
75
+
75
76
Enclaves can be loaded with debugging disabled or enabled. Debugging support is designed to allow developers to troubleshoot the code running in an enclave. In a production system, debugging could enable an administrator to examine the content of the enclave, which would reduce the level of protection the enclave provides. The recommended policy disables debugging to ensure that if a malicious admin tries to turn on debugging support by taking over the enclave machine, attestation will fail.
76
77
77
78
- The product ID of the enclave matches the product ID assigned to Always Encrypted with secure enclaves.
78
-
79
+
79
80
Each enclave has a unique product ID that differentiates the enclave from other enclaves. The product ID assigned to the Always Encrypted enclave is 4639.
80
81
81
82
- The security version number (SVN) of the library is greater than or equal to 2.
82
-
83
+
83
84
The SVN allows Microsoft to respond to potential security bugs identified in the enclave code. In case a security issue is discovered and fixed, Microsoft will deploy a new version of the enclave with a new (incremented) SVN. The recommended policy is updated to reflect the new SVN. By updating your policy to match the recommended policy, you can ensure that if a malicious administrator tries to load an older and insecure enclave, attestation will fail.
84
85
85
86
- The library in the enclave has been signed using the Microsoft signing key (the value of the x-ms-sgx-mrsigner claim is the hash of the signing key).
86
-
87
+
87
88
One of the main goals of attestation is to convince clients that the binary running in the enclave is the binary that is supposed to run. Attestation policies provide two mechanisms for this purpose. One is the **mrenclave** claim, which is the hash of the binary that is supposed to run in an enclave. The problem with the **mrenclave** is that the binary hash changes even with trivial changes to the code, which makes it hard to rev the code running in the enclave. Hence, we recommend the use of the **mrsigner**, which is a hash of a key that is used to sign the enclave binary. When Microsoft revs the enclave, the **mrsigner** stays the same as long as the signing key doesn't change. In this way, it becomes feasible to deploy updated binaries without breaking customers' applications.
88
89
89
90
> [!IMPORTANT]
90
-
> Microsoft may need to rotate the key used to sign the Always Encrypted enclave binary, which is expected to be a rare event. Before a new version of the enclave binary, signed with a new key, is deployed to Azure SQL Database, this article will be updated to provide a new recommended attestation policy and instructions on how you should update the policy in your attestation providers to ensure your applications continue to work uninterrupted.
91
+
> Microsoft might need to rotate the key used to sign the Always Encrypted enclave binary, which is expected to be a rare event. Before a new version of the enclave binary, signed with a new key, is deployed to Azure SQL Database, this article will be updated to provide a new recommended attestation policy and instructions on how you should update the policy in your attestation providers to ensure your applications continue to work uninterrupted.
91
92
92
93
For instructions for how to create an attestation provider and configure with an attestation policy using:
For more information, see [Create and manage an attestation provider](/azure/attestation/quickstart-powershell#create-and-manage-an-attestation-provider).
121
122
122
-
## Next steps
123
+
## Next step
123
124
124
-
-[Manage keys for Always Encrypted with secure enclaves](/sql/relational-databases/security/encryption/always-encrypted-enclaves-manage-keys)
125
+
> [!div class="nextstepaction"]
126
+
> [Manage keys for Always Encrypted with secure enclaves](/sql/relational-databases/security/encryption/always-encrypted-enclaves-manage-keys)
125
127
126
-
## See also
128
+
## Related content
127
129
128
130
-[Getting started using Always Encrypted with secure enclaves](always-encrypted-enclaves-getting-started.md)
0 commit comments