$npx -y skills add DanWahlin/github-azure-agentic-journeys --skill n8n-azuren8n workflow automation configuration for Azure. Use when deploying n8n specifically to Azure Container Apps.
| 1 | # n8n Azure Configuration Skill |
| 2 | |
| 3 | Application-specific configuration for deploying n8n to Azure Container Apps with PostgreSQL. Infrastructure should be generated fresh by the `azure-prepare` → `azure-validate` → `azure-deploy` pipeline. |
| 4 | |
| 5 | ## Prerequisites and Portability |
| 6 | |
| 7 | Require Azure CLI, Azure Developer CLI 1.28.0 or later, and Node.js 24 LTS or later. Generated lifecycle hooks must be CommonJS JavaScript (`.js`) or TypeScript (`.ts`) files referenced directly from `azure.yaml`; azd 1.28.0 rejects `.mjs` hook paths. Do not generate Bash-only `.sh` or PowerShell-only `.ps1` hooks. See `../../../docs/tool-installation.md` for Windows, macOS, and Linux installation options. |
| 8 | |
| 9 | ## Critical: Subscription Context |
| 10 | |
| 11 | **ALWAYS set AZURE_SUBSCRIPTION_ID explicitly before running `azd up`.** Read it with `az account show --query id -o tsv`, then pass the returned value to `azd env set AZURE_SUBSCRIPTION_ID <subscription-id>`. Do not emit Bash command substitution when the operating system is unknown. |
| 12 | |
| 13 | ## Critical: PostgreSQL AVM Defaults |
| 14 | |
| 15 | **📖 See [../config/postgresql-avm-defaults.md](../config/postgresql-avm-defaults.md) for all PostgreSQL AVM gotchas** (publicNetworkAccess, passwordAuth, HA, password pinning). Without these settings, n8n will fail with "authentication failed" or "connection timeout". |
| 16 | |
| 17 | **n8n-specific:** Pin `POSTGRES_PASSWORD` and `N8N_ENCRYPTION_KEY` in the azd environment so redeployments keep the same values. Generate both with Node's `crypto.randomBytes()` or another cryptographically secure platform API. Do not require `openssl`, and do not create `N8N_AUTH_PASSWORD`; current n8n releases use built-in owner-account management rather than the removed `N8N_BASIC_AUTH_*` variables. |
| 18 | |
| 19 | ## Critical: PostgreSQL SKU Format |
| 20 | |
| 21 | ```bicep |
| 22 | sku: { name: 'Standard_B1ms', tier: 'Burstable' } // Both fields required |
| 23 | ``` |
| 24 | |
| 25 | ## Official Documentation |
| 26 | |
| 27 | - n8n Docker Installation: https://docs.n8n.io/hosting/installation/docker/ |
| 28 | - n8n Environment Variables: https://docs.n8n.io/hosting/configuration/environment-variables/ |
| 29 | |
| 30 | ## Quick Start (Verified) |
| 31 | |
| 32 | ```text |
| 33 | # 1. Register providers (one-time per subscription) |
| 34 | az provider register --namespace Microsoft.App |
| 35 | az provider register --namespace Microsoft.DBforPostgreSQL |
| 36 | az provider register --namespace Microsoft.OperationalInsights |
| 37 | |
| 38 | # 2. Create environment |
| 39 | azd env new my-n8n-env |
| 40 | |
| 41 | # 3. Set required variables (replace placeholders with collected/generated values) |
| 42 | azd env set AZURE_SUBSCRIPTION_ID "<subscription-id>" |
| 43 | azd env set AZURE_LOCATION "westus" |
| 44 | azd env set POSTGRES_PASSWORD "<generated-secret>" |
| 45 | azd env set N8N_ENCRYPTION_KEY "<generated-secret>" |
| 46 | |
| 47 | # 4. Deploy (~7-10 minutes) |
| 48 | azd up |
| 49 | |
| 50 | # 5. Access n8n |
| 51 | azd env get-value N8N_URL |
| 52 | # First launch: complete the Set up owner account flow |
| 53 | ``` |
| 54 | |
| 55 | **Deployment time breakdown:** |
| 56 | - Resource Group: ~4s |
| 57 | - Log Analytics: ~25s |
| 58 | - Container Apps Environment: ~38s |
| 59 | - PostgreSQL Flexible Server: ~4-5 min |
| 60 | - n8n Container App: ~20s |
| 61 | - **Total: ~7 minutes** |
| 62 | |
| 63 | ## Key Configuration Files |
| 64 | |
| 65 | | File | Purpose | |
| 66 | |------|---------| |
| 67 | | `config/environment-variables.md` | All n8n environment variables for Azure | |
| 68 | | `config/health-probes.md` | Health probe timing for n8n startup | |
| 69 | | `troubleshooting.md` | Common issues and solutions | |
| 70 | |
| 71 | ## Architecture |
| 72 | |
| 73 | ```mermaid |
| 74 | graph TB |
| 75 | subgraph RG["Azure Resource Group"] |
| 76 | subgraph CAE["Container Apps Environment"] |
| 77 | N8N["n8n Container App<br/>(0-3 replicas)"] |
| 78 | end |
| 79 | LA["Log Analytics Workspace"] |
| 80 | PG["Azure PostgreSQL Flexible Server<br/>(Standard_B1ms/Burstable, 32GB, v16)"] |
| 81 | end |
| 82 | |
| 83 | CAE -->|logs & metrics| LA |
| 84 | N8N -->|SSL/TLS port 5678| PG |
| 85 | ``` |
| 86 | |
| 87 | ## n8n-Specific Requirements |
| 88 | |
| 89 | ### Container Configuration |
| 90 | |
| 91 | | Setting | Value | Reason | |
| 92 | |---------|-------|--------| |
| 93 | | Image | `docker.io/n8nio/n8n:2.30.6` | Pin a tested official image; never use `latest` | |
| 94 | | Port | 5678 | n8n default port | |
| 95 | | CPU | 1.0 cores | Minimum for responsive UI | |
| 96 | | Memory | 2Gi | n8n recommended minimum | |
| 97 | | Min Replicas | 1 in CI, 0 after validation | CI needs deterministic readiness; scale-to-zero is fine for demos/cost after tests pass | |
| 98 | | Max Replicas | 3 | Handle traffic spikes | |
| 99 | |
| 100 | ### Health Probes (CRITICAL) |
| 101 | |
| 102 | n8n requires **60+ seconds** to start. See `config/health-probes.md`. |
| 103 | |
| 104 | **Without proper health probes, containers will crash before n8n initializes!** |
| 105 | |
| 106 | Use the dedicated health endpoint `/healthz` for startup, readiness, and liveness probes. Do not probe `/`; the UI root can redirect or stall while the app is still initializing. When using the AVM Container App module, use `startup.failureThreshold: 10` with `startup.periodSeconds: 30` for a five-minute startup window, because AVM caps `failureThreshold` at 10. |
| 107 | |
| 108 | ### Database Requirements |
| 109 | |
| 110 | - PostgreSQL 15 or 16 (Flexible Server) |
| 111 | - SSL enabled (required by Azure) |
| 112 | - FQDN connection (not internal hostname) |
| 113 | |
| 114 | ## Cost |