Skip to content

Commit dc601ec

Browse files
nekdimaCopilot
andcommitted
Fix cross-platform deploy issues in Azure Copilot MicroHack
- Replace $env:TEMP with [System.IO.Path]::GetTempPath() in Deploy-Lab.ps1 ($env:TEMP is null on macOS/Linux, causing script to crash) - Add --timeout 600 to az webapp deploy to prevent 504 Gateway Timeout during Oryx Python build on B1 App Service plan - Auto-install application-insights CLI extension in Test-CopilotWorkshop.ps1 to prevent interactive prompt that hangs the test suite Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4cc7f4e commit dc601ec

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

03-Azure/01-03-Infrastructure/12_Azure_Copilot/lab/Deploy-Lab.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ $sshPublicKey = (Get-Content $sshPubKeyPath -Raw).Trim()
9696
Write-Host "`n[1/3] Deploying infrastructure (Bicep)..." -ForegroundColor Yellow
9797
$mainBicep = Join-Path $scriptPath "..\iac\main.bicep"
9898
$timestamp = Get-Date -Format "yyyyMMddHHmmss"
99-
$paramsFile = Join-Path $env:TEMP "copilot-workshop-params-$timestamp.json"
99+
$paramsFile = Join-Path ([System.IO.Path]::GetTempPath()) "copilot-workshop-params-$timestamp.json"
100100

101101
@{
102102
'`$schema' = 'https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#'
@@ -127,10 +127,10 @@ Write-Host " ✓ Infrastructure deployed" -ForegroundColor Green
127127
Write-Host "`n[2/3] Deploying buggy Flask app (Ch02)..." -ForegroundColor Yellow
128128
$webAppName = "app-copilot-buggy-$suffix"
129129
$appDir = Join-Path $scriptPath "..\app"
130-
$zipPath = Join-Path $env:TEMP "$webAppName.zip"
130+
$zipPath = Join-Path ([System.IO.Path]::GetTempPath()) "$webAppName.zip"
131131
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
132132
Compress-Archive -Path (Join-Path $appDir "*") -DestinationPath $zipPath -Force
133-
Invoke-Az webapp deploy --resource-group "rg-copilot-$suffix-ch02" --name $webAppName --src-path $zipPath --type zip --track-status false -o none
133+
Invoke-Az webapp deploy --resource-group "rg-copilot-$suffix-ch02" --name $webAppName --src-path $zipPath --type zip --track-status false --timeout 600 -o none
134134
Remove-Item $zipPath -Force
135135
Write-Host " ✓ Flask app deployed to $webAppName" -ForegroundColor Green
136136

03-Azure/01-03-Infrastructure/12_Azure_Copilot/scripts/Test-CopilotWorkshop.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ param(
1818
$ErrorActionPreference = "Continue"
1919
Set-StrictMode -Version Latest
2020

21+
# Ensure required CLI extensions are installed (application-insights is needed for Ch02 tests)
22+
az extension add --name application-insights --yes 2>$null
23+
2124
$passed = 0
2225
$failed = 0
2326
$warnings = 0

0 commit comments

Comments
 (0)