1. Packages
  2. Packages
  3. Defang Providers
  4. API Docs
  5. Service
Viewing docs for Defang Azure v2.4.1
published on Saturday, Jul 11, 2026 by Defang
defang-azure logo
Viewing docs for Defang Azure v2.4.1
published on Saturday, Jul 11, 2026 by Defang

    Create Service Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Service(name: string, args: ServiceArgs, opts?: ComponentResourceOptions);
    @overload
    def Service(resource_name: str,
                args: ServiceArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Service(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                image: Optional[str] = None,
                command: Optional[Sequence[str]] = None,
                deploy: Optional[_compose.DeployConfigArgs] = None,
                domain_name: Optional[str] = None,
                entrypoint: Optional[Sequence[str]] = None,
                environment: Optional[Mapping[str, str]] = None,
                health_check: Optional[_compose.HealthCheckConfigArgs] = None,
                platform: Optional[str] = None,
                ports: Optional[Sequence[_compose.ServicePortConfigArgs]] = None,
                project_name: Optional[str] = None)
    func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
    public Service(string name, ServiceArgs args, ComponentResourceOptions? opts = null)
    public Service(String name, ServiceArgs args)
    public Service(String name, ServiceArgs args, ComponentResourceOptions options)
    
    type: defang-azure:Service
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "defang-azure_service" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    options ComponentResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var serviceResource = new DefangAzure.Service("serviceResource", new()
    {
        Image = "string",
        Command = new[]
        {
            "string",
        },
        Deploy = new DefangAzure.Compose.Inputs.DeployConfigArgs
        {
            Replicas = 0,
            Resources = new DefangAzure.Compose.Inputs.ResourcesArgs
            {
                Reservations = new DefangAzure.Compose.Inputs.ResourceConfigArgs
                {
                    Cpus = 0,
                    Memory = "string",
                },
            },
        },
        DomainName = "string",
        Entrypoint = new[]
        {
            "string",
        },
        Environment = 
        {
            { "string", "string" },
        },
        HealthCheck = new DefangAzure.Compose.Inputs.HealthCheckConfigArgs
        {
            IntervalSeconds = 0,
            Retries = 0,
            StartPeriodSeconds = 0,
            Test = new[]
            {
                "string",
            },
            TimeoutSeconds = 0,
        },
        Platform = "string",
        Ports = new[]
        {
            new DefangAzure.Compose.Inputs.ServicePortConfigArgs
            {
                Target = 0,
                AppProtocol = "string",
                Listener = "string",
                Mode = "string",
                Protocol = "string",
            },
        },
        ProjectName = "string",
    });
    
    example, err := defangazure.NewService(ctx, "serviceResource", &defangazure.ServiceArgs{
    	Image: pulumi.String("string"),
    	Command: pulumi.StringArray{
    		"string",
    	},
    	Deploy: &compose.DeployConfigArgs{
    		Replicas: pulumi.Int(0),
    		Resources: &compose.ResourcesArgs{
    			Reservations: &compose.ResourceConfigArgs{
    				Cpus:   pulumi.Float64(0),
    				Memory: pulumi.String("string"),
    			},
    		},
    	},
    	DomainName: "string",
    	Entrypoint: pulumi.StringArray{
    		"string",
    	},
    	Environment: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	HealthCheck: &compose.HealthCheckConfigArgs{
    		IntervalSeconds:    pulumi.Int(0),
    		Retries:            pulumi.Int(0),
    		StartPeriodSeconds: pulumi.Int(0),
    		Test: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		TimeoutSeconds: pulumi.Int(0),
    	},
    	Platform: "string",
    	Ports: compose.ServicePortConfigArray{
    		&compose.ServicePortConfigArgs{
    			Target:      pulumi.Int(0),
    			AppProtocol: pulumi.String("string"),
    			Listener:    pulumi.String("string"),
    			Mode:        pulumi.String("string"),
    			Protocol:    pulumi.String("string"),
    		},
    	},
    	ProjectName: "string",
    })
    
    resource "defang-azure_service" "serviceResource" {
      image   = "string"
      command = ["string"]
      deploy = {
        replicas = 0
        resources = {
          reservations = {
            cpus   = 0
            memory = "string"
          }
        }
      }
      domain_name = "string"
      entrypoint  = ["string"]
      environment = {
        "string" = "string"
      }
      health_check = {
        interval_seconds     = 0
        retries              = 0
        start_period_seconds = 0
        test                 = ["string"]
        timeout_seconds      = 0
      }
      platform = "string"
      ports {
        target       = 0
        app_protocol = "string"
        listener     = "string"
        mode         = "string"
        protocol     = "string"
      }
      project_name = "string"
    }
    
    var serviceResource = new Service("serviceResource", ServiceArgs.builder()
        .image("string")
        .command("string")
        .deploy(DeployConfigArgs.builder()
            .replicas(0)
            .resources(ResourcesArgs.builder()
                .reservations(ResourceConfigArgs.builder()
                    .cpus(0.0)
                    .memory("string")
                    .build())
                .build())
            .build())
        .domainName("string")
        .entrypoint("string")
        .environment(Map.of("string", "string"))
        .healthCheck(HealthCheckConfigArgs.builder()
            .intervalSeconds(0)
            .retries(0)
            .startPeriodSeconds(0)
            .test("string")
            .timeoutSeconds(0)
            .build())
        .platform("string")
        .ports(ServicePortConfigArgs.builder()
            .target(0)
            .appProtocol("string")
            .listener("string")
            .mode("string")
            .protocol("string")
            .build())
        .projectName("string")
        .build());
    
    service_resource = defang_azure.Service("serviceResource",
        image="string",
        command=["string"],
        deploy={
            "replicas": 0,
            "resources": {
                "reservations": {
                    "cpus": float(0),
                    "memory": "string",
                },
            },
        },
        domain_name="string",
        entrypoint=["string"],
        environment={
            "string": "string",
        },
        health_check={
            "interval_seconds": 0,
            "retries": 0,
            "start_period_seconds": 0,
            "test": ["string"],
            "timeout_seconds": 0,
        },
        platform="string",
        ports=[{
            "target": 0,
            "app_protocol": "string",
            "listener": "string",
            "mode": "string",
            "protocol": "string",
        }],
        project_name="string")
    
    const serviceResource = new defang_azure.Service("serviceResource", {
        image: "string",
        command: ["string"],
        deploy: {
            replicas: 0,
            resources: {
                reservations: {
                    cpus: 0,
                    memory: "string",
                },
            },
        },
        domainName: "string",
        entrypoint: ["string"],
        environment: {
            string: "string",
        },
        healthCheck: {
            intervalSeconds: 0,
            retries: 0,
            startPeriodSeconds: 0,
            test: ["string"],
            timeoutSeconds: 0,
        },
        platform: "string",
        ports: [{
            target: 0,
            appProtocol: "string",
            listener: "string",
            mode: "string",
            protocol: "string",
        }],
        projectName: "string",
    });
    
    type: defang-azure:Service
    properties:
        command:
            - string
        deploy:
            replicas: 0
            resources:
                reservations:
                    cpus: 0
                    memory: string
        domainName: string
        entrypoint:
            - string
        environment:
            string: string
        healthCheck:
            intervalSeconds: 0
            retries: 0
            startPeriodSeconds: 0
            test:
                - string
            timeoutSeconds: 0
        image: string
        platform: string
        ports:
            - appProtocol: string
              listener: string
              mode: string
              protocol: string
              target: 0
        projectName: string
    

    Service Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Service resource accepts the following input properties:

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Service resource produces the following output properties:

    Endpoint string
    Endpoint string
    endpoint string
    endpoint String
    endpoint string
    endpoint String

    Supporting Types

    DeployConfig, DeployConfigArgs

    HealthCheckConfig, HealthCheckConfigArgs

    intervalSeconds Integer
    retries Integer
    startPeriodSeconds Integer
    test List<String>
    timeoutSeconds Integer
    intervalSeconds Number
    retries Number
    startPeriodSeconds Number
    test List<String>
    timeoutSeconds Number

    ResourceConfig, ResourceConfigArgs

    Cpus double
    Memory string
    Cpus float64
    Memory string
    cpus number
    memory string
    cpus Double
    memory String
    cpus number
    memory string
    cpus float
    memory str
    cpus Number
    memory String

    Resources, ResourcesArgs

    ServicePortConfig, ServicePortConfigArgs

    Target int
    AppProtocol string
    Listener string
    Mode string
    Protocol string
    Target int
    AppProtocol string
    Listener string
    Mode string
    Protocol string
    target number
    app_protocol string
    listener string
    mode string
    protocol string
    target Integer
    appProtocol String
    listener String
    mode String
    protocol String
    target number
    appProtocol string
    listener string
    mode string
    protocol string
    target Number
    appProtocol String
    listener String
    mode String
    protocol String

    Package Details

    Repository
    defang-azure DefangLabs/pulumi-defang
    License
    Apache-2.0
    defang-azure logo
    Viewing docs for Defang Azure v2.4.1
    published on Saturday, Jul 11, 2026 by Defang

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial