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 ๐ฎ#
Download and Configure
# Clone or download the script chmod +x azure-deploy-vwan.sh
Modify the Variables
- Update the subscription ID
- Set your desired resource group names
- Configure your hub locations and address spaces
Run It!
./azure-deploy-vwan.sh
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 ๐ก#
Testing First
- Always test in a non-production environment first
- Use the confirmation prompt to verify your settings before proceeding
Address Space Planning
- Plan your hub address spaces carefully to avoid overlaps
- Keep some space for future expansion
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! ๐