Container App Args
Container App. Uses Azure REST API version 2024-03-01. In version 2.x of the Azure Native provider, it used API version 2022-10-01. Other available API versions: 2022-10-01, 2022-11-01-preview, 2023-04-01-preview, 2023-05-01, 2023-05-02-preview, 2023-08-01-preview, 2023-11-02-preview, 2024-02-02-preview, 2024-08-02-preview, 2024-10-02-preview, 2025-01-01. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native app [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
Create or Update Container App
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var containerApp = new AzureNative.App.ContainerApp("containerApp", new()
{
Configuration = new AzureNative.App.Inputs.ConfigurationArgs
{
Dapr = new AzureNative.App.Inputs.DaprArgs
{
AppPort = 3000,
AppProtocol = AzureNative.App.AppProtocol.Http,
EnableApiLogging = true,
Enabled = true,
HttpMaxRequestSize = 10,
HttpReadBufferSize = 30,
LogLevel = AzureNative.App.LogLevel.Debug,
},
Ingress = new AzureNative.App.Inputs.IngressArgs
{
AdditionalPortMappings = new[]
{
new AzureNative.App.Inputs.IngressPortMappingArgs
{
External = true,
TargetPort = 1234,
},
new AzureNative.App.Inputs.IngressPortMappingArgs
{
ExposedPort = 3456,
External = false,
TargetPort = 2345,
},
},
ClientCertificateMode = AzureNative.App.IngressClientCertificateMode.Accept,
CorsPolicy = new AzureNative.App.Inputs.CorsPolicyArgs
{
AllowCredentials = true,
AllowedHeaders = new[]
{
"HEADER1",
"HEADER2",
},
AllowedMethods = new[]
{
"GET",
"POST",
},
AllowedOrigins = new[]
{
"https://a.test.com",
"https://b.test.com",
},
ExposeHeaders = new[]
{
"HEADER3",
"HEADER4",
},
MaxAge = 1234,
},
CustomDomains = new[]
{
new AzureNative.App.Inputs.CustomDomainArgs
{
BindingType = AzureNative.App.BindingType.SniEnabled,
CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com",
Name = "www.my-name.com",
},
new AzureNative.App.Inputs.CustomDomainArgs
{
BindingType = AzureNative.App.BindingType.SniEnabled,
CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com",
Name = "www.my-other-name.com",
},
},
External = true,
IpSecurityRestrictions = new[]
{
new AzureNative.App.Inputs.IpSecurityRestrictionRuleArgs
{
Action = AzureNative.App.Action.Allow,
Description = "Allowing all IP's within the subnet below to access containerapp",
IpAddressRange = "192.168.1.1/32",
Name = "Allow work IP A subnet",
},
new AzureNative.App.Inputs.IpSecurityRestrictionRuleArgs
{
Action = AzureNative.App.Action.Allow,
Description = "Allowing all IP's within the subnet below to access containerapp",
IpAddressRange = "192.168.1.1/8",
Name = "Allow work IP B subnet",
},
},
StickySessions = new AzureNative.App.Inputs.IngressStickySessionsArgs
{
Affinity = AzureNative.App.Affinity.Sticky,
},
TargetPort = 3000,
Traffic = new[]
{
new AzureNative.App.Inputs.TrafficWeightArgs
{
Label = "production",
RevisionName = "testcontainerapp0-ab1234",
Weight = 100,
},
},
},
MaxInactiveRevisions = 10,
Service = new AzureNative.App.Inputs.ServiceArgs
{
Type = "redis",
},
},
ContainerAppName = "testcontainerapp0",
EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
Location = "East US",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.TemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerapp0:v1",
Name = "testcontainerapp0",
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 = 3,
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/testcontainerapp0:v4",
Name = "testinitcontainerApp0",
Resources = new AzureNative.App.Inputs.ContainerResourcesArgs
{
Cpu = 0.5,
Memory = "1Gi",
},
},
},
Scale = new AzureNative.App.Inputs.ScaleArgs
{
MaxReplicas = 5,
MinReplicas = 1,
Rules = new[]
{
new AzureNative.App.Inputs.ScaleRuleArgs
{
Custom = new AzureNative.App.Inputs.CustomScaleRuleArgs
{
Metadata =
{
{ "concurrentRequests", "50" },
},
Type = "http",
},
Name = "httpscalingrule",
},
},
},
ServiceBinds = new[]
{
new AzureNative.App.Inputs.ServiceBindArgs
{
Name = "redisService",
ServiceId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService",
},
},
},
WorkloadProfileName = "My-GP-01",
});
});
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.NewContainerApp(ctx, "containerApp", &app.ContainerAppArgs{
Configuration: &app.ConfigurationArgs{
Dapr: &app.DaprArgs{
AppPort: pulumi.Int(3000),
AppProtocol: pulumi.String(app.AppProtocolHttp),
EnableApiLogging: pulumi.Bool(true),
Enabled: pulumi.Bool(true),
HttpMaxRequestSize: pulumi.Int(10),
HttpReadBufferSize: pulumi.Int(30),
LogLevel: pulumi.String(app.LogLevelDebug),
},
Ingress: &app.IngressArgs{
AdditionalPortMappings: app.IngressPortMappingArray{
&app.IngressPortMappingArgs{
External: pulumi.Bool(true),
TargetPort: pulumi.Int(1234),
},
&app.IngressPortMappingArgs{
ExposedPort: pulumi.Int(3456),
External: pulumi.Bool(false),
TargetPort: pulumi.Int(2345),
},
},
ClientCertificateMode: pulumi.String(app.IngressClientCertificateModeAccept),
CorsPolicy: &app.CorsPolicyArgs{
AllowCredentials: pulumi.Bool(true),
AllowedHeaders: pulumi.StringArray{
pulumi.String("HEADER1"),
pulumi.String("HEADER2"),
},
AllowedMethods: pulumi.StringArray{
pulumi.String("GET"),
pulumi.String("POST"),
},
AllowedOrigins: pulumi.StringArray{
pulumi.String("https://a.test.com"),
pulumi.String("https://b.test.com"),
},
ExposeHeaders: pulumi.StringArray{
pulumi.String("HEADER3"),
pulumi.String("HEADER4"),
},
MaxAge: pulumi.Int(1234),
},
CustomDomains: app.CustomDomainArray{
&app.CustomDomainArgs{
BindingType: pulumi.String(app.BindingTypeSniEnabled),
CertificateId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com"),
Name: pulumi.String("www.my-name.com"),
},
&app.CustomDomainArgs{
BindingType: pulumi.String(app.BindingTypeSniEnabled),
CertificateId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"),
Name: pulumi.String("www.my-other-name.com"),
},
},
External: pulumi.Bool(true),
IpSecurityRestrictions: app.IpSecurityRestrictionRuleArray{
&app.IpSecurityRestrictionRuleArgs{
Action: pulumi.String(app.ActionAllow),
Description: pulumi.String("Allowing all IP's within the subnet below to access containerapp"),
IpAddressRange: pulumi.String("192.168.1.1/32"),
Name: pulumi.String("Allow work IP A subnet"),
},
&app.IpSecurityRestrictionRuleArgs{
Action: pulumi.String(app.ActionAllow),
Description: pulumi.String("Allowing all IP's within the subnet below to access containerapp"),
IpAddressRange: pulumi.String("192.168.1.1/8"),
Name: pulumi.String("Allow work IP B subnet"),
},
},
StickySessions: &app.IngressStickySessionsArgs{
Affinity: pulumi.String(app.AffinitySticky),
},
TargetPort: pulumi.Int(3000),
Traffic: app.TrafficWeightArray{
&app.TrafficWeightArgs{
Label: pulumi.String("production"),
RevisionName: pulumi.String("testcontainerapp0-ab1234"),
Weight: pulumi.Int(100),
},
},
},
MaxInactiveRevisions: pulumi.Int(10),
Service: &app.ServiceArgs{
Type: pulumi.String("redis"),
},
},
ContainerAppName: pulumi.String("testcontainerapp0"),
EnvironmentId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("rg"),
Template: &app.TemplateArgs{
Containers: app.ContainerArray{
&app.ContainerArgs{
Image: pulumi.String("repo/testcontainerapp0:v1"),
Name: pulumi.String("testcontainerapp0"),
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(3),
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/testcontainerapp0:v4"),
Name: pulumi.String("testinitcontainerApp0"),
Resources: &app.ContainerResourcesArgs{
Cpu: pulumi.Float64(0.5),
Memory: pulumi.String("1Gi"),
},
},
},
Scale: &app.ScaleArgs{
MaxReplicas: pulumi.Int(5),
MinReplicas: pulumi.Int(1),
Rules: app.ScaleRuleArray{
&app.ScaleRuleArgs{
Custom: &app.CustomScaleRuleArgs{
Metadata: pulumi.StringMap{
"concurrentRequests": pulumi.String("50"),
},
Type: pulumi.String("http"),
},
Name: pulumi.String("httpscalingrule"),
},
},
},
ServiceBinds: app.ServiceBindArray{
&app.ServiceBindArgs{
Name: pulumi.String("redisService"),
ServiceId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService"),
},
},
},
WorkloadProfileName: pulumi.String("My-GP-01"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.ContainerApp;
import com.pulumi.azurenative.app.ContainerAppArgs;
import com.pulumi.azurenative.app.inputs.ConfigurationArgs;
import com.pulumi.azurenative.app.inputs.DaprArgs;
import com.pulumi.azurenative.app.inputs.IngressArgs;
import com.pulumi.azurenative.app.inputs.CorsPolicyArgs;
import com.pulumi.azurenative.app.inputs.IngressStickySessionsArgs;
import com.pulumi.azurenative.app.inputs.ServiceArgs;
import com.pulumi.azurenative.app.inputs.TemplateArgs;
import com.pulumi.azurenative.app.inputs.ScaleArgs;
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 containerApp = new ContainerApp("containerApp", ContainerAppArgs.builder()
.configuration(ConfigurationArgs.builder()
.dapr(DaprArgs.builder()
.appPort(3000)
.appProtocol("http")
.enableApiLogging(true)
.enabled(true)
.httpMaxRequestSize(10)
.httpReadBufferSize(30)
.logLevel("debug")
.build())
.ingress(IngressArgs.builder()
.additionalPortMappings(
IngressPortMappingArgs.builder()
.external(true)
.targetPort(1234)
.build(),
IngressPortMappingArgs.builder()
.exposedPort(3456)
.external(false)
.targetPort(2345)
.build())
.clientCertificateMode("accept")
.corsPolicy(CorsPolicyArgs.builder()
.allowCredentials(true)
.allowedHeaders(
"HEADER1",
"HEADER2")
.allowedMethods(
"GET",
"POST")
.allowedOrigins(
"https://a.test.com",
"https://b.test.com")
.exposeHeaders(
"HEADER3",
"HEADER4")
.maxAge(1234)
.build())
.customDomains(
CustomDomainArgs.builder()
.bindingType("SniEnabled")
.certificateId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com")
.name("www.my-name.com")
.build(),
CustomDomainArgs.builder()
.bindingType("SniEnabled")
.certificateId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com")
.name("www.my-other-name.com")
.build())
.external(true)
.ipSecurityRestrictions(
IpSecurityRestrictionRuleArgs.builder()
.action("Allow")
.description("Allowing all IP's within the subnet below to access containerapp")
.ipAddressRange("192.168.1.1/32")
.name("Allow work IP A subnet")
.build(),
IpSecurityRestrictionRuleArgs.builder()
.action("Allow")
.description("Allowing all IP's within the subnet below to access containerapp")
.ipAddressRange("192.168.1.1/8")
.name("Allow work IP B subnet")
.build())
.stickySessions(IngressStickySessionsArgs.builder()
.affinity("sticky")
.build())
.targetPort(3000)
.traffic(TrafficWeightArgs.builder()
.label("production")
.revisionName("testcontainerapp0-ab1234")
.weight(100)
.build())
.build())
.maxInactiveRevisions(10)
.service(ServiceArgs.builder()
.type("redis")
.build())
.build())
.containerAppName("testcontainerapp0")
.environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.location("East US")
.resourceGroupName("rg")
.template(TemplateArgs.builder()
.containers(ContainerArgs.builder()
.image("repo/testcontainerapp0:v1")
.name("testcontainerapp0")
.probes(ContainerAppProbeArgs.builder()
.httpGet(ContainerAppProbeHttpGetArgs.builder()
.httpHeaders(ContainerAppProbeHttpHeadersArgs.builder()
.name("Custom-Header")
.value("Awesome")
.build())
.path("/health")
.port(8080)
.build())
.initialDelaySeconds(3)
.periodSeconds(3)
.type("Liveness")
.build())
.build())
.initContainers(InitContainerArgs.builder()
.args(
"-c",
"while true; do echo hello; sleep 10;done")
.command("/bin/sh")
.image("repo/testcontainerapp0:v4")
.name("testinitcontainerApp0")
.resources(ContainerResourcesArgs.builder()
.cpu(0.5)
.memory("1Gi")
.build())
.build())
.scale(ScaleArgs.builder()
.maxReplicas(5)
.minReplicas(1)
.rules(ScaleRuleArgs.builder()
.custom(CustomScaleRuleArgs.builder()
.metadata(Map.of("concurrentRequests", "50"))
.type("http")
.build())
.name("httpscalingrule")
.build())
.build())
.serviceBinds(ServiceBindArgs.builder()
.name("redisService")
.serviceId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService")
.build())
.build())
.workloadProfileName("My-GP-01")
.build());
}
}
Create or Update ManagedBy App
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var containerApp = new AzureNative.App.ContainerApp("containerApp", new()
{
Configuration = new AzureNative.App.Inputs.ConfigurationArgs
{
Ingress = new AzureNative.App.Inputs.IngressArgs
{
ExposedPort = 4000,
External = true,
TargetPort = 3000,
Traffic = new[]
{
new AzureNative.App.Inputs.TrafficWeightArgs
{
RevisionName = "testcontainerappmanagedby-ab1234",
Weight = 100,
},
},
Transport = AzureNative.App.IngressTransportMethod.Tcp,
},
},
ContainerAppName = "testcontainerappmanagedby",
EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
Location = "East US",
ManagedBy = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.TemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerappmanagedby:v1",
Name = "testcontainerappmanagedby",
Probes = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeArgs
{
InitialDelaySeconds = 3,
PeriodSeconds = 3,
TcpSocket = new AzureNative.App.Inputs.ContainerAppProbeTcpSocketArgs
{
Port = 8080,
},
Type = AzureNative.App.Type.Liveness,
},
},
},
},
Scale = new AzureNative.App.Inputs.ScaleArgs
{
MaxReplicas = 5,
MinReplicas = 1,
Rules = new[]
{
new AzureNative.App.Inputs.ScaleRuleArgs
{
Name = "tcpscalingrule",
Tcp = new AzureNative.App.Inputs.TcpScaleRuleArgs
{
Metadata =
{
{ "concurrentConnections", "50" },
},
},
},
},
},
},
});
});
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.NewContainerApp(ctx, "containerApp", &app.ContainerAppArgs{
Configuration: &app.ConfigurationArgs{
Ingress: &app.IngressArgs{
ExposedPort: pulumi.Int(4000),
External: pulumi.Bool(true),
TargetPort: pulumi.Int(3000),
Traffic: app.TrafficWeightArray{
&app.TrafficWeightArgs{
RevisionName: pulumi.String("testcontainerappmanagedby-ab1234"),
Weight: pulumi.Int(100),
},
},
Transport: pulumi.String(app.IngressTransportMethodTcp),
},
},
ContainerAppName: pulumi.String("testcontainerappmanagedby"),
EnvironmentId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
Location: pulumi.String("East US"),
ManagedBy: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp"),
ResourceGroupName: pulumi.String("rg"),
Template: &app.TemplateArgs{
Containers: app.ContainerArray{
&app.ContainerArgs{
Image: pulumi.String("repo/testcontainerappmanagedby:v1"),
Name: pulumi.String("testcontainerappmanagedby"),
Probes: app.ContainerAppProbeArray{
&app.ContainerAppProbeArgs{
InitialDelaySeconds: pulumi.Int(3),
PeriodSeconds: pulumi.Int(3),
TcpSocket: &app.ContainerAppProbeTcpSocketArgs{
Port: pulumi.Int(8080),
},
Type: pulumi.String(app.TypeLiveness),
},
},
},
},
Scale: &app.ScaleArgs{
MaxReplicas: pulumi.Int(5),
MinReplicas: pulumi.Int(1),
Rules: app.ScaleRuleArray{
&app.ScaleRuleArgs{
Name: pulumi.String("tcpscalingrule"),
Tcp: &app.TcpScaleRuleArgs{
Metadata: pulumi.StringMap{
"concurrentConnections": pulumi.String("50"),
},
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.ContainerApp;
import com.pulumi.azurenative.app.ContainerAppArgs;
import com.pulumi.azurenative.app.inputs.ConfigurationArgs;
import com.pulumi.azurenative.app.inputs.IngressArgs;
import com.pulumi.azurenative.app.inputs.TemplateArgs;
import com.pulumi.azurenative.app.inputs.ScaleArgs;
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 containerApp = new ContainerApp("containerApp", ContainerAppArgs.builder()
.configuration(ConfigurationArgs.builder()
.ingress(IngressArgs.builder()
.exposedPort(4000)
.external(true)
.targetPort(3000)
.traffic(TrafficWeightArgs.builder()
.revisionName("testcontainerappmanagedby-ab1234")
.weight(100)
.build())
.transport("tcp")
.build())
.build())
.containerAppName("testcontainerappmanagedby")
.environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.location("East US")
.managedBy("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp")
.resourceGroupName("rg")
.template(TemplateArgs.builder()
.containers(ContainerArgs.builder()
.image("repo/testcontainerappmanagedby:v1")
.name("testcontainerappmanagedby")
.probes(ContainerAppProbeArgs.builder()
.initialDelaySeconds(3)
.periodSeconds(3)
.tcpSocket(ContainerAppProbeTcpSocketArgs.builder()
.port(8080)
.build())
.type("Liveness")
.build())
.build())
.scale(ScaleArgs.builder()
.maxReplicas(5)
.minReplicas(1)
.rules(ScaleRuleArgs.builder()
.name("tcpscalingrule")
.tcp(TcpScaleRuleArgs.builder()
.metadata(Map.of("concurrentConnections", "50"))
.build())
.build())
.build())
.build())
.build());
}
}
Create or Update Tcp App
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var containerApp = new AzureNative.App.ContainerApp("containerApp", new()
{
Configuration = new AzureNative.App.Inputs.ConfigurationArgs
{
Ingress = new AzureNative.App.Inputs.IngressArgs
{
ExposedPort = 4000,
External = true,
TargetPort = 3000,
Traffic = new[]
{
new AzureNative.App.Inputs.TrafficWeightArgs
{
RevisionName = "testcontainerapptcp-ab1234",
Weight = 100,
},
},
Transport = AzureNative.App.IngressTransportMethod.Tcp,
},
},
ContainerAppName = "testcontainerapptcp",
EnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
Location = "East US",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.TemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerapptcp:v1",
Name = "testcontainerapptcp",
Probes = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeArgs
{
InitialDelaySeconds = 3,
PeriodSeconds = 3,
TcpSocket = new AzureNative.App.Inputs.ContainerAppProbeTcpSocketArgs
{
Port = 8080,
},
Type = AzureNative.App.Type.Liveness,
},
},
},
},
Scale = new AzureNative.App.Inputs.ScaleArgs
{
MaxReplicas = 5,
MinReplicas = 1,
Rules = new[]
{
new AzureNative.App.Inputs.ScaleRuleArgs
{
Name = "tcpscalingrule",
Tcp = new AzureNative.App.Inputs.TcpScaleRuleArgs
{
Metadata =
{
{ "concurrentConnections", "50" },
},
},
},
},
},
},
});
});
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.NewContainerApp(ctx, "containerApp", &app.ContainerAppArgs{
Configuration: &app.ConfigurationArgs{
Ingress: &app.IngressArgs{
ExposedPort: pulumi.Int(4000),
External: pulumi.Bool(true),
TargetPort: pulumi.Int(3000),
Traffic: app.TrafficWeightArray{
&app.TrafficWeightArgs{
RevisionName: pulumi.String("testcontainerapptcp-ab1234"),
Weight: pulumi.Int(100),
},
},
Transport: pulumi.String(app.IngressTransportMethodTcp),
},
},
ContainerAppName: pulumi.String("testcontainerapptcp"),
EnvironmentId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("rg"),
Template: &app.TemplateArgs{
Containers: app.ContainerArray{
&app.ContainerArgs{
Image: pulumi.String("repo/testcontainerapptcp:v1"),
Name: pulumi.String("testcontainerapptcp"),
Probes: app.ContainerAppProbeArray{
&app.ContainerAppProbeArgs{
InitialDelaySeconds: pulumi.Int(3),
PeriodSeconds: pulumi.Int(3),
TcpSocket: &app.ContainerAppProbeTcpSocketArgs{
Port: pulumi.Int(8080),
},
Type: pulumi.String(app.TypeLiveness),
},
},
},
},
Scale: &app.ScaleArgs{
MaxReplicas: pulumi.Int(5),
MinReplicas: pulumi.Int(1),
Rules: app.ScaleRuleArray{
&app.ScaleRuleArgs{
Name: pulumi.String("tcpscalingrule"),
Tcp: &app.TcpScaleRuleArgs{
Metadata: pulumi.StringMap{
"concurrentConnections": pulumi.String("50"),
},
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.ContainerApp;
import com.pulumi.azurenative.app.ContainerAppArgs;
import com.pulumi.azurenative.app.inputs.ConfigurationArgs;
import com.pulumi.azurenative.app.inputs.IngressArgs;
import com.pulumi.azurenative.app.inputs.TemplateArgs;
import com.pulumi.azurenative.app.inputs.ScaleArgs;
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 containerApp = new ContainerApp("containerApp", ContainerAppArgs.builder()
.configuration(ConfigurationArgs.builder()
.ingress(IngressArgs.builder()
.exposedPort(4000)
.external(true)
.targetPort(3000)
.traffic(TrafficWeightArgs.builder()
.revisionName("testcontainerapptcp-ab1234")
.weight(100)
.build())
.transport("tcp")
.build())
.build())
.containerAppName("testcontainerapptcp")
.environmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.location("East US")
.resourceGroupName("rg")
.template(TemplateArgs.builder()
.containers(ContainerArgs.builder()
.image("repo/testcontainerapptcp:v1")
.name("testcontainerapptcp")
.probes(ContainerAppProbeArgs.builder()
.initialDelaySeconds(3)
.periodSeconds(3)
.tcpSocket(ContainerAppProbeTcpSocketArgs.builder()
.port(8080)
.build())
.type("Liveness")
.build())
.build())
.scale(ScaleArgs.builder()
.maxReplicas(5)
.minReplicas(1)
.rules(ScaleRuleArgs.builder()
.name("tcpscalingrule")
.tcp(TcpScaleRuleArgs.builder()
.metadata(Map.of("concurrentConnections", "50"))
.build())
.build())
.build())
.build())
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:app:ContainerApp testcontainerapptcp /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}
Constructors
Properties
Non versioned Container App configuration properties.
Name of the Container App.
Resource ID of environment.
The complex type of the extended location.
managed identities for the Container App to interact with other Azure services without maintaining any secrets or credentials in code.
The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource.
Deprecated. Resource ID of the Container App's environment.
The name of the resource group. The name is case insensitive.
Container App versioned application definition.
Workload profile name to pin for container app execution.