Hey folks ๐
Just wrapped up a hands-on exercise in Azure using Bicep โ Azureโs simpler, cleaner way to define infrastructure as code. If youโre like me and enjoy seeing your resources magically appear in the Azure portal (but without all the clicking around), youโll probably enjoy this one.
Hereโs how it went down โ including what worked, what broke, and what I learned about quotas (and subscriptions that scream โplease upgrade meโ).
๐ฏ What I Set Out To Do
In this exercise, I wanted to:
- Define a Storage Account, App Service Plan, and Web App using Bicep
- Deploy it through Azure CLI
- Use my own Azure subscription (yes, even on the free tier)
- Learn how to debug when things go sideways ๐
๐งช Step 1: Define the Storage Account in Bicep
I cracked open VS Code and created a file called main.bicep
. Hereโs the starter code:
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
name: 'toylaunchstoragebob' // ๐ Must be globally unique, lowercase, no special chars
location: 'westus'
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
accessTier: 'Hot'
}
}
โ
Tip: Storage account names must be globally unique. I used 'toylaunchstoragebob'
โ feel free to copy or change it to match your vibe.
๐ ๏ธ Troubleshooting az login
on macOS with PowerShell
I hit a bump when trying to run az login
in PowerShell on my Mac. Turns out, PowerShell couldnโt find the Azure CLI path. If thatโs you too, hereโs how I fixed it:
- Run
which az
in Zsh/Bash โ it gave me/opt/homebrew/bin/az
- Open your PowerShell profile:
code $PROFILE
- Add this to the bottom:
$env:PATH += ":/opt/homebrew/bin"
- Restart PowerShell. Now
az login
works!
๐งโ๐ป Log In and Set Up Your Resource Group
az login
az account set --subscription "Your Subscription Name"
az group create --name BicepRG --location westus
๐ Deploy the Storage Account
az deployment group create \
--resource-group BicepRG \
--template-file main.bicep \
--name deploy-storage
โ
Head over to Azure Portal โ Resource Groups โ BicepRG
Boom. One shiny new Storage Account ๐
๐งช Step 2: Add an App Service Plan + Web App
I expanded my main.bicep
file to look like this:
resource appServicePlan 'Microsoft.Web/serverfarms@2024-04-01' = {
name: 'toylaunchappserviceplanbob'
location: 'westus'
sku: {
name: 'F1'
}
}
resource appServiceApp 'Microsoft.Web/sites@2024-04-01' = {
name: 'toylaunchappbob'
location: 'westus'
properties: {
serverFarmId: appServicePlan.id
httpsOnly: true
}
}
Then I ran the deployment again:
az deployment group create \
--resource-group BicepRG \
--template-file main.bicep \
--name deploy-app
๐ฉ And Then Azure Was Like: โNah Broโ
I got this error:
The template deployment is not valid...
"SubscriptionIsOverQuotaForSku": "This region has quota of 0 instances for your subscription..."
Translation? My free-tier subscription didnโt have enough quota in East US to deploy App Services.
โ
Fix: I switched everything to westus
and re-deployed.
โ Final Results: Check the Portal
In the Azure Portal โ Resource Groups โ BicepRG
, I saw:
- ๐๏ธ A Storage Account
- ๐งฑ An App Service Plan
- ๐ A Web App
Itโs all there. And it was all built from a single Bicep template.
๐ฆ What I Learned
Task | What I Did |
---|---|
๐พ Create Bicep Template | Defined 3 Azure resources using clean Bicep syntax |
๐ป Use Azure CLI | Deployed using az deployment group create
|
๐ค Work in My Own Subscription | Hit some quota errors, but learned how to troubleshoot |
๐ Verified the Setup | Used Azure CLI and Portal to double-check everything |
๐ค Letโs Connect
If youโre learning Azure and Infrastructure as Code too, Iโd love to connect with others on the same journey.
Drop me a message on LinkedIn and just say hi!
Top comments (0)