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: articles/app-service/app-service-web-tutorial-connect-msi.md
+7-30Lines changed: 7 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn how to make database connectivity more secure by using a mana
4
4
5
5
ms.devlang: dotnet
6
6
ms.topic: tutorial
7
-
ms.date: 11/18/2019
7
+
ms.date: 04/27/2020
8
8
ms.custom: mvc, cli-validate
9
9
---
10
10
# Tutorial: Secure Azure SQL Database connection from App Service using a managed identity
@@ -19,8 +19,8 @@ When you're finished, your sample app will connect to SQL Database securely with
19
19
> [!NOTE]
20
20
> The steps covered in this tutorial support the following versions:
21
21
>
22
-
> - .NET Framework 4.7.2
23
-
> - .NET Core 2.2
22
+
> - .NET Framework 4.7.2 and above
23
+
> - .NET Core 2.2 and above
24
24
>
25
25
26
26
What you will learn:
@@ -99,7 +99,7 @@ The steps you follow for your project depends on whether it's an ASP.NET project
99
99
In Visual Studio, open the Package Manager Console and add the NuGet package [Microsoft.Azure.Services.AppAuthentication](https://www.nuget.org/packages/Microsoft.Azure.Services.AppAuthentication):
In *Web.config*, working from the top of the file and make the following changes:
@@ -134,7 +134,7 @@ Type `Ctrl+F5` to run the app again. The same CRUD app in your browser is now co
134
134
In Visual Studio, open the Package Manager Console and add the NuGet package [Microsoft.Azure.Services.AppAuthentication](https://www.nuget.org/packages/Microsoft.Azure.Services.AppAuthentication):
In the [ASP.NET Core and SQL Database tutorial](app-service-web-tutorial-dotnetcore-sqldb.md), the `MyDbConnection` connection string isn't used at all because the local development environment uses a Sqlite database file, and the Azure production environment uses a connection string from App Service. With Active Directory authentication, you want both environments to use the same connection string. In *appsettings.json*, replace the value of the `MyDbConnection` connection string with:
@@ -143,33 +143,10 @@ In the [ASP.NET Core and SQL Database tutorial](app-service-web-tutorial-dotnetc
Next, you supply the Entity Framework database context with the access token for the SQL Database. In *Data\MyDatabaseContext.cs*, add the following code inside the curly braces of the empty `MyDatabaseContext (DbContextOptions<MyDatabaseContext> options)` constructor:
In the SQL prompt for the database you want, run the following commands to add the Azure AD group and grant the permissions your app needs. For example,
208
+
In the SQL prompt for the database you want, run the following commands to grant the permissions your app needs. For example,
232
209
233
210
```sql
234
211
CREATE USER [<identity-name>] FROM EXTERNAL PROVIDER;
0 commit comments