Skip to content

Commit 630198c

Browse files
committed
MicrosoftDocs/azure-docs#37830
1 parent 6a52504 commit 630198c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

articles/app-service/app-service-web-tutorial-connect-msi.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ var conn = (System.Data.SqlClient.SqlConnection)Database.GetDbConnection();
165165
conn.AccessToken = (new Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").Result;
166166
```
167167

168+
> [!TIP]
169+
> This demonstration code is asynchronous for clarify. For more information, see [Asynchronous guide for constructors](https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AsyncGuidance.md#constructors).
170+
168171
That's every thing you need to connect to SQL Database. When debugging in Visual Studio, your code uses the Azure AD user you configured in [Set up Visual Studio](#set-up-visual-studio). You'll set up the SQL Database server later to allow connection from the managed identity of your App Service app.
169172

170173
Type `Ctrl+F5` to run the app again. The same CRUD app in your browser is now connecting to the Azure SQL Database directly, using Azure AD authentication. This setup lets you run database migrations from Visual Studio.

0 commit comments

Comments
 (0)