@@ -285,7 +285,44 @@ 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
325+ continue-on-error : true
289326 if : always()
290327 shell : bash
291328 env :
0 commit comments