Other Articles

App Service – Monitor Server Errors

This check ensures that server errors are actively monitored for Azure Web Apps. Monitoring server-side errors helps quickly detect availability issues, application crashes, and backend failures that may impact users.

Check Details

  • Resource: Azure App Service (Web App)
  • Check: Ensure Server Errors Are Monitored
  • Risk: Without monitoring server errors, application failures may go undetected, leading to downtime, degraded performance, and poor user experience.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to App Services and select your Web App. Azure App Services list
  3. In the left menu, select Monitoring → Diagnostic settings. Web App diagnostic settings
  4. Click Add diagnostic setting. Add Web App diagnostic settings
  5. Enable logging for:
    • AppServiceHTTPLogs
    • AppServiceConsoleLogs
    • AppServiceAppLogs
    Web App Logging
  6. Configure a destination such as:
    • Log Analytics Workspace
    • Storage Account
    • Event Hub
    Configure Log Analytics
  7. Click Save to enable monitoring.

Remediation via Azure CLI

  1. Open Azure Cloud Shell or a local terminal with Azure CLI installed. Azure Cloud Shell
  2. Create a diagnostic setting for the Web App:
  3. az monitor diagnostic-settings create \
      --name "webapp-error-monitoring" \
      --resource <web-app-resource-id> \
      --workspace <log-analytics-workspace-id> \
      --logs '[{"category":"AppServiceHTTPLogs","enabled":true},
               {"category":"AppServiceConsoleLogs","enabled":true},
               {"category":"AppServiceAppLogs","enabled":true}]'
    
  4. Verify diagnostic settings:
  5. az monitor diagnostic-settings list \
      --resource <web-app-resource-id>
    

Replace <web-app-resource-id> and <log-analytics-workspace-id> with your actual resource values.