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
-----------------------------
Video:
• Mohamed Radwan is a Principal DevOps Consu...
Blog:
mohamedradwan.com/
Linked-in
eg.linkedin.com/in/mohamedahmedradwan
GitHub
github.com/DevOpsFounder
Twitter:
twitter.com/mradwan06
Commands
Git
git clone github.com/azure-samples/dotnetcore-sqldb-tutorial
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 DevOpsAKS@1234
Firewall rule
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
SQL DB
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 DevOpsAKS@1234//!
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='Server=tcp:sqlservercoreappradwan.database.windows.net,1433;Database=SQLDBcoreDBRadwan;User ID=userradwan;Password=DevOpsAKS@1234;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 user.email "mohamed@mohamedradwan.com"
git config --global user.name "mradwan"
Add git remote
git remote add azure https://userradwan@appserviceappcoreradwan.scm.azurewebsites.net/appserviceappcoreradwan.git
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
コメント