Self-hosted agents are available to Enterprise customers only. See pricing for details.
How It Works
KEDA polls the env zero agent queue state endpoint on a fixed interval and creates ACA job executions when deployment tasks are queued. Each container picks up one task, runs it to completion, and exits. When the queue is empty, no containers run.Prerequisites
- Azure CLI installed and authenticated (
az login) - Azure subscription with Contributor access
- An env zero agent pool with a valid agent access token. See Self-Hosted Agents Overview for how to create an agent pool and generate a secret.
Setup
1
Create a resource group
2
Create a Container Apps environment
3
Create the job configuration file
Save the following as
env0-aca-job.yaml. Replace <YOUR_AGENT_ACCESS_TOKEN> with the agent access token generated for your agent pool, <YOUR_STATE_ENCRYPTION_KEY_BASE64> with a base64-encoded encryption key, and <X.Y.Z> with the agent version you want to pin to.env0-aca-job.yaml
4
Create the job
Pin
image to a specific agent version rather than :latest to avoid silent upgrades during a running deployment. See the env0 deployment agent releases for current tags.Configuration Reference
KEDA Scaling Parameters
Container Resources
Environment Variables
Monitoring
List running and completed executions:Troubleshooting
No containers start when deployments are queued
Check the KEDA system logs for the Container Apps environment:api returned 401: the agent access token is incorrect or has been revoked. Generate a new secret and update the job configuration.- No KEDA activity logged: verify the job was created with
triggerType: Event.
A container starts but fails immediately
Check the container logs for the specific error. Common causes:- Missing
ENV0_STAGE: deployment commands build URLs from this variable and produce broken hosts when it is unset. Set it explicitly toprodfor production. - Missing
ENV0_STATE_ENCRYPTION_KEY: the agent exits immediately with an error. - Wrong
AGENT_ACCESS_TOKEN: the agent starts but receives 401 on API calls.
Cleanup
To remove all resources created for this setup:Next Steps
- Self-Hosted Agents Overview - Create agent pools and manage authentication secrets.
- Custom/Optional Configuration - Additional agent configuration options.
- Self-Hosted Agents Monitoring - Monitor agent health and deployments.