Job Args
data class JobArgs(val configuration: Output<JobConfigurationArgs>? = null, val environmentId: Output<String>? = null, val identity: Output<ManagedServiceIdentityArgs>? = null, val jobName: Output<String>? = null, val location: Output<String>? = null, val resourceGroupName: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val template: Output<JobTemplateArgs>? = null, val workloadProfileName: Output<String>? = null) : ConvertibleToJava<JobArgs>
Container App Job Uses Azure REST API version 2023-04-01-preview. Other available API versions: 2023-05-01, 2023-05-02-preview, 2023-08-01-preview, 2023-11-02-preview, 2024-02-02-preview, 2024-03-01, 2024-08-02-preview, 2024-10-02-preview, 2025-01-01.
Example Usage
Create or Update Container Apps Job
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var job = new AzureNative.App.Job("job", new()
{
Configuration = new AzureNative.App.Inputs.JobConfigurationArgs
{
ManualTriggerConfig = new AzureNative.App.Inputs.JobConfigurationManualTriggerConfigArgs
{
Parallelism = 4,
ReplicaCompletionCount = 1,
},
ReplicaRetryLimit = 10,
ReplicaTimeout = 10,
TriggerType = AzureNative.App.TriggerType.Manual,
},
EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
JobName = "testcontainerappsjob0",
Location = "East US",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.JobTemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerappsjob0:v1",
Name = "testcontainerappsjob0",
Probes = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeArgs
{
HttpGet = new AzureNative.App.Inputs.ContainerAppProbeHttpGetArgs
{
HttpHeaders = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeHttpHeadersArgs
{
Name = "Custom-Header",
Value = "Awesome",
},
},
Path = "/health",
Port = 8080,
},
InitialDelaySeconds = 5,
PeriodSeconds = 3,
Type = AzureNative.App.Type.Liveness,
},
},
},
},
InitContainers = new[]
{
new AzureNative.App.Inputs.InitContainerArgs
{
Args = new[]
{
"-c",
"while true; do echo hello; sleep 10;done",
},
Command = new[]
{
"/bin/sh",
},
Image = "repo/testcontainerappsjob0:v4",
Name = "testinitcontainerAppsJob0",
Resources = new AzureNative.App.Inputs.ContainerResourcesArgs
{
Cpu = 0.5,
Memory = "1Gi",
},
},
},
},
});
});
Content copied to clipboard
package main
import (
app "github.com/pulumi/pulumi-azure-native-sdk/app/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := app.NewJob(ctx, "job", &app.JobArgs{
Configuration: &app.JobConfigurationArgs{
ManualTriggerConfig: &app.JobConfigurationManualTriggerConfigArgs{
Parallelism: pulumi.Int(4),
ReplicaCompletionCount: pulumi.Int(1),
},
ReplicaRetryLimit: pulumi.Int(10),
ReplicaTimeout: pulumi.Int(10),
TriggerType: pulumi.String(app.TriggerTypeManual),
},
EnvironmentId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
JobName: pulumi.String("testcontainerappsjob0"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("rg"),
Template: &app.JobTemplateArgs{
Containers: app.ContainerArray{
&app.ContainerArgs{
Image: pulumi.String("repo/testcontainerappsjob0:v1"),
Name: pulumi.String("testcontainerappsjob0"),
Probes: app.ContainerAppProbeArray{
&app.ContainerAppProbeArgs{
HttpGet: &app.ContainerAppProbeHttpGetArgs{
HttpHeaders: app.ContainerAppProbeHttpHeadersArray{
&app.ContainerAppProbeHttpHeadersArgs{
Name: pulumi.String("Custom-Header"),
Value: pulumi.String("Awesome"),
},
},
Path: pulumi.String("/health"),
Port: pulumi.Int(8080),
},
InitialDelaySeconds: pulumi.Int(5),
PeriodSeconds: pulumi.Int(3),
Type: pulumi.String(app.TypeLiveness),
},
},
},
},
InitContainers: app.InitContainerArray{
&app.InitContainerArgs{
Args: pulumi.StringArray{
pulumi.String("-c"),
pulumi.String("while true; do echo hello; sleep 10;done"),
},
Command: pulumi.StringArray{
pulumi.String("/bin/sh"),
},
Image: pulumi.String("repo/testcontainerappsjob0:v4"),
Name: pulumi.String("testinitcontainerAppsJob0"),
Resources: &app.ContainerResourcesArgs{
Cpu: pulumi.Float64(0.5),
Memory: pulumi.String("1Gi"),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.Job;
import com.pulumi.azurenative.app.JobArgs;
import com.pulumi.azurenative.app.inputs.JobConfigurationArgs;
import com.pulumi.azurenative.app.inputs.JobConfigurationManualTriggerConfigArgs;
import com.pulumi.azurenative.app.inputs.JobTemplateArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var job = new Job("job", JobArgs.builder()
.configuration(JobConfigurationArgs.builder()
.manualTriggerConfig(JobConfigurationManualTriggerConfigArgs.builder()
.parallelism(4)
.replicaCompletionCount(1)
.build())
.replicaRetryLimit(10)
.replicaTimeout(10)
.triggerType("Manual")
.build())
.environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.jobName("testcontainerappsjob0")
.location("East US")
.resourceGroupName("rg")
.template(JobTemplateArgs.builder()
.containers(ContainerArgs.builder()
.image("repo/testcontainerappsjob0:v1")
.name("testcontainerappsjob0")
.probes(ContainerAppProbeArgs.builder()
.httpGet(ContainerAppProbeHttpGetArgs.builder()
.httpHeaders(ContainerAppProbeHttpHeadersArgs.builder()
.name("Custom-Header")
.value("Awesome")
.build())
.path("/health")
.port(8080)
.build())
.initialDelaySeconds(5)
.periodSeconds(3)
.type("Liveness")
.build())
.build())
.initContainers(InitContainerArgs.builder()
.args(
"-c",
"while true; do echo hello; sleep 10;done")
.command("/bin/sh")
.image("repo/testcontainerappsjob0:v4")
.name("testinitcontainerAppsJob0")
.resources(ContainerResourcesArgs.builder()
.cpu(0.5)
.memory("1Gi")
.build())
.build())
.build())
.build());
}
}
Content copied to clipboard
Create or Update Container Apps Job With Event Driven Trigger
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var job = new AzureNative.App.Job("job", new()
{
Configuration = new AzureNative.App.Inputs.JobConfigurationArgs
{
EventTriggerConfig = new AzureNative.App.Inputs.JobConfigurationEventTriggerConfigArgs
{
Parallelism = 4,
ReplicaCompletionCount = 1,
Scale = new AzureNative.App.Inputs.JobScaleArgs
{
MaxExecutions = 5,
MinExecutions = 1,
PollingInterval = 40,
Rules = new[]
{
new AzureNative.App.Inputs.JobScaleRuleArgs
{
Metadata = new Dictionary<string, object?>
{
["topicName"] = "my-topic",
},
Name = "servicebuscalingrule",
Type = "azure-servicebus",
},
},
},
},
ReplicaRetryLimit = 10,
ReplicaTimeout = 10,
TriggerType = AzureNative.App.TriggerType.Event,
},
EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
JobName = "testcontainerappsjob0",
Location = "East US",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.JobTemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerappsjob0:v1",
Name = "testcontainerappsjob0",
},
},
InitContainers = new[]
{
new AzureNative.App.Inputs.InitContainerArgs
{
Args = new[]
{
"-c",
"while true; do echo hello; sleep 10;done",
},
Command = new[]
{
"/bin/sh",
},
Image = "repo/testcontainerappsjob0:v4",
Name = "testinitcontainerAppsJob0",
Resources = new AzureNative.App.Inputs.ContainerResourcesArgs
{
Cpu = 0.5,
Memory = "1Gi",
},
},
},
},
});
});
Content copied to clipboard
package main
import (
app "github.com/pulumi/pulumi-azure-native-sdk/app/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := app.NewJob(ctx, "job", &app.JobArgs{
Configuration: &app.JobConfigurationArgs{
EventTriggerConfig: &app.JobConfigurationEventTriggerConfigArgs{
Parallelism: pulumi.Int(4),
ReplicaCompletionCount: pulumi.Int(1),
Scale: &app.JobScaleArgs{
MaxExecutions: pulumi.Int(5),
MinExecutions: pulumi.Int(1),
PollingInterval: pulumi.Int(40),
Rules: app.JobScaleRuleArray{
&app.JobScaleRuleArgs{
Metadata: pulumi.Any(map[string]interface{}{
"topicName": "my-topic",
}),
Name: pulumi.String("servicebuscalingrule"),
Type: pulumi.String("azure-servicebus"),
},
},
},
},
ReplicaRetryLimit: pulumi.Int(10),
ReplicaTimeout: pulumi.Int(10),
TriggerType: pulumi.String(app.TriggerTypeEvent),
},
EnvironmentId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
JobName: pulumi.String("testcontainerappsjob0"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("rg"),
Template: &app.JobTemplateArgs{
Containers: app.ContainerArray{
&app.ContainerArgs{
Image: pulumi.String("repo/testcontainerappsjob0:v1"),
Name: pulumi.String("testcontainerappsjob0"),
},
},
InitContainers: app.InitContainerArray{
&app.InitContainerArgs{
Args: pulumi.StringArray{
pulumi.String("-c"),
pulumi.String("while true; do echo hello; sleep 10;done"),
},
Command: pulumi.StringArray{
pulumi.String("/bin/sh"),
},
Image: pulumi.String("repo/testcontainerappsjob0:v4"),
Name: pulumi.String("testinitcontainerAppsJob0"),
Resources: &app.ContainerResourcesArgs{
Cpu: pulumi.Float64(0.5),
Memory: pulumi.String("1Gi"),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.Job;
import com.pulumi.azurenative.app.JobArgs;
import com.pulumi.azurenative.app.inputs.JobConfigurationArgs;
import com.pulumi.azurenative.app.inputs.JobConfigurationEventTriggerConfigArgs;
import com.pulumi.azurenative.app.inputs.JobScaleArgs;
import com.pulumi.azurenative.app.inputs.JobTemplateArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var job = new Job("job", JobArgs.builder()
.configuration(JobConfigurationArgs.builder()
.eventTriggerConfig(JobConfigurationEventTriggerConfigArgs.builder()
.parallelism(4)
.replicaCompletionCount(1)
.scale(JobScaleArgs.builder()
.maxExecutions(5)
.minExecutions(1)
.pollingInterval(40)
.rules(JobScaleRuleArgs.builder()
.metadata(Map.of("topicName", "my-topic"))
.name("servicebuscalingrule")
.type("azure-servicebus")
.build())
.build())
.build())
.replicaRetryLimit(10)
.replicaTimeout(10)
.triggerType("Event")
.build())
.environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.jobName("testcontainerappsjob0")
.location("East US")
.resourceGroupName("rg")
.template(JobTemplateArgs.builder()
.containers(ContainerArgs.builder()
.image("repo/testcontainerappsjob0:v1")
.name("testcontainerappsjob0")
.build())
.initContainers(InitContainerArgs.builder()
.args(
"-c",
"while true; do echo hello; sleep 10;done")
.command("/bin/sh")
.image("repo/testcontainerappsjob0:v4")
.name("testinitcontainerAppsJob0")
.resources(ContainerResourcesArgs.builder()
.cpu(0.5)
.memory("1Gi")
.build())
.build())
.build())
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:app:Job testcontainerappsjob0 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(configuration: Output<JobConfigurationArgs>? = null, environmentId: Output<String>? = null, identity: Output<ManagedServiceIdentityArgs>? = null, jobName: Output<String>? = null, location: Output<String>? = null, resourceGroupName: Output<String>? = null, tags: Output<Map<String, String>>? = null, template: Output<JobTemplateArgs>? = null, workloadProfileName: Output<String>? = null)
Properties
Link copied to clipboard
Container Apps Job configuration properties.
Link copied to clipboard
Resource ID of environment.
Link copied to clipboard
Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code.
Link copied to clipboard
The name of the resource group. The name is case insensitive.
Link copied to clipboard
Container Apps job definition.
Link copied to clipboard
Workload profile name to pin for container apps job execution.