How To Deploy Application On Azure App Service And Enable Application Logs

First, we need to understand what Azure App service is and what features it provides.

The Azure App service is a PAAS service of Azure which can be used to deploy your application on the cloud without caring about the infrastructure, maintenance and security --  it provides all of these features off the shelf.

The Azure App service can be used to deploy .Net, Python, Java, Python, and Node js applications.
 

App Service Plan

 
The app service plan is the first step that you need to understand before deploying your application on an app service. The app service plan is like a web hosting package.
 
The App service plans are divided into 3 different categories,
  • Dev/Testing
  • Production
  • Isolated
How To Deploy Application On Azure App Service And Enable Application Logs
 
Dev/Testing
 
If your project is in testing or development phase than you can use this app service plan. It has limitations like a maximum of  60 minutes compute a day and 1 GB memory which will not be suitable for production,  and you can host at most 10 applications in this plan.
 
Production
 
This could be used for your production-ready application. It comes with features like deployement slot.
 
Deployment slot is used to test your new code before moving it to production. We can have a staging slot so every new code is deployed to the staging slot and tested with the live data. If the application works well it will be moved to the production slot.
 
An auto scaling feature can be used in this category to automatically scale your app service on the basis of some scaling rules such as  message queues or computes matrix etc.
 
We can have our custom domain attached to an app service,  and  atraffic manager feature is also available in this category. The traffic manager is placed in front of your application to manage all the traffic coming to your application and define rules like diverting traffic from specific regions to a different instance of the application.
 
Isolated
 
If you have security/privacy concerns with your application you can use this category. It will provide you with  isolated hardware and networks for your application.
 

Web App

 
After creating the app service plan you need to create a web app that will contain your application code.
  1. Select the resource group in which you want to place your web app.
  2. Enter the name of the app service; that needs to be unique.
  3. Select the runtime stack which should match the technology stack on which your application is developed.
  4. Select the region; or the geographical location where your want to deploy your code.
  5. Select the app service plan you have created or you could create a new one.
How To Deploy Application On Azure App Service And Enable Application Logs
 

Application Logging

 
The application logging is an important thing when your application goes into production. You might need to monitor the application logs all the time so if anything goes wrong, you could backtrack it. The App service provides application-level logging in different ways. We can store the application logs in the storage account or we can send the logs to log analytics which is a comprehensive log analytics service that provides queries on the logs too.
  1. Click on the diagnostic logs
  2. Click on the Add diagnostic setting
  3. Click on the Archive to save your logs in the storage account. Configure the storage account on which you want to store the logs. You can also define the retention period for how long you want to store the logs in the storage account.
How To Deploy Application On Azure App Service And Enable Application Logs
 

Deployment through Visual Studio

 
It is very easy to deploy your code through Visual Studio.
  1. Right Click on the application and there is a publish option -  click on it.
  2. Create a new publish profile by clicking on new.
  3. Click on the App service option and click on “Select Existing”
  4. Log in if you are not logged in already and select the Resource group that has your web application.
  5. Select your web application.
How To Deploy Application On Azure App Service And Enable Application Logs