Exercise 7. Exporting a Template from Azure Portal

Goal: See your week‑one Ubuntu VM and its network as Infrastructure as Code by exporting the deployment to an ARM template. This will give you a concrete reference before we author templates ourselves.

Estimated time: 15–25 minutes


Learning outcomes

Prerequisites

What you’ll produce


Steps

  1. Open your Resource Group

    • Azure Portal → Resource groups → select the RG that contains your VM, VNet, NSG, Public IP, NIC.
  2. Export the template

    • In the RG, look for Export template (sometimes under Settings or Automation).
    • Click Export templateDownload (ZIP).
  3. Unpack & open in VS Code

    • Unzip locally. Open the folder in VS Code.
    • Files you should see: template.json, parameters.json, and a README snippet.
    • (Optional) Install Azure Resource Manager (ARM) Tools extension for JSON schema help.
  4. Read the template (guided tour)

    • parameters → values the template expects (e.g., location, admin username).
    • variables → name building or convenience values.
    • resources → look for these types and write them down:
      • Microsoft.Network/virtualNetworks
      • Microsoft.Network/networkSecurityGroups
      • Microsoft.Network/publicIPAddresses
      • Microsoft.Network/networkInterfaces
      • Microsoft.Compute/virtualMachines
    • dependsOn → note how NIC depends on Public IP/NSG/VNet, and how VM depends on NIC.
    • outputs → check if any are present (often none in exports).
  5. Map to the diagram (quick check)

    • Internet → Public IPNIC/NSGVM (Nginx via cloud‑init).
    • Confirm each hop exists in resources and note the names.
  6. Notes on exports (know the limits)

    • Exports are best‑effort and may not reflect all features or your naming conventions.
    • Parameterization is basic; we’ll improve this with Bicep in the next exercise.

Verification

Create a short note (5–8 bullets) answering:


Stretch (optional)


Cleanup

None. Keep the exported template for reference; we’ll author a minimal template next.