Microsoft.ContainerInstance containerGroups 2017-10-01-preview

Bicep resource definition

The containerGroups resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.ContainerInstance/containerGroups resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.ContainerInstance/containerGroups@2017-10-01-preview' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  properties: {
    containers: [
      {
        name: 'string'
        properties: {
          command: [
            'string'
          ]
          environmentVariables: [
            {
              name: 'string'
              value: 'string'
            }
          ]
          image: 'string'
          ports: [
            {
              port: int
              protocol: 'string'
            }
          ]
          resources: {
            limits: {
              cpu: int
              memoryInGB: json('decimal-as-string')
            }
            requests: {
              cpu: int
              memoryInGB: json('decimal-as-string')
            }
          }
          volumeMounts: [
            {
              mountPath: 'string'
              name: 'string'
              readOnly: bool
            }
          ]
        }
      }
    ]
    imageRegistryCredentials: [
      {
        password: 'string'
        server: 'string'
        username: 'string'
      }
    ]
    ipAddress: {
      ip: 'string'
      ports: [
        {
          port: int
          protocol: 'string'
        }
      ]
      type: 'Public'
    }
    osType: 'string'
    restartPolicy: 'string'
    volumes: [
      {
        azureFile: {
          readOnly: bool
          shareName: 'string'
          storageAccountKey: 'string'
          storageAccountName: 'string'
        }
        emptyDir: any()
        name: 'string'
      }
    ]
  }
}

Property values

containerGroups

Name Description Value
name The resource name string (required)

Character limit: 1-63

Valid characters:
Lowercase letters, numbers, and hyphens.

Can't start or end with hyphen. Consecutive hyphens aren't allowed.
location The resource location. string (required)
tags The resource tags. Dictionary of tag names and values. See Tags in templates
properties ContainerGroupProperties (required)

ContainerGroupProperties

Name Description Value
containers The containers within the container group. Container[] (required)
imageRegistryCredentials The image registry credentials by which the container group is created from. ImageRegistryCredential[]
ipAddress The IP address type of the container group. IpAddress
osType The operating system type required by the containers in the container group. 'Linux'
'Windows' (required)
restartPolicy Restart policy for all containers within the container group.
- Always Always restart
- OnFailure Restart on failure
- Never Never restart
'Always'
'Never'
'OnFailure'
volumes The list of volumes that can be mounted by containers in this container group. Volume[]

Container

Name Description Value
name The user-provided name of the container instance. string (required)
properties The properties of the container instance. ContainerProperties (required)

ContainerProperties

Name Description Value
command The commands to execute within the container instance in exec form. string[]
environmentVariables The environment variables to set in the container instance. EnvironmentVariable[]
image The name of the image used to create the container instance. string (required)
ports The exposed ports on the container instance. ContainerPort[]
resources The resource requirements of the container instance. ResourceRequirements (required)
volumeMounts The volume mounts available to the container instance. VolumeMount[]

EnvironmentVariable

Name Description Value
name The name of the environment variable. string (required)
value The value of the environment variable. string (required)

ContainerPort

Name Description Value
port The port number exposed within the container group. int (required)
protocol The protocol associated with the port. 'TCP'
'UDP'

ResourceRequirements

Name Description Value
limits The resource limits of this container instance. ResourceLimits
requests The resource requests of this container instance. ResourceRequests (required)

ResourceLimits

Name Description Value
cpu The CPU limit of this container instance. int
memoryInGB The memory limit in GB of this container instance. To specify a decimal value, use the json() function. int or json decimal

ResourceRequests

Name Description Value
cpu The CPU request of this container instance. int (required)
memoryInGB The memory request in GB of this container instance. To specify a decimal value, use the json() function. int or json decimal (required)

VolumeMount

Name Description Value
mountPath The path within the container where the volume should be mounted. Must not contain colon (:). string (required)
name The name of the volume mount. string (required)
readOnly The flag indicating whether the volume mount is read-only. bool

ImageRegistryCredential

Name Description Value
password The password for the private registry. string
server The Docker image registry server without a protocol such as "http" and "https". string (required)
username The username for the private registry. string (required)

IpAddress

Name Description Value
ip The IP exposed to the public internet. string
ports The list of ports exposed on the container group. Port[] (required)
type Specifies if the IP is exposed to the public internet. 'Public' (required)

Port

Name Description Value
port The port number. int (required)
protocol The protocol associated with the port. 'TCP'
'UDP'

Volume

Name Description Value
azureFile The name of the Azure File volume. AzureFileVolume
emptyDir The empty directory volume. For Bicep, you can use the any() function.
name The name of the volume. string (required)

AzureFileVolume

Name Description Value
readOnly The flag indicating whether the Azure File shared mounted as a volume is read-only. bool
shareName The name of the Azure File share to be mounted as a volume. string (required)
storageAccountKey The storage account access key used to access the Azure File share. string
storageAccountName The name of the storage account that contains the Azure File share. string (required)

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
SQL Server availability group on AKS

Deploy to Azure
This creates a new AKS Cluster and then deploys SQL Server availability groups into it using a CNAB package deployed using Duffle and ACI
Create a WordPress site

Deploy to Azure
This template creates a WordPress site on Container Instance
Create a WordPress site in a virtual network

Deploy to Azure
This template creates a WordPress site on Container Instance in a virtual network. And output a public site FQDN which could access WordPress site.
Azure Container Instances - BC with SQL Server and IIS

Deploy to Azure
Deploy a single Windows container with a fully featured self-contained Microsoft Dynamics 365 Business Central environment on Azure Container Instances.
Front Door with Container Instances and Application Gateway

Deploy to Azure
This template creates a Front Door Standard/Premium with a container group and Application Gateway.
Front Door Standard/Premium with Azure Container Instances

Deploy to Azure
This template creates a Front Door Standard/Premium with a container group.
Azure Container Instances - container with health probe

Deploy to Azure
Deploy a Linux container that has a health probe using Azure Container Instances.
Azure Container Instances - Linux container with public IP

Deploy to Azure
Deploy a single Linux container accessible via a public IP using Azure Container Instances.
Azure Container Instances - container with secure envVar

Deploy to Azure
Deploy a Linux container that has a secure environment variable using Azure Container Instances.
Azure Container Instances - Linux container with emptyDir

Deploy to Azure
Deploy two Linux containers that share an emptyDir volume using Azure Container Instances.
Azure Container Instances - Linux container with gitRepo

Deploy to Azure
Deploy a Linux container that uses an gitRepo volume using Azure Container Instances.
Azure Container Instances - container with secrets

Deploy to Azure
Deploy a Linux container that has a secret volume using Azure Container Instances.
Create an on-demand SFTP Server with persistent storage

Deploy to Azure
This template demonstrates an on-demand SFTP server using an Azure Container Instance (ACI).
On-demand SFTP Server using an existing storage account

Deploy to Azure
This template demonstrates an on-demand SFTP server using an Azure Container Instance (ACI).
Create a Storage Account File Share via Containers

Deploy to Azure
This template creates a storage account and a file share via azure-cli in a Container Instance
UDP Container in ACI

Deploy to Azure
This templates creates an ACI resource and exposes a container through UDP
Azure Container Instances - VNet

Deploy to Azure
Deploy a container instance into an Azure virtual network.
Create Application Gateway with Certificates

Deploy to Azure
This template shows how to generate Key Vault self-signed certificates, then reference from Application Gateway.

ARM template resource definition

The containerGroups resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.ContainerInstance/containerGroups resource, add the following JSON to your template.

{
  "type": "Microsoft.ContainerInstance/containerGroups",
  "apiVersion": "2017-10-01-preview",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "properties": {
    "containers": [
      {
        "name": "string",
        "properties": {
          "command": [ "string" ],
          "environmentVariables": [
            {
              "name": "string",
              "value": "string"
            }
          ],
          "image": "string",
          "ports": [
            {
              "port": "int",
              "protocol": "string"
            }
          ],
          "resources": {
            "limits": {
              "cpu": "int",
              "memoryInGB": "[json('decimal-as-string')]"
            },
            "requests": {
              "cpu": "int",
              "memoryInGB": "[json('decimal-as-string')]"
            }
          },
          "volumeMounts": [
            {
              "mountPath": "string",
              "name": "string",
              "readOnly": "bool"
            }
          ]
        }
      }
    ],
    "imageRegistryCredentials": [
      {
        "password": "string",
        "server": "string",
        "username": "string"
      }
    ],
    "ipAddress": {
      "ip": "string",
      "ports": [
        {
          "port": "int",
          "protocol": "string"
        }
      ],
      "type": "Public"
    },
    "osType": "string",
    "restartPolicy": "string",
    "volumes": [
      {
        "azureFile": {
          "readOnly": "bool",
          "shareName": "string",
          "storageAccountKey": "string",
          "storageAccountName": "string"
        },
        "emptyDir": {},
        "name": "string"
      }
    ]
  }
}

Property values

containerGroups

Name Description Value
type The resource type 'Microsoft.ContainerInstance/containerGroups'
apiVersion The resource api version '2017-10-01-preview'
name The resource name string (required)

Character limit: 1-63

Valid characters:
Lowercase letters, numbers, and hyphens.

Can't start or end with hyphen. Consecutive hyphens aren't allowed.
location The resource location. string (required)
tags The resource tags. Dictionary of tag names and values. See Tags in templates
properties ContainerGroupProperties (required)

ContainerGroupProperties

Name Description Value
containers The containers within the container group. Container[] (required)
imageRegistryCredentials The image registry credentials by which the container group is created from. ImageRegistryCredential[]
ipAddress The IP address type of the container group. IpAddress
osType The operating system type required by the containers in the container group. 'Linux'
'Windows' (required)
restartPolicy Restart policy for all containers within the container group.
- Always Always restart
- OnFailure Restart on failure
- Never Never restart
'Always'
'Never'
'OnFailure'
volumes The list of volumes that can be mounted by containers in this container group. Volume[]

Container

Name Description Value
name The user-provided name of the container instance. string (required)
properties The properties of the container instance. ContainerProperties (required)

ContainerProperties

Name Description Value
command The commands to execute within the container instance in exec form. string[]
environmentVariables The environment variables to set in the container instance. EnvironmentVariable[]
image The name of the image used to create the container instance. string (required)
ports The exposed ports on the container instance. ContainerPort[]
resources The resource requirements of the container instance. ResourceRequirements (required)
volumeMounts The volume mounts available to the container instance. VolumeMount[]

EnvironmentVariable

Name Description Value
name The name of the environment variable. string (required)
value The value of the environment variable. string (required)

ContainerPort

Name Description Value
port The port number exposed within the container group. int (required)
protocol The protocol associated with the port. 'TCP'
'UDP'

ResourceRequirements

Name Description Value
limits The resource limits of this container instance. ResourceLimits
requests The resource requests of this container instance. ResourceRequests (required)

ResourceLimits

Name Description Value
cpu The CPU limit of this container instance. int
memoryInGB The memory limit in GB of this container instance. To specify a decimal value, use the json() function. int or json decimal

ResourceRequests

Name Description Value
cpu The CPU request of this container instance. int (required)
memoryInGB The memory request in GB of this container instance. To specify a decimal value, use the json() function. int or json decimal (required)

VolumeMount

Name Description Value
mountPath The path within the container where the volume should be mounted. Must not contain colon (:). string (required)
name The name of the volume mount. string (required)
readOnly The flag indicating whether the volume mount is read-only. bool

ImageRegistryCredential

Name Description Value
password The password for the private registry. string
server The Docker image registry server without a protocol such as "http" and "https". string (required)
username The username for the private registry. string (required)

IpAddress

Name Description Value
ip The IP exposed to the public internet. string
ports The list of ports exposed on the container group. Port[] (required)
type Specifies if the IP is exposed to the public internet. 'Public' (required)

Port

Name Description Value
port The port number. int (required)
protocol The protocol associated with the port. 'TCP'
'UDP'

Volume

Name Description Value
azureFile The name of the Azure File volume. AzureFileVolume
emptyDir The empty directory volume.
name The name of the volume. string (required)

AzureFileVolume

Name Description Value
readOnly The flag indicating whether the Azure File shared mounted as a volume is read-only. bool
shareName The name of the Azure File share to be mounted as a volume. string (required)
storageAccountKey The storage account access key used to access the Azure File share. string
storageAccountName The name of the storage account that contains the Azure File share. string (required)

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
SQL Server availability group on AKS

Deploy to Azure
This creates a new AKS Cluster and then deploys SQL Server availability groups into it using a CNAB package deployed using Duffle and ACI
Create a WordPress site

Deploy to Azure
This template creates a WordPress site on Container Instance
Create a WordPress site in a virtual network

Deploy to Azure
This template creates a WordPress site on Container Instance in a virtual network. And output a public site FQDN which could access WordPress site.
Azure Container Instances - BC with SQL Server and IIS

Deploy to Azure
Deploy a single Windows container with a fully featured self-contained Microsoft Dynamics 365 Business Central environment on Azure Container Instances.
Front Door with Container Instances and Application Gateway

Deploy to Azure
This template creates a Front Door Standard/Premium with a container group and Application Gateway.
Front Door Standard/Premium with Azure Container Instances

Deploy to Azure
This template creates a Front Door Standard/Premium with a container group.
Azure Container Instances - container with health probe

Deploy to Azure
Deploy a Linux container that has a health probe using Azure Container Instances.
Azure Container Instances - Linux container with public IP

Deploy to Azure
Deploy a single Linux container accessible via a public IP using Azure Container Instances.
Azure Container Instances - container with secure envVar

Deploy to Azure
Deploy a Linux container that has a secure environment variable using Azure Container Instances.
Azure Container Instances - Linux container with emptyDir

Deploy to Azure
Deploy two Linux containers that share an emptyDir volume using Azure Container Instances.
Azure Container Instances - Linux container with gitRepo

Deploy to Azure
Deploy a Linux container that uses an gitRepo volume using Azure Container Instances.
Azure Container Instances - container with secrets

Deploy to Azure
Deploy a Linux container that has a secret volume using Azure Container Instances.
Create an on-demand SFTP Server with persistent storage

Deploy to Azure
This template demonstrates an on-demand SFTP server using an Azure Container Instance (ACI).
On-demand SFTP Server using an existing storage account

Deploy to Azure
This template demonstrates an on-demand SFTP server using an Azure Container Instance (ACI).
Create a Storage Account File Share via Containers

Deploy to Azure
This template creates a storage account and a file share via azure-cli in a Container Instance
UDP Container in ACI

Deploy to Azure
This templates creates an ACI resource and exposes a container through UDP
Azure Container Instances - VNet

Deploy to Azure
Deploy a container instance into an Azure virtual network.
Create Application Gateway with Certificates

Deploy to Azure
This template shows how to generate Key Vault self-signed certificates, then reference from Application Gateway.

Terraform (AzAPI provider) resource definition

The containerGroups resource type can be deployed with operations that target:

  • Resource groups

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.ContainerInstance/containerGroups resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.ContainerInstance/containerGroups@2017-10-01-preview"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      containers = [
        {
          name = "string"
          properties = {
            command = [
              "string"
            ]
            environmentVariables = [
              {
                name = "string"
                value = "string"
              }
            ]
            image = "string"
            ports = [
              {
                port = int
                protocol = "string"
              }
            ]
            resources = {
              limits = {
                cpu = int
                memoryInGB = "decimal-as-string"
              }
              requests = {
                cpu = int
                memoryInGB = "decimal-as-string"
              }
            }
            volumeMounts = [
              {
                mountPath = "string"
                name = "string"
                readOnly = bool
              }
            ]
          }
        }
      ]
      imageRegistryCredentials = [
        {
          password = "string"
          server = "string"
          username = "string"
        }
      ]
      ipAddress = {
        ip = "string"
        ports = [
          {
            port = int
            protocol = "string"
          }
        ]
        type = "Public"
      }
      osType = "string"
      restartPolicy = "string"
      volumes = [
        {
          azureFile = {
            readOnly = bool
            shareName = "string"
            storageAccountKey = "string"
            storageAccountName = "string"
          }
          name = "string"
        }
      ]
    }
  })
}

Property values

containerGroups

Name Description Value
type The resource type "Microsoft.ContainerInstance/containerGroups@2017-10-01-preview"
name The resource name string (required)

Character limit: 1-63

Valid characters:
Lowercase letters, numbers, and hyphens.

Can't start or end with hyphen. Consecutive hyphens aren't allowed.
location The resource location. string (required)
parent_id To deploy to a resource group, use the ID of that resource group. string (required)
tags The resource tags. Dictionary of tag names and values.
properties ContainerGroupProperties (required)

ContainerGroupProperties

Name Description Value
containers The containers within the container group. Container[] (required)
imageRegistryCredentials The image registry credentials by which the container group is created from. ImageRegistryCredential[]
ipAddress The IP address type of the container group. IpAddress
osType The operating system type required by the containers in the container group. "Linux"
"Windows" (required)
restartPolicy Restart policy for all containers within the container group.
- Always Always restart
- OnFailure Restart on failure
- Never Never restart
"Always"
"Never"
"OnFailure"
volumes The list of volumes that can be mounted by containers in this container group. Volume[]

Container

Name Description Value
name The user-provided name of the container instance. string (required)
properties The properties of the container instance. ContainerProperties (required)

ContainerProperties

Name Description Value
command The commands to execute within the container instance in exec form. string[]
environmentVariables The environment variables to set in the container instance. EnvironmentVariable[]
image The name of the image used to create the container instance. string (required)
ports The exposed ports on the container instance. ContainerPort[]
resources The resource requirements of the container instance. ResourceRequirements (required)
volumeMounts The volume mounts available to the container instance. VolumeMount[]

EnvironmentVariable

Name Description Value
name The name of the environment variable. string (required)
value The value of the environment variable. string (required)

ContainerPort

Name Description Value
port The port number exposed within the container group. int (required)
protocol The protocol associated with the port. "TCP"
"UDP"

ResourceRequirements

Name Description Value
limits The resource limits of this container instance. ResourceLimits
requests The resource requests of this container instance. ResourceRequests (required)

ResourceLimits

Name Description Value
cpu The CPU limit of this container instance. int
memoryInGB The memory limit in GB of this container instance. Specify a decimal value as a string. int or json decimal

ResourceRequests

Name Description Value
cpu The CPU request of this container instance. int (required)
memoryInGB The memory request in GB of this container instance. Specify a decimal value as a string. int or json decimal (required)

VolumeMount

Name Description Value
mountPath The path within the container where the volume should be mounted. Must not contain colon (:). string (required)
name The name of the volume mount. string (required)
readOnly The flag indicating whether the volume mount is read-only. bool

ImageRegistryCredential

Name Description Value
password The password for the private registry. string
server The Docker image registry server without a protocol such as "http" and "https". string (required)
username The username for the private registry. string (required)

IpAddress

Name Description Value
ip The IP exposed to the public internet. string
ports The list of ports exposed on the container group. Port[] (required)
type Specifies if the IP is exposed to the public internet. "Public" (required)

Port

Name Description Value
port The port number. int (required)
protocol The protocol associated with the port. "TCP"
"UDP"

Volume

Name Description Value
azureFile The name of the Azure File volume. AzureFileVolume
emptyDir The empty directory volume.
name The name of the volume. string (required)

AzureFileVolume

Name Description Value
readOnly The flag indicating whether the Azure File shared mounted as a volume is read-only. bool
shareName The name of the Azure File share to be mounted as a volume. string (required)
storageAccountKey The storage account access key used to access the Azure File share. string
storageAccountName The name of the storage account that contains the Azure File share. string (required)