Exercise 4 – connecting Azure SQL Database to an ASP.NET app
We will learn in this section how to connect an ASP.NET application to SQL Database.
The application is already using SQL Server 2019. We start by migrating the database to SQL Database using the Data Migration Assistant migration tool (to download it, use this link: https://www.microsoft.com/en-us/download/details.aspx?id=53595).
We will start by configuring the database connection, then we will update the connection string in ASP.NET Core. The application is using Entity Framework to connect and manage Azure SQL Database.
Creating and configuring the database connection
We will follow these steps to create a database connection:
- Open Visual Studio 2022 and use SQL Server Object Explorer, as presented in the following figure:
Figure 7.20 – SQL Server Object Explorer
- At the top of SQL Server Object Explorer, right-click on SQL Server, then select...