Watch Aspire live streamsDocsTry Aspire

Azure Container App Jobs

Azure Container Apps logo

Azure Container Apps jobs let you run containerized tasks that execute for a finite duration and exit. Unlike continuously-running Container Apps, jobs are purpose-built for batch processing, scheduled tasks, and event-driven workloads. The Aspire Azure Container App Jobs hosting integration exposes PublishAsAzureContainerAppJobpublishAsAzureContainerAppJobPublishAsAzureContainerAppJob and PublishAsScheduledAzureContainerAppJobpublishAsScheduledAzureContainerAppJobPublishAsScheduledAzureContainerAppJob extension methods so you can declare any ContainerResource or ExecutableResource, including a DotnetProjectResource, as an Azure Container App Job directly from your AppHost.

The following resource types can be published as Azure Container App Jobs:

Resource typeDescription
DotnetProjectResourceA .NET project or C# file-based app added via AddDotnetProjectaddDotnetProjectAddDotnetProject.
ContainerResourceA container image added via AddContaineraddContainerAddContainer.
ExecutableResourceAn executable process added via AddExecutableaddExecutableAddExecutable.

Use PublishAsAzureContainerAppJob to deploy a project, container, or executable as an Azure Container App Job. Use PublishAsScheduledAzureContainerAppJob as a convenience wrapper that sets the cron schedule in one call.

apphost.mts
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
const dataProcessor = await builder.addDotnetProject("data-processor", "../DataProcessor/DataProcessor.csproj");
await dataProcessor.publishAsScheduledAzureContainerAppJob("0 0 * * *"); // Every day at midnight

Azure Container App Jobs support three trigger types: manual, schedule, and event.

Configure CPU and memory for your job:

Pass environment variables — including provisioning parameters — into the job container: