Part 27 – Azure Web App Service ( PAAS )

Loading

Azure App Service is an HTTP-based service for hosting web applications. Web apps in Azure allow us to publish and manage your website easily without having to work with the underlying servers, storage, or network assets. Instead, you can focus on your website features and rely on the robust Azure platform to provide secure access to your site.

Create App service and app service plan

App service hoists or manages the underlying compute hosting of the web app servers. Click on Create a resource and select web from the marketplace > Click on Web App.

This step starts a wizard to configure the following settings:

  • Subscription: a valid Azure subscription;
  • Resource group: creates a new resource group
  • Name: the name of the web app instance (i.e., ‘vmapps’).  Microsoft Azure will assign a subdomain of ‘azurewebsites.net’ to the app;
  • Runtime Stack: defines the technology stack used to develop the app (i.e. NET Core 6.0)
  • Operating System: sets the app hosting platform (i.e. Windows).
  • Region: defines which datacenter is used to create the resource
  • App Service Plan: Defines the number of resources that the app needs and the amount of money to spend on it.
  • SKU and Size – It will specify how many apps you can create under this subscription. By default, it shows  Standard S1

After filling in all the mentioned detail, Click on ‘Create‘. This section would look similar to the below image.

Click Next to continue

Click Next to continue

Click Next to continue

As soon as we click on Create button, the deployment process gets initiated.

When we go to the resource we created, we will see that the Web App is created.

Open the AppService Editor for us to make some changes to the default.html

Make a simple HTML entry in here.

After that, click on the web app created by you as underlined in the below image, there you will find a Url; click to reach the next screen.

When you click on Url, it will take you to the next screen indicating the created web app.

Deployment of Web App Custom Domains

By default, web apps gets the following URL when deployed

Now, let’s say you want to ensure that you use a custom domain to redirect this URL path so let’s see how this done

Go to the Custom Domain section in your web-app

Choose to add your domain which in this case is grandvm.com

We will now need to go to our domain management and change the A and TXT records to what was displayed above

Click Add to Validate

The validation takes around 5 mins to complete

Azure Web Apps

Once the validation is complete, we should now be able to directly access the website via https://grandvm.com

Deployment Slot of Azure Web App

Let’s say you have a web application (MyWebApp) deployed in Azure. By default, it gets the following URL. This is your production version of the application and your users are able to access and use it.

Now, let’s say you have to make a change to your application. Maybe, there is a bug that you are fixing or you are adding a new feature. The point is you are making a change to your application code and you want to test these changes in your production-like environment. 

The swap functionality of the deployment slot takes care of this magic. Isn’t that awesome?

Deployment Slot Facts

  • Each deployment slot is like a full-fledged App Service instance.
  • The original App Service deployment slot is also called the production slot.
  • Deployment slots can copy the configuration (AppSettings and Connectionstrings) of the original App Service or other deployment slots.
  • When you scale a deployment slot (up or out), you also scale all the other slots of the App Service. This is because all slots share the same App Service Plan.
  • Because all deployment lots run within the same App Service and its App Service Plan, deployment slots are free to use if you are using the Standard pricing tier or higher.
  • If you have installed any site extensions, you need to do that again in a deployment slot, as it is a new App Service instance.
  • Deployment slots have a different URL than the original App Service. This URL is based on the name you give the deployment slot. For instance, “staging” can become http://website-staging.azurewebsites.net.

Advantages of Deployment Slots

  1. Minimum downtime for the production website: With the Staging slot in place we can push our changes to the staging slot and test if everything works as expected and then easily swap the staging slot with production. Since Azure does this activity by changing the virtual IP of slots, it completes in seconds and the latest code changes reflect in the live website with minimum impact on the business. Managing the minimum downtimes comes with an advantage where we have a huge scope for better service catering capabilities to the customer all the time without any downtime of the other server-related issues.
  2. Rollback Deployment: Now that we deployed a new version of the app by swapping the staging slot to production, we can easily revert by again swapping the production slot with the staging slot. Rollback allows us to quickly swap the previous working version of the web in a live environment hence the way of managing infrastructure is capable of all the rollback deployment capabilities.
  3. Effective Testing: Deployment slots provide a real-time environmental setup like that of a production website in Azure so, we can do effective testing on the staging environment and there will be fewer chances of issues where anything breaks in production.

To add a new deployment slot, click Add Slot button at the top. Provide a name for the deployment slot.

If the name is staging, azure generates the following URL vmapps-staging.azurewebsites.net .You can clone your application configuration settings from another already existing deployment slot if you want to but here I will just manually do a test page.

Select the Staging deployment slot and click Finish.

Our staging slot can be seen in the resources. We now have 2 versions of our application code in Azure. One version is the production version in the production slot and the second version is the staging version in the staging slot. 

All resources section shows the App Service (Slot) as well.

Both the URL’s for production and staging slot are displayed. The new version of the app is now in the staging slot. It gives you an opportunity to test your application

The URL path of both are shown

To perform the swap operation, click the Swap link in the Azure portal.

Azure warms up the production slot before the swap operation

The swap is now complete

As expected the production website is now changed

Service Backups

The backup feature allows us to back up the Azure web app and contents are stored within a storage account

Service Backups

Logging

App service logs – offline copy of logs are stored here

LogStream – Provides real-time logging for webserver logs

(Visited 25 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.