This article introduces a new Azure service which is called “Azure Web Apps”. Azure Web Apps are the compute resources for hosting your web application. The application code runs in a managed VM so that you don’t need to manage the infrastructure. The code can be in any language or framework that is supported by Azure App Service, such as:

  • .NET
  • Node.js
  • PHP
  • Java
  • Python
  • HTML

You can use Visual Studio Team Service to automatically deliver your ASP.NET Core web app to Azure App Services. Depending the pricing tier chosen, Azure Web Apps offers high availability, auto-scaling, backup, or traffic management.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

If you want to backup your Azure VMs, I advise you to install Vembu BDR backup server. If you want to know more about Vembu and Azure Backup, read this guide: https://www.bdrsuite.com/microsoft-azure-vm-backup-solution/

Even if you don’t need to manage the operating system, you can choose between Windows and Linux. In this article, I will describe the following steps:

  • Create Azure Web App
  • Create Azure App Service Plan
  • Deploy a simple PHP website
  • Swap between production slot and development slot
  • Connect to Azure Web App using SSH

Create the Azure Web App

Download Banner

Go to the Azure Portal, click “More Services” and search for “Web App”:

Azure-Web-Apps

Then click “Create App Services” in order to create your App Service. Now, you can select the Web App you want depending your needs. You can deploy CRM, HTML website, PHP Web App, … In my case, I select “Web App” in which I will deploy a simple PHP page:

Azure-Web-Apps

In order to create the Web App, you must enter the following information:

  • The Web App name
  • Select your Azure subscription
  • Select a Resource Group or create a new one
  • Select the operating system (Windows or Linux)
  • Select the Azure App Service Plan
  • Select the language of your application

Azure-Web-Apps

Azure is not free, so you must select your Azure App Service Plan. If you don’t have any Azure App Service Plan, you must create a new one. Enter a name, select a location and finally a pricing tier depending your needs. Here, I select “S1 Standard”:

Azure-Web-Apps

For those of you who want to create the Web App using Azure CLI, you can use the following commands. The first one will create your Azure App Service Plan and the second one will create the Web App:

az appservice plan create –name myAppServicePlan –resource-group myResourceGroup –sku FREE

You can replace “Free” by the following values:

  • Free,
  • Shared,
  • Basic,
  • Standard,
  • or Premium

az webapp create –resource-group myResourceGroup –plan myAppServicePlan –name –runtime “PHP|7.0”

Once the Web App is successfully created, you can see more information about the Web App:

  • The Web App status
  • The location in which the Web App is located
  • The Web App URL
  • The FTP username
  • The FTP hostname
  • And the FTPS hostname

Azure-Web-Apps

So, now you just have to open a browser and go to your Web App URL: http://.azurewebsites.net/

Azure-Web-Apps

Congratulations, your Web App is up and running. A default page is created which is called “hostingstart.html”.

Deploy a Simple PHP Website

Ok, now I want to deploy a PHP website which is very very basic. Simply download this project from GitHub: https://github.com/Azure-Samples/php-docs-hello-world and extract it. You will get a file which is called “index.php”. This code will display “Hello World” when you will open your Web App.

Before deploying the “index.php” file, you must configure the “Deployment option” section. In my case I want to set up a local repository, but if your code is hosted on a remote Git repository, you can select GitHub.

Azure-Web-Apps

Once you successfully created the deployment option, you must create a “Deployment credentials”. These credentials allow you to connect through FTP to your Web App in order to deploy your code.

Azure-Web-Apps

When you deploy your code, you will notice a “wwwroot” folder. This folder must contain your application files. Please note that you can remove the “hostingstart.html” created by Azure. Then, refresh your Web App and confirm that your application is successfully deployed.

Azure-Web-Apps

Swap Between Two Slots

Azure offers a cool feature which is called “Deployment slot”. It allows you to deploy different versions of your web app to different URLs. You can test a certain version and then swap content and configuration between slots. Select “Deployment slots” and click “Add”. Then, enter the slot name and select the configuration source.

You can create an empty slot or duplicate the production Web App by cloning the configuration from the main Web App.

Azure-Web-Apps

Once the slot is created, open this slot and notice the following URL which is a little bit different than the main Web App URL.

  • http://.azurewebsites.net/
  • http://.azurewebsites.net/

Azure-Web-Apps

Now, the only step to perform is to “Swap” from the production slot to the new slot previously created. You just have to click “Swap”:

Azure-Web-Apps

Finally, select the source slot and the destination slot. You can also select the swap type between a direct swap or preview swap.

Azure-Web-Apps

In my case, I swap production and slot1. So it means that:

  • “Production” slot will display the default page
  • “Slot1” slot will display my simple PHP website

Let’s confirm if the swap has been successfully performed:

Azure-Web-Apps

Connect to Azure Web App using SSH

By default, you can connect to your Web App using:

  • HTTP
  • HTTPS
  • FTP
  • FTPS

But you may want to connect to your Web App VM using SSH. It is only available if you selected “Linux” when you have created your Web App. To access it, simply go to the following URL:

https://.scm.azurewebsites.net/webssh/host

Azure-Web-Apps

At this point, you are connected to the Azure Web App VM which is a Debian VM

Azure-Web-Apps

You must understand that this Virtual Machine is a limited edition. You can’t use all the linux commands, so let’s check the available commands:

# compgen -c

Azure-Web-Apps

Useful links

Below are some useful links that can help you to start with Azure Web Apps:

Conclusion

Azure App Service provides a scalable, reliable, and easy-to-use environment for hosting web applications. Thanks to this new service, DevOps engineer can use Azure App Service to deploy quickly and easily their application in a production environment. They can also switch between two environments in order to test the application before deploying in production environment.

Experience modern data protection with this latest Vembu BDR Suite v.3.8.0 FREE edition. Try the 30 days free trial here: https://www.bdrsuite.com/vembu-bdr-suite-download/

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

5/5 - (1 vote)