@@ -277,6 +277,42 @@ jobs:
277277 echo "WEBAPP_URL=${WEBAPP_URL}" >> $GITHUB_ENV
278278 echo "WEBAPP_URL=${WEBAPP_URL}" >> $GITHUB_OUTPUT
279279
280+ - name : Remove APPLICATIONINSIGHTS_CONNECTION_STRING for WAF Deployment
281+ if : inputs.WAF_ENABLED == 'true'
282+ shell : bash
283+ env :
284+ INPUT_RESOURCE_GROUP_NAME : ${{ inputs.RESOURCE_GROUP_NAME }}
285+ run : |
286+ echo "🔧 WAF Deployment detected - Removing APPLICATIONINSIGHTS_CONNECTION_STRING from backend container app..."
287+
288+ # Get the backend container app name
289+ BACKEND_APP_NAME=$(az containerapp list --resource-group "$INPUT_RESOURCE_GROUP_NAME" --query "[?contains(name, 'backend')].name" -o tsv | head -1)
290+
291+ if [[ -z "$BACKEND_APP_NAME" ]]; then
292+ echo "❌ ERROR: Could not find backend container app in resource group $INPUT_RESOURCE_GROUP_NAME"
293+ exit 1
294+ fi
295+
296+ echo "Found backend container app: $BACKEND_APP_NAME"
297+
298+ # Remove the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable
299+ az containerapp update \
300+ --name "$BACKEND_APP_NAME" \
301+ --resource-group "$INPUT_RESOURCE_GROUP_NAME" \
302+ --remove-env-vars APPLICATIONINSIGHTS_CONNECTION_STRING
303+
304+ echo "✅ Successfully removed APPLICATIONINSIGHTS_CONNECTION_STRING from $BACKEND_APP_NAME"
305+
306+ # Wait for the container app to restart and become healthy
307+ echo "⏳ Waiting for backend container app to restart..."
308+ sleep 30
309+
310+ # Verify the container app is running
311+ APP_STATUS=$(az containerapp show --name "$BACKEND_APP_NAME" --resource-group "$INPUT_RESOURCE_GROUP_NAME" --query "properties.runningStatus" -o tsv)
312+ echo "Backend container app status: $APP_STATUS"
313+
314+ echo "✅ WAF workaround applied successfully"
315+
280316 - name : Assign Contributor role to Service Principal
281317 if : always()
282318 env :
0 commit comments