Skip to main content
  1. Posts/

Automating Azure Virtual WAN Deployments with azure-cli

·679 words·4 mins· loading · loading · ·
Tech Work Azure Azure-Cli Cloud Networking
Table of Contents
Automating Azure Virtual WAN - This article is part of a series.
Part : This Article

TL;DR You can grab the script from here

Automating Azure Virtual WAN Deployment with azure-cli! ๐Ÿš€
#

Hey there, cloud enthusiasts! Today, I’m super excited to share a nifty bash script that takes the pain out of deploying Azure Virtual WAN across multiple regions. If you’ve ever had to set up a complex networking infrastructure spanning different Azure regions, you know it can be quite the adventure. Well, get ready to turn that adventure into a smooth sailing journey! โ›ต

What’s This Script All About? ๐Ÿค”
#

This script is your trusty companion for automating the deployment of:

  • An Azure Virtual WAN
  • Multiple Virtual Hubs across different regions
  • Resource Groups to keep everything organized

The best part? It does all of this while keeping track of what it creates and gives you a nice summary at the end. No more wondering what happened during the deployment!

Prerequisites ๐ŸŽฏ
#

Before you dive in, make sure you have:

  • Azure CLI installed and logged in
  • Appropriate permissions across your target subscription
  • A cup of your favorite beverage (because automation is best enjoyed with coffee/tea! โ˜•)

The Configuration Magic โœจ
#

Let’s look at how to configure the script. Here’s what you’ll need to modify:

# Your core vWAN settings
VWAN_SUBSCRIPTION="your-subscription-id"
TAGS="owner=yourteam environment=prod costcenter=12345"
VWAN_RG="your-vwan-rg"
VWAN_NAME="your-vwan-name"

# Your hub configurations
declare -A VHUBS=(
    ["vhub-east-prod-1"]="sub-1:rg-east:eastus:10.1.0.0/24"
    ["vhub-west-prod-1"]="sub-1:rg-west:westus:10.2.0.0/24"
    ["vhub-central-prod-1"]="sub-1:rg-central:centralus:10.3.0.0/24"
)

Each hub configuration follows this pattern:

[hub-name]="subscription:resource-group:location:address-prefix"

What Makes This Script Awesome? ๐ŸŒŸ
#

1. Smart Resource Creation
#

The script is pretty smart about what it creates:

  • Checks if resources already exist before trying to create them
  • Creates resource groups only when needed
  • Verifies subscription access before starting (nobody likes failing halfway through!)

2. Detailed Progress Tracking
#

โœ… Resource group my-rg created successfully
โœ… Virtual WAN my-vwan created successfully
โœ… Virtual Hub my-hub creation initiated successfully

It’s like having a play-by-play commentator for your deployment!

3. Beautiful? ;) Summary Report
#

At the end of the deployment, you get a nice summary that looks something like this:

#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
#    Deployment Summary       #
#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#

Created Resource Groups:
----------------------
Name | Location | Subscription
----------------------------------------
rg-east | eastus | sub-1
rg-west | westus | sub-1
...

How to Use the Script ๐ŸŽฎ
#

  1. Download and Configure

    # Clone or download the script
    chmod +x azure-deploy-vwan.sh
    
  2. Modify the Variables

    • Update the subscription ID
    • Set your desired resource group names
    • Configure your hub locations and address spaces
  3. Run It!

    ./azure-deploy-vwan.sh
    
  4. Grab a Coffee and Watch the Magic Happen โ˜• The script will:

    • Verify your subscription
    • Create the necessary resource groups
    • Deploy the Virtual WAN
    • Create all your hubs
    • Show you a nice summary at the end

Pro Tips ๐Ÿ’ก
#

  1. Testing First

    • Always test in a non-production environment first
    • Use the confirmation prompt to verify your settings before proceeding
  2. Address Space Planning

    • Plan your hub address spaces carefully to avoid overlaps
    • Keep some space for future expansion
  3. Subscription Access

    • Make sure your account has the necessary permissions
    • The script will check this for you, but it’s good to verify beforehand

Error Handling ๐Ÿ”ง
#

The script has your back with comprehensive error handling:

  • Checks for the virtual-wan extension
  • Verifies subscription access
  • Validates resource creation
  • Continues with remaining hubs if one fails

Conclusion ๐ŸŽ‰
#

This script turns what could be hours of clicking through the Azure portal into a single command. It’s like having a Swiss Army knife for Virtual WAN deployment! Whether you’re setting up a new network infrastructure or expanding an existing one, this script has got you covered.

Remember, automation is not just about saving timeโ€”it’s about consistency, reliability, and being able to reproduce your infrastructure with confidence. And maybe having a bit more time for that coffee! โ˜•

Want to Contribute? ๐Ÿค
#

Feel free to fork, modify, and improve this script! Some ideas for enhancements:

  • Add support for hub-to-hub routing
  • Include VPN gateway deployment
  • Add support for ExpressRoute gateways
  • Implement cleanup functionality

Happy automating! ๐Ÿš€


P.S. Don’t forget to star the repo if you found this useful! And remember, the best networks are the ones you don’t have to build manually! ๐Ÿ˜‰

James Bowling
Author
James Bowling
Principal Cloud Engineer @ Global Oil/Gas Drilling Company
Automating Azure Virtual WAN - This article is part of a series.
Part : This Article

Related

Hello there! I'm back...
·449 words·3 mins· loading · loading
Life Tech Travel Work Cloud Rambling
Long Time No See
·295 words·2 mins· loading · loading
Life Tech Travel Work Kubernetes K8s Pks
The Key to the Future of the Software-Defined DataCenter at vDestination
·19 words·1 min· loading · loading
Blog Cloud Sddc