Skip to content

Step 3: Datacenter and workstation (T-3)

Path: Path A: Self-service teams (in a lead-provisioned cohort, the team lead deploys the datacenters and attendees follow Student onboarding). Who: Everyone (every member, including the team lead). When: By T-3 (3 days before day one). About 35 to 60 minutes unattended for the member stage, plus 30 minutes to set up vm-dev01.

Complete Step 1: Repo and preflight (T-14) first. Run the Step 3.1–3.2 commands from ~/src/<your-repo>/factory in PowerShell (pwsh) inside Azure Cloud Shell. Once vm-dev01 is deployed, you set up C:\src\<your-repo> on vm-dev01 in Step 3.3 and work there for the rest of the event. Your designated team lead is your first point of contact if you hit a problem.

The datacenter starts billing when you deploy it in Step 3 and continues until teardown at T+2, including while its VMs are deallocated. See Cost for per-member rates and event estimates.

Check that you are signed in and load your settings in each new terminal:

Terminal window
az account show --output table
$s = Get-Content .local/settings.json | ConvertFrom-Json
az account set --subscription $s.subscriptionId

If az account show fails, sign in again with az login --use-device-code. $s holds subscriptionId, memberIndex, suffix and location.

3.1 Deploy your datacenter and onboard Azure Arc

Section titled “3.1 Deploy your datacenter and onboard Azure Arc”
Your datacenter in your own workload subscription: vm-app01 runs the legacy Contoso University on IIS with SQL Server 2022 and is Arc-enabled; vm-dev01 is your Windows 11 workstation with VS Code, GitHub Copilot and the Upgrade agent. Both have no public IP and are reached through Azure Bastion, with a NAT gateway for outbound traffic.
What the member stage builds: vm-app01 (the legacy app) and vm-dev01 (your workstation), reached through Bastion. Open full size

The member stage runs preflight (Test-Preflight.ps1 -Fix), deploys rg-datacenter with vm-app01 (legacy Contoso University on IIS, SQL Server 2022, MSMQ) and vm-dev01 (your Windows 11 workstation), runs Test-Datacenter.ps1 while both VMs are running, and—only if every check passes—connects vm-app01 to Azure Arc.

  1. Deploy your datacenter (T-3, in Azure Cloud Shell — ~/src/<your-repo>/factory). Run one command matching your role:

    • If you are a team member (indexes 2..n):

      Terminal window
      gh workflow run platform.yml -f stage=member
    • If you are the team lead (deploying your own slot 1 datacenter):

      Terminal window
      gh workflow run platform.yml -f stage=member -f members=1

    Open the Actions tab on GitHub and approve the run if prompted. (No Windows Server Azure Hybrid Benefit licenses? Append -f no-hybrid-benefit=true to this first dispatch and tell your team lead; see Azure Hybrid Benefit.)

  2. Check the test result in the Actions run summary. Test-Datacenter.ps1 checks VM state and size, license type, Trusted Launch (secure boot and vTPM), no public IPs, Azure Bastion Standard, and in-VM checks (IIS up, SQL Server up, and the performance kit’s planted data present). It runs before Arc because Arc turns off the VM run commands that the in-VM checks use. Done when every row is PASS.

  3. Confirm Azure Arc. In the Azure portal, open Azure Arc > Machines. Done when vm-app01 shows as Connected and SQL Server instances lists its SQL Server instance. The vending stage in Step 4 checks vm-app01’s Arc connection automatically before vending your spoke.

    Onboarding this Azure VM to Arc is a lab-only simulation. In a customer environment, onboard the on-premises servers instead.

If a run fails before Arc onboarding starts, read the run log, fix the cause, and run the same command again. After Arc starts, see If you need to start over.

3.2 Run the first Arc SQL assessment and check Hybrid Benefit

Section titled “3.2 Run the first Arc SQL assessment and check Hybrid Benefit”
  1. Run the first Arc SQL migration assessment (about 15 minutes). In Azure Arc > SQL Server instances, select the instance on vm-app01, then Migration > Assessments. Choose Run assessment if needed, open the readiness details and select Azure SQL Managed Instance as the target to review. Export the report or screenshot its findings for ContosoUniversity; you triage them in C3. This follows Learn’s assessment instructions, checked 2026-10-30, not a new portal test. Older portal versions use Database migration > Assess source instance > View report. The event owner revalidates the UI before the event.

  2. Confirm Azure Hybrid Benefit and VM power state (about 5 minutes):

    Terminal window
    az vm list -g rg-datacenter -d -o table
    az vm show -g rg-datacenter -n vm-app01 --query licenseType -o tsv

    Done when both VMs are running and the second command prints Windows_Server (or None if you used no-hybrid-benefit=true).

Who runs this: Every team member—including the team lead—for their own vm-dev01.
Why: Every challenge (C1 to C10) runs inside your vm-dev01 workstation in Azure—reaching both GitHub and the private endpoints in your datacenter and spoke network from a single clone (C:\src\<your-repo> on main).

Keep two browser windows open on your own computer: one for Azure Bastion, the other for the Azure portal and this guide (allow portal pop-ups and Bastion clipboard access, and enter device sign-in codes on your own computer where your passkeys and password manager work). Each step below labels where you run it:

  1. [In Azure Cloud Shell — ~/src/<your-repo>/factory] Download your readiness artifact and print your vm-dev01 password, Step 1 suffix, and repo URL:

    Terminal window
    cd ~/src/<your-repo>/factory
    ./scripts/Get-PipelineEvidence.ps1
    $s = Get-Content .local/settings.json | ConvertFrom-Json
    (Get-Content ".local/$($s.subscriptionId)/datacenter.json" | ConvertFrom-Json).adminPassword
    $s.subscriptionId
    $s.suffix
    git remote get-url origin

    Get-PipelineEvidence.ps1 saves factory/evidence/readiness/test-datacenter.txt and writes .local/<subscription-id>/datacenter.json. Commit and push factory/evidence/readiness/test-datacenter.txt from Cloud Shell (git add evidence/readiness/test-datacenter.txt && git commit -m "docs: add readiness test output" && git push), and keep the labadmin password, $s.suffix, and repo name for step 3.

  2. [On your laptop browser — Azure portal] Connect to vm-dev01 through Bastion so you have a desktop inside the private datacenter network. Filter the portal to your directory and workload subscription, open Resource groups > rg-datacenter > vm-dev01 > Connect > Bastion, select Password, enter labadmin and the password from step 1, and choose Connect. On first sign-in, wait up to five minutes for VS Code extensions to finish installing.

  3. [On vm-dev01 — PowerShell 7 (pwsh)] Run Initialize-Workstation.ps1 to bootstrap vm-dev01 in one command. It installs Node.js 24 LTS and azd if your VM was deployed before the single-clone update, signs you in to GitHub (repo,workflow scopes), Azure CLI, and azd, sets AZURE_TOKEN_CREDENTIALS=AzureCliCredential, detects your MemberIndex and workload subscription from the VM's private IP and datacenter network. It detects the shared hub subscription only after hub peering exists; for Path A, add it after vending as described in Step 4. It creates (or clones) your private GitHub repository at C:\src\<your-repo> on main, imports the kit, writes factory/.local/settings.json and datacenter.json, and opens VS Code:

    Terminal window
    New-Item -ItemType Directory -Force C:\LabTools | Out-Null
    Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/jonathan-vella/apex-factory-hackathon/main/scripts/Initialize-Workstation.ps1' -OutFile C:\LabTools\Initialize-Workstation.ps1
    pwsh -NoProfile -File C:\LabTools\Initialize-Workstation.ps1 -GitHubOwner '<your-org>' -RepoName '<your-repo>' -Suffix '<suffix>'
    What Initialize-Workstation.ps1 runs under the hood (manual reference)

    If you ever need to run or inspect the individual sign-in, clone, and settings steps by hand in PowerShell 7 (pwsh) on vm-dev01:

    Terminal window
    gh auth login --hostname github.com --git-protocol https --scopes repo,workflow --web
    gh auth setup-git
    $u = gh api user | ConvertFrom-Json
    git config --global user.name ($u.name ?? $u.login)
    git config --global user.email "$($u.id)+$($u.login)@users.noreply.github.com"
    Terminal window
    az login --use-device-code
    az account set --subscription '<workload-subscription-id>'
    az account show --query name -o tsv
    [Environment]::SetEnvironmentVariable('AZURE_TOKEN_CREDENTIALS', 'AzureCliCredential', 'User')
    Terminal window
    git clone https://github.com/<your-org>/<your-repo>.git C:\src\<your-repo>
    cd C:\src\<your-repo>
    Terminal window
    cd C:\src\<your-repo>\factory
    ./scripts/Initialize-Settings.ps1 -TenantId '<tenant-id>' -SubscriptionId '<workload-subscription-id>' -SharedSubscriptionId '<shared-services-subscription-id>' -MemberIndex <index> -Location '<location>' -Suffix '<suffix>' -WriteLabCredentials
    Terminal window
    code C:\src\<your-repo>
  4. [On vm-dev01 — VS Code] Trust the workspace authors when prompted, sign in to GitHub Copilot (Accounts icon > Sign in with GitHub to use GitHub Copilot), and configure the Upgrade agent for local execution next to the app: in Extensions, enable GitHub Copilot upgrade and disable GitHub Copilot modernization (for Workspace) if installed. In Copilot Chat, set Session Target to Local, press F1 > MCP: List Servers > Upgrade > Configure Model Access to allow your models, select Upgrade in the agent picker, and send "hello". Also confirm 01-Orchestrator and 08-As-Built appear in the agent picker.

Run in PowerShell 7 (pwsh) on vm-dev01:

Terminal window
gh auth status
git config --global user.name
az account show --query name -o tsv
[Environment]::GetEnvironmentVariable('AZURE_TOKEN_CREDENTIALS', 'User')
git -C C:\src\<your-repo> branch --show-current
git -C C:\src\<your-repo> status --short --ignored -- app .github/upgrades
Get-Content C:\src\<your-repo>\factory\.local\settings.json

Done when GitHub is signed in, git has your name, Azure shows your workload subscription, the variable is AzureCliCredential, C:\src\<your-repo> is on main, settings.json has your suffix and memberIndex, and the git status command prints nothing. VS Code must be open on C:\src\<your-repo>, with Upgrade, Local and a Copilot reply to “hello”.

If the git status command lists leftovers under app or .github/upgrades, inspect them before removing files that git does not track:

Terminal window
cd C:\src\<your-repo>
git clean -ndx -- app .github/upgrades
git clean -fdx -- app .github/upgrades

Connect to vm-dev01 through Bastion, open PowerShell 7 and run code C:\src\<your-repo>; do not repeat the clone. Read this site in the VM’s browser or on your own computer. All challenge work and working artifacts live in C:\src\<your-repo> on main. Restart only when no agent run is active: a restart ends Bastion and interrupts the run. Never stop or deallocate vm-dev01 during the event.

Confirm that factory/evidence/readiness/ in C:\src\<your-repo> on main holds test-datacenter.txt (committed in Step 3.3 step 1) and that these readiness checks are complete before Step 4 (T-1):

  1. Preflight GO. The whatif run log, in the member’s Preflight step, showing GO. WARN rows do not prevent GO; confirm the separate manual checks too.
  2. Datacenter test PASS before Arc. factory/evidence/readiness/test-datacenter.txt committed on main with every check PASS.
  3. Arc connected, with the SQL extension. vm-app01 showing as Connected under Azure Arc > Machines, and its instance listed under SQL Server instances (checked automatically by Step 4 Vending).
  4. Arc migration assessment ready. Assessment for ContosoUniversity against Azure SQL Managed Instance visible in the portal ready for C3 triage.
  5. Hybrid Benefit and VM state confirmed. Both VMs running and vm-app01’s licenseType verified.
  6. vm-dev01 and Copilot working. C:\src\<your-repo> cloned on main, factory/.local/settings.json written, and Copilot Chat answering "hello" in VS Code on vm-dev01.

Let your team lead know as soon as your Step 3 checklist is complete so they know you are ready for Step 4: Vending (T-1).

For deployment, Arc or DNS errors, check Troubleshooting.

Arc onboarding doesn’t finish

Arc onboarding needs outbound internet through the NAT gateway. Don’t rerun member after onboarding starts: the stage refuses once vm-app01 exists as an Arc machine. If onboarding stopped earlier but disabled its guest agent, a rerun instead fails at the datacenter test; that is not a safe repair path. Read the run log, connect through Bastion as in Switching to vm-dev01 (use vm-app01, same password), and open C:\LabTools\logs\Connect-AppArc.log in Notepad.

Check with your team lead first, or follow If you need to start over.

Save money between sessions

Before the event you can stop both VMs when you’re not working: az vm deallocate -g rg-datacenter -n vm-app01, then the same with -n vm-dev01. Running az vm deallocate releases the VM’s compute and stops its compute billing. Shutting Windows down from inside the VM does not. Bastion, the NAT gateway and the disks bill even when the VMs are stopped.

Start both again before your team lead runs Step 4 at T-1 (az vm start -g rg-datacenter -n vm-app01, then -n vm-dev01), because vending restarts them and runs the connectivity probes inside them. During the event, never stop vm-dev01: it’s your workstation.

  • Before Arc onboarding starts: fix the error and re-run your Step 3.1 member command (gh workflow run platform.yml -f stage=member for a team member, or gh workflow run platform.yml -f stage=member -f members=1 for the team lead).

  • After Arc onboarding starts, before C5: member refuses an existing Arc machine, and a half-onboarded VM has guest run commands disabled. With the event owner’s approval, tear down only your member scope, wait for teardown to finish green in Actions, and then re-run member:

    • If you are a team member (indexes 2..n, in your own repo):

      Terminal window
      gh workflow run platform.yml -f stage=teardown

      Once teardown finishes green:

      Terminal window
      gh workflow run platform.yml -f stage=member
    • If you are the team lead (recovering your own slot 1—or helping recover one teammate’s <index>—from your lead repo): always pass -f members=<index> so you never tear down the rest of the team:

      Terminal window
      gh workflow run platform.yml -f stage=teardown -f members=1

      Once teardown finishes green:

      Terminal window
      gh workflow run platform.yml -f stage=member -f members=1

    Member cleanup removes rg-datacenter, rg-spoke and the archetype (including SQL Managed Instance). Repeat Step 3 and the vm-dev01 setup afterward. Append -f no-hybrid-benefit=true to member if you lack eligible Windows Server licenses, and if your subscription was already vended in Step 4, have the team lead re-run gh workflow run platform.yml -f stage=vending -f members=<index> afterward.

Next: Step 4: Vending (T-1).