ASP.NET Core and SQL Database Training in Azure App Service | Developing ASP.NET & Entity Framework

ASP.NET Core and SQL Database Training in Azure App Service | Developing ASP.NET & Entity Framework

In this video, you will learn how develop ASP.NET Core web App with Entity Framework Core on Azure App Service.

This video will provide a walk-through tutorial this includes MVC application development, Entity Framework migration, creating and configuration SQL on Azure, firewall configuration, connecting to Azure SQL using SQL Management Studio and many other steps.

You will see how to install all the prerequisite, the first is Git then the .NET Core SDK and runtime.

After that we will install Visual Studio Code so we can edit and develop the application and then installing SQL Server Management Studio so we can connect later to the SQL Server on Azure.

Then we will use a sample application on GitHub, this sample application is a sample To-do list using ASP.NET core and Entity Framework core application with a basic CRUD (create read update delete). So, the first step is just to clone this repo from GitHub on my local VM once I did that, I will start restoring the package and building the application migrating the Entity Framework locally on the local database and then run the application.

Create a resource group
After that I will create the main resource group that will have the rest of the resources for our lab, the first component is to create a logical SQL Server on Azure, I will use a username and password which I will use them later for configuring the connection string to connect to the database after that I will create a firewall rules for SQL on Azure, this needed in order to be able to connect to Azure SQL.

Create production SQL Database
After that I will create an Azure database, the database created will be in DTU model with s0 basic Tire. So, the DTU model is a database transaction unit which work very well if you have a pricing constraint and work load, it is also scalable if you want to upgrade that later in Azure database in the future however the DTU model CPU capabilities and the storage capabilities are closely coupled DT you are a mix of CPU/IO and memory if you need more than you need to go for different model.
Then Create a SQL Database logical server then Configure a server firewall rule

After that I will create a deployment user which is just a username and passwords that I will use them later for pushing my application to the Azure App service using Git command.

And push my application to Azure App Service using Git command

About the Author






git clone
cd dotnetcore-sqldb-tutorial
dotnet restore
dotnet ef database update
dotnet run

Create a resource group
az group create –name RGLabRadwan –location “UK South”

SQL Logical server
az sql server create –name sqlservercoreappradwan –resource-group RGLabRadwan –location “UK South” –admin-user userradwan –admin-password [email protected]

Firewall rule
az sql server firewall-rule create –resource-group RGLabRadwan –server sqlservercoreappradwan –name FWRuleAllowAzureRadwan –start-ip-address –end-ip-address

az sql db create –resource-group RGLabRadwan –server sqlservercoreappradwan –name SQLDBcoreDBRadwan –service-objective S0

Deployment user
az webapp deployment user set –user-name userradwan –password [email protected]//!

App service plan
az appservice plan create –name appserviceplancoreappradwan –resource-group RGLabRadwan –sku B1 –is-linux

Web app
az webapp create –resource-group RGLabRadwan –plan appserviceplancoreappradwan –name appserviceappcoreradwan –runtime “DOTNETCORE|2.2″ –deployment-local-git

Configure connection string
az webapp config connection-string set –resource-group RGLabRadwan –name appserviceappcoreradwan –settings MyDbConnection=’,1433;Database=SQLDBcoreDBRadwan;User ID=userradwan;[email protected];Encrypt=true;Connection Timeout=30;’ –connection-string-type SQLServer

Env var
az webapp config appsettings set –name appserviceappcoreradwan –resource-group RGLabRadwan –settings ASPNETCORE_ENVIRONMENT=”Production”

git config –global “[email protected]
git config –global “mradwan”

Add git remote
git remote add azure
git push azure master

diagnostic Log
az webapp log config –name appserviceappcoreradwan –resource-group RGLabRadwan –docker-container-logging filesystem
az webapp log tail –name appserviceappcoreradwan –resource-group RGLabRadwan

Delete RG
az group delete –name RGLabRadwan

 #Azure_training #ASP.NET_training #Azure_development #Azure_SQL #Azure_App_Service

4 thoughts on “ASP.NET Core and SQL Database Training in Azure App Service | Developing ASP.NET & Entity Framework

  1. Why is Azure so complicated and so horribly documented? Why can't Microsoft learn from say Google Cloud and document it properly?

    There are at least some 4 different tutorials on how to connect ASP.Net to an Azure SQL Database and all of them are based on copy pasting code instead of explaining how to do it for any project.

  2. The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app. please help me!

Leave a Reply

Your email address will not be published. Required fields are marked *