Skip to content

Free guide

Create and run a Container Apps job

Start a finite task, inspect its execution and decide when it should run again.

Why it matters

A web app waits for requests. A batch import has a beginning and an end. A job lets you track each run separately.

Core concepts

Job and execution

The job stores the instructions. Starting it creates an execution with its own status. A successful start response tells you the run was accepted.

Trigger choice

Use manual for an operator request, scheduled for a clock-driven batch, or event-driven when a source such as a queue has work. Repeated or overlapping runs need a clear rule for duplicates.

Try it step by step

  1. Reuse fieldwork-env from the first Azure lab. Run the create command once.
  2. Run the start command. Note the execution name in the output.
  3. List executions until that run reaches a final state. Open the execution logs in the portal and find a line from the sample task.
  4. For a real import, also compare expected and written records. A process can exit successfully after finding zero rows.

Use the Bash example in a dedicated practice subscription or resource group. Check the result in the portal and keep the expected and actual outcomes together.

Worked example

A nightly import processed the same file twice after a retry. Both runs can report success. A unique source record key can help prevent duplicate writes.

Azure CLI · Bash
az containerapp job create --name fieldwork-batch \
  --resource-group rg-fieldwork-lab --environment fieldwork-env \
  --trigger-type Manual --replica-timeout 300 --replica-retry-limit 1 \
  --image mcr.microsoft.com/k8se/quickstart-jobs:latest \
  --cpu 0.25 --memory 0.5Gi
az containerapp job start -g rg-fieldwork-lab -n fieldwork-batch
az containerapp job execution list -g rg-fieldwork-lab -n fieldwork-batch -o table

Common mistake

Treating a run ID as proof the work finished.

Practice exercise

Choose a trigger for a nightly report and one for a one-off backfill. State the signal that would prove each run did useful work.

Check your understanding

What does a start response establish?

  1. Every row was imported
  2. An execution was requested
  3. The next scheduled run succeeded
Show answer

An execution was requested. Track execution status and check the business result separately.

Takeaway

Track execution status and check the business result separately.

Further reading

Browse more lessons