Instructor Setup Guide

This page covers everything you need to do before participants arrive, plus the exact permissions to grant in both GitHub and Azure. Students have no sub-level permissions β€” each gets exactly one pre-created resource group and Contributor on it.


0. πŸ€– Automated pre-lab setup (run these first)

The whole class – one resource group, one managed identity and one explicit federated credential per student, with Contributor on that student’s group only – is built and torn down by the scripts in scripts/admin/, locally or from a GitHub Actions workflow in a private copy of this repository. Nothing tenant-specific is in the repo: tenant, subscription, region and event name are parameters or repository variables, and the roster is a gitignored CSV.

Follow Instructor Environment Setup for the walkthrough, and Instructor Admin Tools for the reference:

  1. New-WorkshopBootstrap.ps1 – once per subscription: the automation identity
  2. New-WorkshopEnvironment.ps1 – plan, then create the class from the roster
  3. Set-LabPolicy.ps1 – optional policy guardrails (step 0B below)
  4. Students set the values from their own row of workshop-client-ids.csv on their fork and run L1.1
  5. Remove-WorkshopEnvironment.ps1 – tear the class down by tag

[!IMPORTANT] The TechCon-era shared deploy identity is retired. Do not recreate a shared identity or any wildcard / name-pattern federated credential: every student identity trusts exactly one fork.

Step 0B β€” Apply Azure Policy guardrails

# Preview: the student groups New-WorkshopEnvironment.ps1 created for the event
./scripts/admin/Set-LabPolicy.ps1 -SubscriptionId <subscription-id> -EventName MyEvent -WhatIf

# Apply
./scripts/admin/Set-LabPolicy.ps1 -SubscriptionId <subscription-id> -EventName MyEvent

# Groups created by hand (section 3 below) are found by name prefix instead
./scripts/admin/Set-LabPolicy.ps1 -SubscriptionId <subscription-id> -ResourceGroupPrefix rg-techdemo-

[!WARNING] Pick the groups explicitly. With -EventName, Set-LabPolicy.ps1 targets exactly the student groups New-WorkshopEnvironment.ps1 tagged for that event, whatever they are called. Without it, it falls back to the rg-techdemo- name prefix (-ResourceGroupPrefix). A group that matches neither β€” for example one created by hand under another name, using the per-participant steps in section 3 below β€” gets no policy guardrails at all, silently: nothing errors, the deployment just isn’t constrained.

This assigns 6 Azure Policy assignments to every target resource group:

  • Allowed locations β€” only eastus2 and westus2 deployments are permitted (L1.4 deploys its failover stack to westus2)
  • Allowed resource types β€” only the ~38 resource types used by L1.1–L1.4 are permitted
  • Inherit tag Γ— 4 β€” Owner, Event, Date, Instructor automatically propagate from the RG to every resource deployed inside it

[!NOTE] Policy assignments take effect within a few minutes. New resources that violate the policy are blocked at deployment time with a clear error message.


🧾 Overview: what you provision per participant

Item What it is Who creates it
GitHub org membership Participant can fork and use Actions Instructor (invite)
GitHub Copilot seat Required for Copilot agent mode Instructor (assign)
Azure resource group e.g. rg-techdemo-alice Instructor
Contributor on RG Lets the participant deploy resources Instructor
Owner (or RBAC Admin) on RG Lets the OIDC setup script grant Contributor to the service principal Instructor, OR instructor runs setup on the student’s behalf
Entra app registration (optional) The OIDC identity; can be student-created or instructor-created Instructor or student (see below)

1. πŸ™ GitHub Organization Permissions

What participants need

Permission How to grant Notes
Org membership Invite them at github.com/<org>/people Role: Member is enough
Fork the lab repo Org Settings β†’ Member privileges β†’ Allow forking of repositories β†’ Enabled Without this, students cannot get their own copy
GitHub Actions on forks Org Settings β†’ Actions β†’ General β†’ Allow all actions and reusable workflows On first run, Actions on a forked public repo require a one-time approval click β€” walk participants through this
Copilot license Org Settings β†’ Copilot β†’ Access β†’ add member Business or Enterprise required; Free tier also works for individuals
Secrets & variables (their fork) Automatic Participants own their fork, so they have Admin rights on it

Org-level settings checklist

GitHub β†’ <org> β†’ Settings β†’ Actions β†’ General
  βœ…  Allow all actions and reusable workflows
  βœ…  Allow GitHub Actions to create and approve pull requests (optional, not required)

GitHub β†’ <org> β†’ Settings β†’ Member privileges
  βœ…  Allow forking of repositories

GitHub β†’ <org> β†’ Settings β†’ Copilot
  βœ…  Copilot seats assigned to all participants

Private repo? If you made the lab repo private in the org, participants will need at least Read access to it so they can fork it. Grant via <repo> β†’ Settings β†’ Collaborators and teams.


2. ☁️ Azure Permissions

Summary: what each participant’s OIDC service principal needs

The scripts/Setup-Oidc.ps1 script creates an Entra app registration + service principal and grants it Contributor on the participant’s resource group. Those two actions require different permissions:

Action Required Azure role
az ad app create (Entra app registration) Application Developer (or any role that allows app registration) in Entra ID. By default, all tenant users can register apps β€” check your tenant.
az role assignment create (grant Contributor to the SP) Owner or Role Based Access Control Administrator on the resource group. Contributor alone is not enough.

This avoids giving participants elevated RBAC rights and works regardless of tenant app-registration policies.

Instructor does (once per participant):

# 1. Create the resource group
az group create --name rg-techdemo-<prefix> --location eastus2

# 2. Run the OIDC setup on the participant's behalf (signed in as instructor)
./scripts/Setup-Oidc.ps1 `
    -GitHubRepo "<orgOrUser>/Demo-IaC_Demo_with_VSCode" `
    -ResourceGroup "rg-techdemo-<prefix>" `
    -Prefix "<prefix>" `
    -Location "eastus2" `
    -AlertEmail "<participant-email>"
# This creates: iac-demo-<prefix> Entra app, federated credential, Contributor on RG,
# and pushes all secrets + variables to the participant's fork.

# 3. Grant the participant ONLY Contributor on their RG (not RBAC admin):
STUDENT_OID=$(az ad user show --id <participant-upn-or-email> --query id -o tsv)
az role assignment create \
  --assignee-object-id $STUDENT_OID \
  --assignee-principal-type User \
  --role Contributor \
  --scope /subscriptions/<sub-id>/resourceGroups/rg-techdemo-<prefix>

After step 2, the participant only needs to sign in with az login and gh auth login β€” no extra setup required.

Alternative path: student runs setup themselves

If your tenant allows app registration (default) and you grant participants Owner on their RG:

# Grant Owner on their RG (instead of just Contributor):
az role assignment create \
  --assignee <student-email-or-object-id> \
  --role Owner \
  --scope /subscriptions/<sub-id>/resourceGroups/rg-techdemo-<prefix>

The student then runs Setup-Oidc.ps1 themselves, which creates their own app registration and sets up the federated credential.

Azure roles summary

Who Scope Required role
Instructor (running setup) Subscription Contributor (to create RGs) + User Access Administrator (to grant roles) β€” OR Owner covers both
Instructor (Entra) Tenant Application Administrator or Global Administrator (only if tenant restricts app registration)
Participant (classroom mode) Their resource group Contributor
OIDC service principal (iac-demo-<prefix>) Their resource group Contributor (granted by the setup script)

Entra app registration tenant setting

Check whether your tenant allows all users to register apps:

Azure Portal β†’ Entra ID β†’ Users β†’ User settings β†’
  "Users can register applications" β†’ Yes (default) or No (restricted)

If No, you must either:

  • Grant participants the Application Developer Entra role, OR
  • Run Setup-Oidc.ps1 as an instructor (Application Administrator) and share the resulting secrets

3. βœ… Per-Participant Setup Checklist

Run this for each participant before the lab. Replace <prefix> with their unique short identifier (initials, first name, etc., max 12 characters).

PARTICIPANT:  <name>
PREFIX:       <prefix>        ← must be unique, ≀12 chars, alphanumeric
GITHUB FORK:  <orgOrUser>/Demo-IaC_Demo_with_VSCode
RESOURCE GROUP: rg-techdemo-<prefix>
REGION:       eastus2

GitHub (5 min)

  • Invite to org β†’ org Member
  • Assign Copilot seat
  • Confirm participant has forked the repo
  • Confirm participant has enabled Actions on their fork (first-time approval)

Azure (10 min)

  • az group create --name rg-techdemo-<prefix> --location eastus2
  • ./scripts/Setup-Oidc.ps1 -GitHubRepo "<fork>" -ResourceGroup "rg-techdemo-<prefix>" -Prefix "<prefix>" -AlertEmail "<email>"
  • Verify secrets pushed: gh secret list --repo <fork>
  • Verify variables pushed: gh variable list --repo <fork>
  • Confirm Contributor assignment: az role assignment list --scope /subscriptions/<sub>/resourceGroups/rg-techdemo-<prefix> --role Contributor -o table

Participant self-check (before starting)

  • az login β†’ correct subscription shows
  • gh auth status β†’ logged in
  • Actions tab β†’ workflows visible (not disabled)
  • gh secret list β†’ shows AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID, AZURE_RESOURCE_GROUP, VM_ADMIN_PASSWORD, SQL_ADMIN_PASSWORD
  • gh variable list β†’ shows AZURE_PREFIX, AZURE_LOCATION

4. πŸ”€ Naming Conventions & Collision Prevention

All resource names in this lab are derived from AZURE_PREFIX. Choosing unique prefixes prevents naming conflicts in the shared subscription.

Example prefix Entra app name Hub VNet SQL server (L1.3)
alice iac-demo-alice vnet-alice-hub sql-alice-<hash>
bob iac-demo-bob vnet-bob-hub sql-bob-<hash>

Rules for prefixes:

  • Max 12 characters (enforced by @maxLength(12) in Bicep)
  • Alphanumeric + hyphens only
  • Must be unique across all participants in the same subscription

Suggested convention: first name or initials, e.g. alice, jsmith, team1.

Some resources (Azure SQL, Key Vault) require globally unique names. The Bicep templates use uniqueString(subscription().id, prefix) to generate a stable 6-char suffix β€” this is unique per subscription+prefix combination, which is sufficient as long as all students are in the same subscription with different prefixes.


5. πŸ’² Cost & Quota

Per-participant cost estimate (while resources are running)

Lab Key billable resources Approx. hourly cost
L1.1 1Γ— Bastion Basic, 1Γ— B2s VM ~$0.25/hr
L1.2 + Azure Firewall Standard +$1.25/hr
L1.3 + Container Apps, SQL Basic, Key Vault +$0.10/hr
L1.4 + Front Door Standard, 1Γ— secondary Container App +$0.05/hr

Azure Firewall and Bastion are the cost drivers. For a 4-hour lab with 20 participants all at L1.2: ~20 Γ— $1.50 Γ— 4 = ~$120.

Quota to check before the lab

Run these in the subscription:

# VM cores (Standard_B family)
az vm list-usage -l eastus2 --query "[?contains(name.value,'standardBSFamily')]" -o table

# Public IP addresses
az network list-usages -l eastus2 --query "[?name.value=='PublicIPAddresses']" -o table

# Container Apps environments
az containerapp env list -o table

Check the output to confirm the selected region has available capacity.

Each student at L1.2 uses: ~4 B2s cores, 1 Firewall, 1 Bastion, 1 PIP. Each student at L1.3 uses: 1 Container Apps environment, 1 SQL server, 1 Key Vault. Each student at L1.4 uses: 1 additional Container Apps environment + 1 SQL server in westus2 + 1 Front Door.

Cleanup after the lab

# Per student (classroom mode β€” deletes resources, not the RG):
./scripts/Cleanup-Labs.ps1 -ResourceGroup "rg-techdemo-<prefix>"

# Instructor: delete the RG entirely when the lab is fully done:
az group delete --name rg-techdemo-<prefix> --yes

# Remove the OIDC app registration:
./scripts/Cleanup-Labs.ps1 -Prefix "<prefix>" -RemoveOidc

6. πŸ›Ÿ Troubleshooting Common Instructor Issues

Symptom Likely cause Fix
AADSTS700213: No matching federated identity record found Federated credential subject doesn’t match the fork’s owner/repo/branch Re-run Setup-Oidc.ps1 with the correct -GitHubRepo value
Workflow fails: Missing repo secret 'AZURE_RESOURCE_GROUP' Student’s fork didn’t receive the secret Re-run Setup-Oidc.ps1 -ResourceGroup ... targeting the student’s fork
az role assignment create fails with AuthorizationFailed Instructor account lacks Owner/RBAC-Admin on the scope Check your role at the RG scope: az role assignment list --scope <rg-id> --assignee <you> -o table
Students’ Actions are blocked on first run Fork’s Actions require one-time approval Walk them through: Actions tab β†’ β€œI understand my workflows, go ahead and enable them”
Two students’ resource names clash Same prefix used Re-run setup for one student with a different prefix, update their AZURE_PREFIX variable
Bicep deployment fails: ResourceGroupNotFound AZURE_RESOURCE_GROUP secret is wrong or RG wasn’t created Verify: az group show --name <rg> and check the secret value in GitHub



GitHub feature spotlight Β· One fork per participant

You just used it: the model you are provisioning gives every student their own fork, and therefore their own Actions runs, their own secrets and their own blast radius. Nobody can break anyone else’s lab. Find it: each student’s repo at github.com/<their-handle>/Demo-IaC_Demo_with_VSCode. Their OIDC subject names their fork, so their credential only works from it. Beyond the lab: this is why the classroom scales. Twenty students need no coordination, no shared branch and no queue β€” and a mistake stays inside one fork. Docs β†’