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
dotnet ef database update
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]
az sql server firewall-rule create –resource-group RGLabRadwan –server sqlservercoreappradwan –name FWRuleAllowAzureRadwan –start-ip-address 0.0.0.0 –end-ip-address 0.0.0.0
az sql db create –resource-group RGLabRadwan –server sqlservercoreappradwan –name SQLDBcoreDBRadwan –service-objective S0
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
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=’Server=tcp:sqlservercoreappradwan.database.windows.net,1433;Database=SQLDBcoreDBRadwan;User ID=userradwan;[email protected];Encrypt=true;Connection Timeout=30;’ –connection-string-type SQLServer
az webapp config appsettings set –name appserviceappcoreradwan –resource-group RGLabRadwan –settings ASPNETCORE_ENVIRONMENT=”Production”
git config –global user.email “[email protected]”
git config –global user.name “mradwan”
Add git remote
git remote add azure
git push azure master
az webapp log config –name appserviceappcoreradwan –resource-group RGLabRadwan –docker-container-logging filesystem
az webapp log tail –name appserviceappcoreradwan –resource-group RGLabRadwan
az group delete –name RGLabRadwan
#Azure_training #ASP.NET_training #Azure_development #Azure_SQL #Azure_App_Service