DEV Community

Cover image for Implementing Azure Web Apps: From Setup to Scaling Your Cloud Applications
Oladosu Ibrahim
Oladosu Ibrahim

Posted on

Implementing Azure Web Apps: From Setup to Scaling Your Cloud Applications

Introduction

As businesses modernize their IT infrastructure, hosting web applications in the cloud has become a key strategy for improving scalability, reliability, and cost efficiency. Many organizations still rely on on-premises servers to host their company websites, but these setups often come with high maintenance costs, limited scalability, and hardware refresh challenges.

To eliminate the burden of physical infrastructure, companies are increasingly adopting Azure App Service a fully managed Platform as a Service (PaaS) solution for hosting web applications built on popular runtime stacks like .NET, Java, Python, Node.js, and PHP.

In this hands-on lab, you’ll learn how to:

  • Create and configure an Azure Web App.
  • Set up a deployment slot for staging and production environments.
  • Configure continuous deployment using GitHub.
  • Swap deployment slots for seamless updates.
  • Implement autoscaling to ensure performance under variable loads.

By the end of this guide, you’ll understand how Azure Web Apps help teams deploy faster, scale smarter, and maintain high availability all without managing servers.

Skilling Objectives

You will learn how to:

  • Deploy a PHP-based Azure Web App using App Service.
  • Configure staging and production deployment slots for testing and release management.
  • Automate deployments using a GitHub repository.
  • Perform slot swaps to promote tested code into production.
  • Configure autoscaling to automatically adjust resources based on demand.

Task 1: Create and Configure an Azure Web App

Why start here?

The Azure Web App is the foundational component of Azure App Service. It provides a managed environment to host your website code, manage scaling, and integrate DevOps pipelines — all without provisioning virtual machines.

Steps

  1. Sign in to the Azure portal.

  2. Search for App Services and select + Create → Web App.
    Image1
    Image2

  3. On the Basics tab, provide:

    • Subscription: Your Azure subscription
    • Resource group: Create or select an existing group
    • Web app name: A unique name (e.g., WebAppDemo123)
    • Publish: Code
    • Runtime stack: PHP 8.2
    • Operating system: Linux
    • Region: East US
    • Pricing plan: Premium V3 (P1V3) Image3 Image4
  4. Select Review + Create → Create.
    Image5

  5. Once deployment completes, click Go to Resource to view your newly created Web App.
    Image6

You now have a fully managed Azure Web App running PHP on Linux ready for configuration and deployment.

Task 2: Create and Configure a Deployment Slot

Why it matters

Deployment slots allow you to host multiple versions of your app within the same App Service plan. They are invaluable for staging, testing, and blue-green deployments without downtime.

Steps

  1. From your Web App’s blade, open the Default domain link to confirm the app is running.
    Image7
    Image8

  2. Return to the portal and navigate to Deployment slots under your Web App.

  3. Click + Add Slot, name it staging, and choose Do not clone settings.
    Image9

  4. Select Add. Once created, you’ll see both Production and Staging slots listed.
    Image10

  5. Open the staging slot to view its unique URL.
    Image11

You now have a staging environment to test your app safely before releasing it to production.

Task 3: Configure Web App Deployment Settings

Why it matters

Continuous deployment ensures that your app service always reflects the latest tested code. By connecting your Web App to a GitHub repository, updates can be deployed automatically to your staging environment.

Steps

  1. In the staging slot, select Deployment Center → Settings.

  2. For Source, select External Git.
    Image12

  3. You notice an Error SCM basic authentication is disabled, click Enabled it.
    Image13

  4. Check the box for SCM basic Auth Publishing Credentials to enable
    Image14

  5. In the repository field, enter:

   https://github.com/Azure-Samples/php-docs-hello-world
Enter fullscreen mode Exit fullscreen mode
  1. Set the Branch to master and click Save.
    Image15

  2. Go to Overview and open the Default domain link.

  3. Verify the deployed app displays “Hello World!” confirming that deployment succeeded.
    Image16

This setup enables automated updates from your GitHub repository to your staging environment.

Task 4: Swap Deployment Slots

Why it matters

Swapping deployment slots allows you to promote code that has been tested in staging directly into production with minimal risk and zero downtime. It’s an essential practice in modern DevOps workflows.

Steps

  1. Navigate back to Deployment slots in your Web App.
  2. Click Swap, review settings, and then select Start Swap.
    Image17
    Image18

  3. Once the swap completes, go back to your Web App Overview and open the production domain.

  4. Verify that the production app now displays the “Hello World!” page.

Your previously tested staging code is now live in production — ensuring safe and seamless deployment.

Task 5: Configure and Test Autoscaling

Why it matters

Autoscaling ensures that your web app performs optimally under fluctuating traffic. Azure automatically adjusts the number of running instances based on real-time metrics like CPU usage or response time.

Steps

  1. In your App Service plan, go to Scale out (App Service plan).
  2. Select Automatic scaling mode.
  3. In the Maximum burst field, set 2 and click Save.
    Image19

  4. Notice an Error occurred after Scaling out
    Image20

  5. To simulate load, navigate to Diagnose and solve problems → Load Test your App.
    Image21

  6. Create a new load test, assign a Unique name for the test (webtest), Review and Create.
    Image22

  7. From the Overview | Create by adding HTTP requests, select Create.
    Image23

  8. On the Test plan tab, click Add request. In the URL field, paste in your Default domain URL. Ensure this is properly formatted and begins with https://. Select Add to save your changes.
    Image24

  9. Select Review + create and Create.
    Image26

  10. Observe live metrics such as Virtual users, Response time, and Requests per second.
    Image27

  11. Stop the test once you verify that scaling is working correctly.

Autoscaling dynamically adjusts resources to maintain performance while optimizing cost — a key feature for production workloads.

Cleanup Your Resources

To avoid unnecessary costs, delete your lab resources after completion.

In the Azure portal:

  1. Go to your resource group.
  2. Select Delete resource group, enter the name, and confirm. Image28

Conclusion

By completing this hands-on guide, you’ve implemented a full lifecycle workflow for deploying and managing web apps in Azure — from setup and deployment to autoscaling and cleanup.

Azure Web Apps simplifies application hosting by eliminating the need for physical infrastructure, offering built-in deployment pipelines, and supporting high availability and scalability out of the box.

Whether you’re migrating from on-premises servers or building new cloud-native applications, Azure App Service empowers your organization to innovate faster while keeping operations secure, scalable, and cost-effective.

Top comments (0)