About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
windows_first
⚠️
powershell_heavy
⚠️
windows_tools
⚠️
missing_linux_example
Summary:
The documentation demonstrates a Windows bias by prioritizing Windows-centric tools and workflows, such as Visual Studio, Solution Explorer, and PowerShell/Package Manager Console, while omitting equivalent Linux or cross-platform alternatives. There are no explicit Linux or CLI-based development/publishing examples, and the local development and debugging guidance is focused on Windows environments. The documentation assumes the use of Windows-based development tools and does not provide parity for Linux users.
Recommendations:
- Provide equivalent Linux and cross-platform examples for development, publishing, and debugging (e.g., using VS Code, dotnet CLI, Azure CLI, and GitHub Actions).
- Include instructions for updating packages and managing dependencies using the dotnet CLI (e.g., 'dotnet add package') instead of only referencing Visual Studio and PowerShell.
- Offer guidance for local debugging and authentication flows on Linux/macOS, including how to obtain tokens and connect to Azure SQL Database from non-Windows environments.
- Mention and demonstrate cross-platform editors (e.g., VS Code) and workflows alongside Windows-specific tools.
- Clarify which steps are platform-agnostic and which are Windows-specific, and provide alternatives where possible.
Create pull request
Flagged Code Snippets
The commands effectively add a `loginParameters` property with extra custom scopes. Here's an explanation of the requested scopes:
- `openid`, `profile`, and `email` are requested by App Service by default already. For information, see [OpenID Connect Scopes](../active-directory/develop/v2-permissions-and-consent.md#openid-connect-scopes).
- `https://database.windows.net/user_impersonation` refers to Azure SQL Database. It's the scope that gives you a JWT that includes SQL Database as a [token audience](https://wikipedia.org/wiki/JSON_Web_Token).
- [offline_access](../active-directory/develop/v2-permissions-and-consent.md#offline_access) is included here for convenience (in case you want to [refresh tokens](#what-happens-when-access-tokens-expire)).
> [!TIP]
> To configure the required scopes using a web interface instead, see the Microsoft steps at [Refresh auth tokens](configure-authentication-oauth-tokens.md#refresh-auth-tokens).
Your apps are now configured. The app can now generate a token that SQL Database accepts.
## 5. Use the access token in your application code
The steps you follow for your project depends on whether you're using [Entity Framework](/ef/ef6/) (default for ASP.NET) or [Entity Framework Core](/ef/core/) (default for ASP.NET Core).
# [Entity Framework](#tab/ef)
1. In Visual Studio, open the Package Manager Console and update Entity Framework:
1. Restrict the database server authentication to Active Directory authentication. This step effectively disables SQL authentication.
1. Publish your changes in Visual Studio. In the **Solution Explorer**, right-click your **DotNetAppSqlDb** project and select **Publish**.
:::image type="content" source="./media/app-service-web-tutorial-dotnet-sqldatabase/solution-explorer-publish.png" alt-text="Screenshot showing how to publish from the Solution Explorer in Visual Studio." lightbox="./media/app-service-web-tutorial-dotnet-sqldatabase/solution-explorer-publish.png":::
1. In the publish page, select **Publish**.
# [ASP.NET Core](#tab/dotnetcore)
1. **If you came from [Tutorial: Build an ASP.NET Core and SQL Database app in Azure App Service](tutorial-dotnetcore-sqldb-app.md)**, you have a connection string called `defaultConnection` in App Service using SQL authentication, with a username and password. Use the following command to remove the connection secrets, but replace *\<group-name>*, *\<app-name>*, *\<db-server-name>*, and *\<db-name>* with yours.