Skip to content

Commit 2c341bb

Browse files
added workaround for waf
1 parent eab313b commit 2c341bb

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/job-deploy-windows.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,42 @@ jobs:
285285
"WEBAPP_URL=$WEBAPP_URL" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
286286
"WEBAPP_URL=$WEBAPP_URL" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
287287
288+
- name: Remove APPLICATIONINSIGHTS_CONNECTION_STRING for WAF Deployment
289+
if: inputs.WAF_ENABLED == 'true'
290+
shell: pwsh
291+
env:
292+
INPUT_RESOURCE_GROUP_NAME: ${{ inputs.RESOURCE_GROUP_NAME }}
293+
run: |
294+
Write-Host "🔧 WAF Deployment detected - Removing APPLICATIONINSIGHTS_CONNECTION_STRING from backend container app..."
295+
296+
# Get the backend container app name
297+
$BACKEND_APP_NAME = az containerapp list --resource-group "$env:INPUT_RESOURCE_GROUP_NAME" --query "[?contains(name, 'backend')].name" -o tsv | Select-Object -First 1
298+
299+
if ([string]::IsNullOrEmpty($BACKEND_APP_NAME)) {
300+
Write-Host "❌ ERROR: Could not find backend container app in resource group $env:INPUT_RESOURCE_GROUP_NAME"
301+
exit 1
302+
}
303+
304+
Write-Host "Found backend container app: $BACKEND_APP_NAME"
305+
306+
# Remove the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable
307+
az containerapp update `
308+
--name "$BACKEND_APP_NAME" `
309+
--resource-group "$env:INPUT_RESOURCE_GROUP_NAME" `
310+
--remove-env-vars APPLICATIONINSIGHTS_CONNECTION_STRING
311+
312+
Write-Host "✅ Successfully removed APPLICATIONINSIGHTS_CONNECTION_STRING from $BACKEND_APP_NAME"
313+
314+
# Wait for the container app to restart and become healthy
315+
Write-Host "⏳ Waiting for backend container app to restart..."
316+
Start-Sleep -Seconds 30
317+
318+
# Verify the container app is running
319+
$APP_STATUS = az containerapp show --name "$BACKEND_APP_NAME" --resource-group "$env:INPUT_RESOURCE_GROUP_NAME" --query "properties.runningStatus" -o tsv
320+
Write-Host "Backend container app status: $APP_STATUS"
321+
322+
Write-Host "✅ WAF workaround applied successfully"
323+
288324
- name: Assign Contributor role to Service Principal
289325
if: always()
290326
shell: bash

0 commit comments

Comments
 (0)