RJ / Azure Automation Academy
INDEPENDENT ENGINEERING LEARNING HUB

Learn automation.
Build with confidence.

From your first line of code to secure, repeatable Azure infrastructure. Practical lessons for cloud and network engineers, with explanations, examples and safe exercises.

Start learning

Choose your learning path

FOUNDATIONS / 01

Azure CLI

Your first Azure session

Open lesson
FOUNDATIONS / 02

Terraform

Your first infrastructure declaration

Open lesson
FOUNDATIONS / 03

Ansible

Your first playbook

Open lesson
FOUNDATIONS / 04

Python

Read a JSON configuration

Open lesson
FOUNDATIONS / 05

PowerShell

Inspect Azure resources

Open lesson
FOUNDATIONS / 06

Bicep

Declare a resource group

Open lesson
FOUNDATIONS / 07

Git & CI/CD

Validate before deployment

Open lesson

Hands-on starter labs

Examples are educational, not production-ready. Use a dedicated sandbox and review costs, permissions and cleanup before deploying cloud resources.

Azure CLI / BEGINNER

Your first Azure session

Authenticate, select a subscription and inspect resources before making changes.

az login
az account list -o table
az account set --subscription YOUR_SUBSCRIPTION_ID
az group list -o table

Try it: Read-only after login and subscription selection. Never publish subscription identifiers or credentials.

Terraform / BEGINNER

Your first infrastructure declaration

Terraform describes desired state. Start with a local resource before deploying to Azure.

terraform {
  required_providers {
    local = {
      source = "hashicorp/local"
    }
  }
}
resource "local_file" "example" {
  filename = "hello.txt"
  content  = "Hello, automation!"
}

Try it: Save as main.tf. Run terraform init, terraform fmt, terraform validate and terraform plan. Apply only if you accept the local file change.

Ansible / BEGINNER

Your first playbook

Ansible executes tasks against an inventory. Start locally without cloud credentials.

---
- name: Learn Ansible
  hosts: localhost
  connection: local
  gather_facts: false
  tasks:
    - name: Print a message
      ansible.builtin.debug:
        msg: Hello, automation!

Try it: Save as hello.yml and run ansible-playbook -i localhost, hello.yml. The trailing comma makes the inventory an inline host list.

Python / BEGINNER

Read a JSON configuration

Python helps automate repetitive tasks and consume Azure API responses.

import json

config = json.loads('{"region": "uksouth", "environment": "lab"}')
print(config["region"])

Try it: Save as example.py and run python example.py. No cloud resources are created.

PowerShell / BEGINNER

Inspect Azure resources

Use Az PowerShell to inspect resource groups in the active subscription.

Connect-AzAccount
Get-AzContext
Get-AzResourceGroup | Select-Object ResourceGroupName, Location

Try it: Install the Az module first. Confirm the active subscription before running commands.

Bicep / BEGINNER

Declare a resource group

Bicep is Azure-native infrastructure as code. This example targets subscription scope.

targetScope = 'subscription'
param location string = 'uksouth'
resource rg 'Microsoft.Resources/resourceGroups@2024-03-01' = {
  name: 'rg-automation-lab'
  location: location
}

Try it: Save as main.bicep. Run az bicep build --file main.bicep to compile locally. Review subscription-scope what-if before deployment. Resource groups may contain billable resources.

Git & CI/CD / BEGINNER

Validate before deployment

A pipeline should check formatting and syntax before infrastructure changes.

terraform fmt -check -recursive
terraform init -backend=false
terraform validate

Try it: Run these in the directory containing Terraform configuration. A production pipeline should use pinned dependencies, federated identity, protected environments and approvals.

Expanded practical library · 25 additional lessons

Examples are illustrative and have not been executed against a live Azure subscription.

Azure

Resource inventory

Open lesson
Azure

Network inventory

Open lesson
Azure

RBAC inspection

Open lesson
Azure

Activity logs

Open lesson
Terraform

Variables

Open lesson
Terraform

Validation

Open lesson
Terraform

For expressions

Open lesson
Terraform

State inspection

Open lesson
Terraform

Drift review

Open lesson
Ansible

Inventory

Open lesson
Ansible

Variables

Open lesson
Ansible

Loops

Open lesson
Ansible

Check mode

Open lesson
Python

CIDR overlap

Open lesson
Python

Configuration validation

Open lesson
Python

Read Azure inventory

Open lesson
PowerShell

Filter resource groups

Open lesson
PowerShell

Export inventory

Open lesson
Bicep

Parameters and outputs

Open lesson
Bicep

What-if review

Open lesson
Git

Review a proposed change

Open lesson
CI/CD

Python syntax gate

Open lesson
Architecture

Address planning

Open lesson
Architecture

Private endpoint DNS

Open lesson
Architecture

Change assurance

Open lesson
Azure / PRACTICAL

Resource inventory

Query resources in the selected subscription without changing them.

az resource list --query '[].{name:name,type:type}' -o table

Exercise and troubleshooting: Check az account show if the list is empty.

Azure / PRACTICAL

Network inventory

Inspect address spaces before designing peering.

az network vnet list --query '[].{name:name,group:resourceGroup,prefix:addressSpace.addressPrefixes}' -o json

Exercise and troubleshooting: Verify permissions and subscription context.

Azure / PRACTICAL

RBAC inspection

Review visible role assignments; prefer narrow scopes and least privilege.

az role assignment list --all -o table

Exercise and troubleshooting: A partial view may reflect limited permissions.

Azure / PRACTICAL

Activity logs

Inspect control-plane events to investigate changes.

az monitor activity-log list --offset 1h -o table

Exercise and troubleshooting: Activity logs do not replace guest or application logs.

Terraform / PRACTICAL

Variables

Separate environment inputs from resource declarations. Save in an empty directory as main.tf.

variable "region" {
  type = string
  default = "uksouth"
}
output "region" { value = var.region }

Exercise and troubleshooting: Run init and plan; override with -var region=ukwest.

Terraform / PRACTICAL

Validation

Reject invalid inputs early.

variable "environment" {
  type = string
  validation {
    condition = contains(["dev", "test", "prod"], var.environment)
    error_message = "Choose dev, test or prod."
  }
}

Exercise and troubleshooting: Run terraform plan -var environment=invalid and inspect the error.

Terraform / PRACTICAL

For expressions

Generate predictable naming without repeating code.

locals {
  names = ["hub", "app", "data"]
}
output "resource_names" {
  value = [for n in local.names : "rg-${n}-lab"]
}

Exercise and troubleshooting: Use terraform plan to inspect the output.

Terraform / PRACTICAL

State inspection

State links declared resources to real objects. Use only in your own initialized lab.

terraform state list
terraform show

Exercise and troubleshooting: State can contain sensitive values; never commit it.

Terraform / PRACTICAL

Drift review

Review differences between state and actual infrastructure without proposing configuration changes.

terraform plan -refresh-only

Exercise and troubleshooting: Do not apply until the cause is understood.

Ansible / PRACTICAL

Inventory

Save as inventory.ini; inventory groups identify managed hosts.

[lab]
localhost ansible_connection=local

Exercise and troubleshooting: Run ansible -i inventory.ini lab -m ping; install Ansible first.

Ansible / PRACTICAL

Variables

Save as playbook.yml and run with local inventory.

- hosts: localhost
  connection: local
  gather_facts: false
  vars:
    region: uksouth
  tasks:
    - ansible.builtin.debug:
        msg: "{{ region }}"

Exercise and troubleshooting: Quote template expressions to avoid YAML parsing errors.

Ansible / PRACTICAL

Loops

Repeat a task for each item without copying it.

- hosts: localhost
  connection: local
  gather_facts: false
  tasks:
    - ansible.builtin.debug:
        msg: "{{ item }}"
      loop: [hub, app, data]

Exercise and troubleshooting: Run ansible-playbook -i localhost, playbook.yml.

Ansible / PRACTICAL

Check mode

Preview supported changes before execution.

ansible-playbook -i inventory.ini playbook.yml --check --diff

Exercise and troubleshooting: Not every module supports check mode; diffs can expose secrets.

Python / PRACTICAL

CIDR overlap

Detect overlapping ranges before creating a network design.

from ipaddress import ip_network
hub = ip_network('10.0.0.0/16')
spoke = ip_network('10.1.0.0/16')
print(hub.overlaps(spoke))

Exercise and troubleshooting: Expected False; try 10.0.1.0/24 to see True.

Python / PRACTICAL

Configuration validation

Validate configuration before using cloud APIs.

config = {'environment': 'dev'}
if config['environment'] not in {'dev', 'test', 'prod'}:
    raise ValueError('Invalid environment')
print('Valid')

Exercise and troubleshooting: Change dev to invalid and observe the exception.

Python / PRACTICAL

Read Azure inventory

Install azure-identity and azure-mgmt-resource, authenticate and set the subscription environment variable.

from azure.identity import DefaultAzureCredential
from azure.mgmt.resource import ResourceManagementClient
import os
client = ResourceManagementClient(DefaultAzureCredential(), os.environ['AZURE_SUBSCRIPTION_ID'])
for group in client.resource_groups.list():
    print(group.name)

Exercise and troubleshooting: Requires resource-group read permission; never hardcode credentials.

PowerShell / PRACTICAL

Filter resource groups

Filter structured objects rather than parsing text.

Get-AzResourceGroup | Where-Object Location -eq 'uksouth' | Select-Object ResourceGroupName

Exercise and troubleshooting: Connect-AzAccount and confirm the context first.

PowerShell / PRACTICAL

Export inventory

Create a local inventory report.

Get-AzResourceGroup | Select-Object ResourceGroupName,Location | Export-Csv inventory.csv -NoTypeInformation

Exercise and troubleshooting: The output may contain internal resource names; keep it private.

Bicep / PRACTICAL

Parameters and outputs

Use parameters for deployment inputs and outputs for non-secret results.

param environment string = 'dev'
output name string = 'rg-lab-${environment}'

Exercise and troubleshooting: Compile locally with az bicep build --file main.bicep.

Bicep / PRACTICAL

What-if review

Preview a subscription-scope template before deploying.

az deployment sub what-if --location uksouth --template-file main.bicep

Exercise and troubleshooting: Requires appropriate Azure permissions; review unexpected changes.

Git / PRACTICAL

Review a proposed change

Inspect local and staged changes before committing.

git status
git diff
git diff --staged

Exercise and troubleshooting: Never commit secrets or Terraform state.

CI/CD / PRACTICAL

Python syntax gate

Catch Python syntax errors before running tests.

python -m compileall -q .

Exercise and troubleshooting: Syntax checks do not prove correctness; add unit tests.

Architecture / PRACTICAL

Address planning

Reserve non-overlapping ranges and plan growth; these are illustrative addresses.

Hub: 10.0.0.0/16
Application spoke: 10.1.0.0/16
Data spoke: 10.2.0.0/16

Exercise and troubleshooting: Validate against on-premises and other cloud ranges before deployment.

Architecture / PRACTICAL

Private endpoint DNS

From an authorized network, verify resolution follows the intended private DNS path.

nslookup YOUR_STORAGE_ACCOUNT.blob.core.windows.net

Exercise and troubleshooting: Compare results from inside and outside the network; inspect DNS zone links and forwarding.

Architecture / PRACTICAL

Change assurance

Treat automation as a controlled engineering change, not merely a script.

1. Capture current state
2. Validate proposed changes
3. Review blast radius
4. Approve deployment
5. Verify service health
6. Roll back if acceptance criteria fail

Exercise and troubleshooting: Define rollback and measurable acceptance criteria before deploying.

Beyond the basics

PLANNED

Azure networking and identity

PLANNED

Terraform modules and remote state

PLANNED

Ansible Azure inventory and roles

PLANNED

Python Azure SDK and APIs

PLANNED

CI/CD with workload identity

PLANNED

Enterprise landing zones and governance