Share via


Jobs - Start

Start a Container Apps Job

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start?api-version=2024-03-01

URI Parameters

Name In Required Type Description
jobName
path True

string

pattern: ^[-\w\._\(\)]+$

Job Name

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string

minLength: 1

The ID of the target subscription.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Type Description
containers

JobExecutionContainer[]

List of container definitions for the Container Apps Job.

initContainers

JobExecutionContainer[]

List of specialized containers that run before job containers.

Responses

Name Type Description
200 OK

JobExecutionBase

OK

202 Accepted

OK

Headers

Location: string

Other Status Codes

DefaultErrorResponse

Common error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Run a Container Apps Job

Sample request

POST https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/testcontainerappsjob0/start?api-version=2024-03-01

{
  "containers": [
    {
      "image": "repo/testcontainerappsjob0:v4",
      "name": "testcontainerappsjob0",
      "resources": {
        "cpu": 0.5,
        "memory": "1Gi"
      }
    }
  ],
  "initContainers": [
    {
      "image": "repo/testcontainerappsjob0:v4",
      "name": "testinitcontainerAppsJob0",
      "resources": {
        "cpu": 0.5,
        "memory": "1Gi"
      },
      "command": [
        "/bin/sh"
      ],
      "args": [
        "-c",
        "while true; do echo hello; sleep 10;done"
      ]
    }
  ]
}

Sample response

{
  "name": "testcontainerappsjob0-pjxhsye",
  "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/jobs/{containerAppsJobName}/executions/{jobExecutionName}"
}
Location: location

Definitions

Name Description
ContainerResources

Container App container resource requirements.

DefaultErrorResponse

App Service error response.

Details

Details or the error

EnvironmentVar

Container App container environment variable.

Error

Error model.

JobExecutionBase

Container App's Job execution name.

JobExecutionContainer

Container Apps Jobs execution container definition.

JobExecutionTemplate

Job's execution template, containing container configuration for a job's execution

ContainerResources

Container App container resource requirements.

Name Type Description
cpu

number (double)

Required CPU in cores, e.g. 0.5

ephemeralStorage

string

Ephemeral Storage, e.g. "1Gi"

memory

string

Required memory, e.g. "250Mb"

DefaultErrorResponse

App Service error response.

Name Type Description
error

Error

Error model.

Details

Details or the error

Name Type Description
code

string

Standardized string to programmatically identify the error.

message

string

Detailed error description and debugging information.

target

string

Detailed error description and debugging information.

EnvironmentVar

Container App container environment variable.

Name Type Description
name

string

Environment variable name.

secretRef

string

Name of the Container App secret from which to pull the environment variable value.

value

string

Non-secret environment variable value.

Error

Error model.

Name Type Description
code

string

Standardized string to programmatically identify the error.

details

Details[]

Details or the error

innererror

string

More information to debug error.

message

string

Detailed error description and debugging information.

target

string

Detailed error description and debugging information.

JobExecutionBase

Container App's Job execution name.

Name Type Description
id

string

Job execution Id.

name

string

Job execution name.

JobExecutionContainer

Container Apps Jobs execution container definition.

Name Type Description
args

string[]

Container start command arguments.

command

string[]

Container start command.

env

EnvironmentVar[]

Container environment variables.

image

string

Container image tag.

name

string

Custom container name.

resources

ContainerResources

Container resource requirements.

JobExecutionTemplate

Job's execution template, containing container configuration for a job's execution

Name Type Description
containers

JobExecutionContainer[]

List of container definitions for the Container Apps Job.

initContainers

JobExecutionContainer[]

List of specialized containers that run before job containers.