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
## Grant your VM access to a database in an Azure SQL server
36
+
## Grant access
37
37
38
38
To grant your VM access to a database in an Azure SQL Server, you can use an existing SQL server or create a new one. To create a new server and database using the Azure portal, follow this [Azure SQL quickstart](https://docs.microsoft.com/azure/sql-database/sql-database-get-started-portal). There are also quickstarts that use the Azure CLI and Azure PowerShell in the [Azure SQL documentation](https://docs.microsoft.com/azure/sql-database/).
39
39
@@ -42,7 +42,7 @@ There are two steps to granting your VM access to a database:
42
42
1. Enable Azure AD authentication for the SQL server.
43
43
2. Create a **contained user** in the database that represents the VM's system-assigned identity.
44
44
45
-
## Enable Azure AD authentication for the SQL server
45
+
## Enable Azure AD authentication
46
46
47
47
[Configure Azure AD authentication for the SQL server](/azure/sql-database/sql-database-aad-authentication-configure) using the following steps:
48
48
@@ -53,9 +53,9 @@ There are two steps to granting your VM access to a database:
53
53
5. Select an Azure AD user account to be made an administrator of the server, and click **Select.**
54
54
6. In the command bar, click **Save.**
55
55
56
-
## Create a contained user in the database that represents the VM's system assigned identity
56
+
## Create user
57
57
58
-
For this next step, you will need [Microsoft SQL Server Management Studio](https://docs.microsoft.com/sql/ssms/download-sql-server-management-studio-ssms) (SSMS). Before beginning, it may also be helpful to review the following articles for background on Azure AD integration:
58
+
This section shows how to create a contained user in the database that represents the VM's system assigned identity. For this step, you need [Microsoft SQL Server Management Studio](https://docs.microsoft.com/sql/ssms/download-sql-server-management-studio-ssms) (SSMS). Before beginning, it may also be helpful to review the following articles for background on Azure AD integration:
59
59
60
60
-[Universal Authentication with SQL Database and SQL Data Warehouse (SSMS support for MFA)](/azure/sql-database/sql-database-ssms-mfa-authentication)
61
61
-[Configure and manage Azure Active Directory authentication with SQL Database or SQL Data Warehouse](/azure/sql-database/sql-database-aad-authentication-configure)
@@ -94,9 +94,9 @@ SQL DB requires unique AAD display names. With this, the AAD accounts such as us
94
94
95
95
Code running in the VM can now get a token using its system-assigned managed identity and use the token to authenticate to the SQL server.
96
96
97
-
## Get an access token using the VM's system-assigned managed identity and use it to call Azure SQL
97
+
## Get an access token
98
98
99
-
Azure SQL natively supports Azure AD authentication, so it can directly accept access tokens obtained using managed identities for Azure resources. You use the **access token** method of creating a connection to SQL. This is part of Azure SQL's integration with Azure AD, and is different from supplying credentials on the connection string.
99
+
This section shows how to get an access token using the VM's system-assigned managed identity and use it to call Azure SQL. Azure SQL natively supports Azure AD authentication, so it can directly accept access tokens obtained using managed identities for Azure resources. You use the **access token** method of creating a connection to SQL. This is part of Azure SQL's integration with Azure AD, and is different from supplying credentials on the connection string.
100
100
101
101
Here's a .NET code example of opening a connection to SQL using an access token. This code must run on the VM to be able to access the VM's system-assigned managed identity's endpoint. **.NET Framework 4.6** or higher or **.NET Core 2.2** or higher is required to use the access token method. Replace the values of AZURE-SQL-SERVERNAME and DATABASE accordingly. Note the resource ID for Azure SQL is `https://database.windows.net/`.
0 commit comments