Create Scalable Cross-Subscription Apps with Azure Load Balancer

Umesh PanditUmesh Pandit
5 min read

Scalability is crucial for modern applications. When your app's traffic grows, you need a system that can handle the load efficiently. Azure Load Balancer is a powerful tool for managing application traffic, ensuring your app remains responsive and reliable. In this article, I'll show you how to build scalable cross-subscription applications using Azure Load Balancer.

Understanding Azure Load Balancer

First, let's talk about what Azure Load Balancer is. It is a cloud service that routes incoming network traffic to one of many servers. As a result, this avoids the saturation of one server and hence keeps performance/availability stable.

Basic Load Balancer - simplest and good when you are building an application that is small or in the development phase. Compared to the Basic Load Balancer, The Standard Load Balancer delivers much more functionality and is designed for production-grade scale-out services needing performance and high availability.

Benefits of Using Azure Load Balancer

Using Azure Load Balancer offers several benefits:

  • Scalability: It helps manage increased loads by distributing traffic efficiently.

  • High Availability: The application should work even when one of its components fails so that your system must be able to serve the redundant workload.

  • Affordable Pricing: As the pricing is based on consumption, it's an affordable way to manage your access traffic.

  • Flexibility: It lets you share traffic across different subscriptions in the event to scale your application up as needed.

Preparing Your Environment

Before we dive into the steps, let's prepare the environment. You'll need:

  • An Azure account with appropriate permissions.

  • Resource groups are set up in different subscriptions.

  • A basic understanding of Azure's networking features.

Next, you need to plan your network architecture. This setup will involve creating virtual networks and peering them across subscriptions to allow seamless communication.

Step-by-Step Guide to Building Scalable Cross-Subscription Applications

Step 1: Setting Up Resource Groups

Let's begin by setting up the foundational structure needed for your application.

  • Create Resource Groups:

    • Go to the Azure portal.

    • Navigate to "Resource groups."

Create Azure Resource Groups

  • Click "Create” on the top left.

Azure Resource groups

  • Name your resource group (e.g., "AppResourceGroup").

  • Select the appropriate subscription.

  • Click "Review + Create," then "Create."

Review + Create Azure Groups

  • Assign Permissions:

    • Navigate to the newly created resource group.

    • Go to "Access control (IAM)."

Access control (IAM)

  • Click "Add" and select "Add role assignment".

Add role assignment Azure

  • Choose the necessary role (e.g., ACR Repository Contributor).

  • Add the users (search by email) or groups that need access.

Add role assignment azure

  • Click "Save."

Step 2: Configuring Virtual Networks

With resource groups in place, it's time to set up virtual networks for communication.

  • Create Virtual Networks:

    • In the Azure portal, go to "Virtual networks."

    • Click "Create."

    • Name your virtual network (e.g., "AppVNet1").

    • Select the appropriate resource group and subscription.

    • Configure the address space and subnets.

    • Click "Review + Create," then "Create."

create virtual network

  • Peering Virtual Networks:

    • Navigate to one of the virtual networks.

    • Go to "Peerings" under Settings.

Peerings Virtual Network Azure

  • Click "Add."

  • Provide a name for the peering (e.g., "VNetPeering1").

  • Select the virtual network you want to peer with from another subscription.

  • Configure the peering settings to allow traffic between virtual networks.

  • Click "Add."

Add peering Azure

Step 3: Deploying Virtual Machines

Next, we'll deploy the virtual machines that will host your application.

  • Deploy VMs:

    • Go to "Virtual machines" in the Azure portal.

    • Click "Create."

Azure Virtual Machines

  • Choose an image (e.g., Ubuntu Server 20.04 LTS - x64 Gen2).

  • Select the appropriate resource group and subscription.

Create a virtual machine

  • Configure VM settings (e.g., VM size, admin username, and password).

  • Ensure the VM is in the appropriate virtual network.

  • Click "Review + create," then "Create."

Review + Create Azure

  • Configuring VMs:

    • Once deployed, connect to the VM using SSH or RDP.

    • Install necessary applications and services on the VM.

Step 4: Setting Up Azure Load Balancer

Now that our VMs are ready, we can set up the Azure Load Balancer to manage traffic.

  • Create a Load Balancer:

    • In the Azure portal, go to "Load balancers".

    • Click "Create a Load Balancer."

Create Load balancer

  • Select "Standard" for SKU.

  • Name your load balancer (e.g., "AppLoadBalancer").

  • Select the appropriate resource group and region.

  • Click "Review + Create," then "Create."

Add details to create load balancer

  • Add Backend Pools:

    • Navigate to the load balancer.

    • Go to "Backend pools" under Settings.

    • Click "Add."

    • Name your backend pool (e.g., "BackendPool1").

    • Add the VMs from different subscriptions to the backend pool.

    • Click "Add."

  • Configure Load Balancing Rules:

    • Go to "Load balancing rules" under Settings.

    • Click "Add."

    • Name your rule (e.g., "HTTPRule").

    • Configure the frontend IP, backend pool, and health probe.

    • Set the load balancing algorithm and session persistence as needed.

    • Click "OK."

Step 5: Testing and Monitoring

Finally, we need to test and monitor the setup to ensure everything is working correctly.

  • Test the Setup:

    • Send test traffic to your application.

    • Ensure that the load balancer is distributing the traffic evenly across the VMs.

    • Check the performance and responsiveness of your application.

  • Monitoring Tools:

    • In the Azure portal, go to "Monitor."

    • Set up alerts for metrics such as CPU usage, network traffic, and health probe status.

    • Use logs and dashboards to monitor the performance of your load balancer and VMs.

Personal Insights

Reflecting on these steps, building a scalable cross-subscription application requires careful planning and execution. From my experience, leveraging Azure Load Balancer's capabilities significantly improves application performance and reliability. Utilizing Azure Load Balancer not only enhances scalability but also simplifies managing traffic across different subscriptions. This approach can be a game-changer for businesses looking to optimize their cloud infrastructure.

Follow Umesh Pandit

linkedin.com/in/umeshpandit

x.com/umeshpanditax

https://www.linkedin.com/newsletters/umesh-pandit-s-notes-7038805524523483137/

0
Subscribe to my newsletter

Read articles from Umesh Pandit directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Umesh Pandit
Umesh Pandit

🚀 Advisor Solution Architect at DXC Technology | 16+ years of IT Industry Experience 🚀 I am a seasoned Advisor Solution Architect at DXC Technology, a premier global digital transformation solutions provider. With over 16 years of rich experience in the IT industry, I specialize in helping organizations translate their strategic business objectives into tangible realities through innovative and scalable solutions leveraging Microsoft technologies. My expertise spans a wide spectrum of Microsoft offerings including Azure, Dynamics 365 for Finance and Operations, AI, Microsoft 365, Security, Deployment, Migration, and Administration. Additionally, I bring valuable experience in SAP, CRM, Power Platform, and other cloud platforms to the table. Throughout my career, I have spearheaded the successful delivery and support of over 300 projects, consistently adhering to the best practices and standards set by Microsoft and the industry at large. Moreover, I take pride in my role as an educator and mentor, having empowered over 50,000 professionals and students worldwide through training, guidance, and knowledge-sharing initiatives. Passionate about staying at the forefront of emerging technologies, I thrive on continuous learning and am dedicated to fostering a culture of knowledge exchange within the tech community. Let's connect and explore opportunities to drive transformative outcomes together!