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.
To create a Microsoft.ContainerInstance/containerGroups resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.ContainerInstance/containerGroups@2018-10-01' = {
  scope: resourceSymbolicName or scope
  identity: {
    type: 'string'
    userAssignedIdentities: {
      {customized property}: {}
    }
  }
  ___location: 'string'
  name: 'string'
  properties: {
    containers: [
      {
        name: 'string'
        properties: {
          command: [
            'string'
          ]
          environmentVariables: [
            {
              name: 'string'
              secureValue: 'string'
              value: 'string'
            }
          ]
          image: 'string'
          livenessProbe: {
            exec: {
              command: [
                'string'
              ]
            }
            failureThreshold: int
            httpGet: {
              path: 'string'
              port: int
              scheme: 'string'
            }
            initialDelaySeconds: int
            periodSeconds: int
            successThreshold: int
            timeoutSeconds: int
          }
          ports: [
            {
              port: int
              protocol: 'string'
            }
          ]
          readinessProbe: {
            exec: {
              command: [
                'string'
              ]
            }
            failureThreshold: int
            httpGet: {
              path: 'string'
              port: int
              scheme: 'string'
            }
            initialDelaySeconds: int
            periodSeconds: int
            successThreshold: int
            timeoutSeconds: int
          }
          resources: {
            limits: {
              cpu: int
              gpu: {
                count: int
                sku: 'string'
              }
              memoryInGB: int
            }
            requests: {
              cpu: int
              gpu: {
                count: int
                sku: 'string'
              }
              memoryInGB: int
            }
          }
          volumeMounts: [
            {
              mountPath: 'string'
              name: 'string'
              readOnly: bool
            }
          ]
        }
      }
    ]
    diagnostics: {
      logAnalytics: {
        logType: 'string'
        metadata: {
          {customized property}: 'string'
        }
        workspaceId: 'string'
        workspaceKey: 'string'
      }
    }
    dnsConfig: {
      nameServers: [
        'string'
      ]
      options: 'string'
      searchDomains: 'string'
    }
    imageRegistryCredentials: [
      {
        password: 'string'
        server: 'string'
        username: 'string'
      }
    ]
    ipAddress: {
      dnsNameLabel: 'string'
      ip: 'string'
      ports: [
        {
          port: int
          protocol: 'string'
        }
      ]
      type: 'string'
    }
    networkProfile: {
      id: 'string'
    }
    osType: 'string'
    restartPolicy: 'string'
    volumes: [
      {
        azureFile: {
          readOnly: bool
          shareName: 'string'
          storageAccountKey: 'string'
          storageAccountName: 'string'
        }
        emptyDir: any(...)
        gitRepo: {
          directory: 'string'
          repository: 'string'
          revision: 'string'
        }
        name: 'string'
        secret: {
          {customized property}: 'string'
        }
      }
    ]
  }
  tags: {
    {customized property}: 'string'
  }
}
Property Values
Microsoft.ContainerInstance/containerGroups
| Name | 
Description | 
Value | 
| identity | 
The identity of the container group, if configured. | 
ContainerGroupIdentity | 
| ___location | 
The resource ___location. | 
string | 
| name | 
The resource name | 
string (required) | 
| properties | 
 | 
ContainerGroupProperties (required) | 
| scope | 
Use when creating a resource at a scope that is different than the deployment scope. | 
Set this property to the symbolic name of a resource to apply the extension resource. | 
| tags | 
Resource tags | 
Dictionary of tag names and values. See Tags in templates | 
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) | 
Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties
Container
| Name | 
Description | 
Value | 
| name | 
The user-provided name of the container instance. | 
string (required) | 
| properties | 
The properties of the container instance. | 
ContainerProperties (required) | 
ContainerExec
| Name | 
Description | 
Value | 
| command | 
The commands to execute within the container. | 
string[] | 
ContainerGroupDiagnostics
| Name | 
Description | 
Value | 
| logAnalytics | 
Container group log analytics information. | 
LogAnalytics | 
ContainerGroupIdentity
| Name | 
Description | 
Value | 
| type | 
The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. | 
'None' 'SystemAssigned' 'SystemAssigned, UserAssigned' 'UserAssigned' | 
| userAssignedIdentities | 
The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. | 
ContainerGroupIdentityUserAssignedIdentities | 
ContainerGroupIdentityUserAssignedIdentities
ContainerGroupNetworkProfile
| Name | 
Description | 
Value | 
| id | 
The identifier for a network profile. | 
string (required) | 
ContainerGroupProperties
| Name | 
Description | 
Value | 
| containers | 
The containers within the container group. | 
Container[] (required) | 
| diagnostics | 
The diagnostic information for a container group. | 
ContainerGroupDiagnostics | 
| dnsConfig | 
The DNS config information for a container group. | 
DnsConfiguration | 
| imageRegistryCredentials | 
The image registry credentials by which the container group is created from. | 
ImageRegistryCredential[] | 
| ipAddress | 
The IP address type of the container group. | 
IpAddress | 
| networkProfile | 
The network profile information for a container group. | 
ContainerGroupNetworkProfile | 
| 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[] | 
ContainerHttpGet
| Name | 
Description | 
Value | 
| path | 
The path to probe. | 
string | 
| port | 
The port number to probe. | 
int (required) | 
| scheme | 
The scheme. | 
'http' 'https' | 
ContainerPort
| Name | 
Description | 
Value | 
| port | 
The port number exposed within the container group. | 
int (required) | 
| protocol | 
The protocol associated with the port. | 
'TCP' 'UDP' | 
ContainerProbe
| Name | 
Description | 
Value | 
| exec | 
The execution command to probe | 
ContainerExec | 
| failureThreshold | 
The failure threshold. | 
int | 
| httpGet | 
The Http Get settings to probe | 
ContainerHttpGet | 
| initialDelaySeconds | 
The initial delay seconds. | 
int | 
| periodSeconds | 
The period seconds. | 
int | 
| successThreshold | 
The success threshold. | 
int | 
| timeoutSeconds | 
The timeout seconds. | 
int | 
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) | 
| livenessProbe | 
The liveness probe. | 
ContainerProbe | 
| ports | 
The exposed ports on the container instance. | 
ContainerPort[] | 
| readinessProbe | 
The readiness probe. | 
ContainerProbe | 
| resources | 
The resource requirements of the container instance. | 
ResourceRequirements (required) | 
| volumeMounts | 
The volume mounts available to the container instance. | 
VolumeMount[] | 
DnsConfiguration
| Name | 
Description | 
Value | 
| nameServers | 
The DNS servers for the container group. | 
string[] (required) | 
| options | 
The DNS options for the container group. | 
string | 
| searchDomains | 
The DNS search domains for hostname lookup in the container group. | 
string | 
EnvironmentVariable
| Name | 
Description | 
Value | 
| name | 
The name of the environment variable. | 
string (required) | 
| secureValue | 
The value of the secure environment variable. | 
string | 
| value | 
The value of the environment variable. | 
string | 
GitRepoVolume
| Name | 
Description | 
Value | 
| directory | 
Target directory name. Must not contain or start with '..'.  If '.' is supplied, the volume directory will be the git repository.  Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. | 
string | 
| repository | 
Repository URL | 
string (required) | 
| revision | 
Commit hash for the specified revision. | 
string | 
GpuResource
| Name | 
Description | 
Value | 
| count | 
The count of the GPU resource. | 
int (required) | 
| sku | 
The SKU of the GPU resource. | 
'K80' 'P100' 'V100' (required) | 
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 | 
| dnsNameLabel | 
The Dns name label for the IP. | 
string | 
| 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 or private VNET. | 
'Private' 'Public' (required) | 
LogAnalytics
| Name | 
Description | 
Value | 
| logType | 
The log type to be used. | 
'ContainerInsights' 'ContainerInstanceLogs' | 
| metadata | 
Metadata for log analytics. | 
LogAnalyticsMetadata | 
| workspaceId | 
The workspace id for log analytics | 
string (required) | 
| workspaceKey | 
The workspace key for log analytics | 
string (required) | 
Port
| Name | 
Description | 
Value | 
| port | 
The port number. | 
int (required) | 
| protocol | 
The protocol associated with the port. | 
'TCP' 'UDP' | 
ResourceLimits
| Name | 
Description | 
Value | 
| cpu | 
The CPU limit of this container instance. | 
int | 
| gpu | 
The GPU limit of this container instance. | 
GpuResource | 
| memoryInGB | 
The memory limit in GB of this container instance. | 
int | 
ResourceRequests
| Name | 
Description | 
Value | 
| cpu | 
The CPU request of this container instance. | 
int (required) | 
| gpu | 
The GPU request of this container instance. | 
GpuResource | 
| memoryInGB | 
The memory request in GB of this container instance. | 
int (required) | 
ResourceRequirements
| Name | 
Description | 
Value | 
| limits | 
The resource limits of this container instance. | 
ResourceLimits | 
| requests | 
The resource requests of this container instance. | 
ResourceRequests (required) | 
SecretVolume
Volume
| Name | 
Description | 
Value | 
| azureFile | 
The Azure File volume. | 
AzureFileVolume | 
| emptyDir | 
The empty directory volume. | 
any | 
| gitRepo | 
The git repo volume. | 
GitRepoVolume | 
| name | 
The name of the volume. | 
string (required) | 
| secret | 
The secret volume. | 
SecretVolume | 
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 | 
Usage Examples
Azure Verified Modules
The following Azure Verified Modules can be used to deploy this resource type.
Azure Quickstart Samples
The following Azure Quickstart templates contain Bicep samples for deploying this resource type.
 
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.
To create a Microsoft.ContainerInstance/containerGroups resource, add the following JSON to your template.
{
  "type": "Microsoft.ContainerInstance/containerGroups",
  "apiVersion": "2018-10-01",
  "name": "string",
  "identity": {
    "type": "string",
    "userAssignedIdentities": {
      "{customized property}": {
      }
    }
  },
  "___location": "string",
  "properties": {
    "containers": [
      {
        "name": "string",
        "properties": {
          "command": [ "string" ],
          "environmentVariables": [
            {
              "name": "string",
              "secureValue": "string",
              "value": "string"
            }
          ],
          "image": "string",
          "livenessProbe": {
            "exec": {
              "command": [ "string" ]
            },
            "failureThreshold": "int",
            "httpGet": {
              "path": "string",
              "port": "int",
              "scheme": "string"
            },
            "initialDelaySeconds": "int",
            "periodSeconds": "int",
            "successThreshold": "int",
            "timeoutSeconds": "int"
          },
          "ports": [
            {
              "port": "int",
              "protocol": "string"
            }
          ],
          "readinessProbe": {
            "exec": {
              "command": [ "string" ]
            },
            "failureThreshold": "int",
            "httpGet": {
              "path": "string",
              "port": "int",
              "scheme": "string"
            },
            "initialDelaySeconds": "int",
            "periodSeconds": "int",
            "successThreshold": "int",
            "timeoutSeconds": "int"
          },
          "resources": {
            "limits": {
              "cpu": "int",
              "gpu": {
                "count": "int",
                "sku": "string"
              },
              "memoryInGB": "int"
            },
            "requests": {
              "cpu": "int",
              "gpu": {
                "count": "int",
                "sku": "string"
              },
              "memoryInGB": "int"
            }
          },
          "volumeMounts": [
            {
              "mountPath": "string",
              "name": "string",
              "readOnly": "bool"
            }
          ]
        }
      }
    ],
    "diagnostics": {
      "logAnalytics": {
        "logType": "string",
        "metadata": {
          "{customized property}": "string"
        },
        "workspaceId": "string",
        "workspaceKey": "string"
      }
    },
    "dnsConfig": {
      "nameServers": [ "string" ],
      "options": "string",
      "searchDomains": "string"
    },
    "imageRegistryCredentials": [
      {
        "password": "string",
        "server": "string",
        "username": "string"
      }
    ],
    "ipAddress": {
      "dnsNameLabel": "string",
      "ip": "string",
      "ports": [
        {
          "port": "int",
          "protocol": "string"
        }
      ],
      "type": "string"
    },
    "networkProfile": {
      "id": "string"
    },
    "osType": "string",
    "restartPolicy": "string",
    "volumes": [
      {
        "azureFile": {
          "readOnly": "bool",
          "shareName": "string",
          "storageAccountKey": "string",
          "storageAccountName": "string"
        },
        "emptyDir": {},
        "gitRepo": {
          "directory": "string",
          "repository": "string",
          "revision": "string"
        },
        "name": "string",
        "secret": {
          "{customized property}": "string"
        }
      }
    ]
  },
  "tags": {
    "{customized property}": "string"
  }
}
Property Values
Microsoft.ContainerInstance/containerGroups
| Name | 
Description | 
Value | 
| apiVersion | 
The api version | 
'2018-10-01' | 
| identity | 
The identity of the container group, if configured. | 
ContainerGroupIdentity | 
| ___location | 
The resource ___location. | 
string | 
| name | 
The resource name | 
string (required) | 
| properties | 
 | 
ContainerGroupProperties (required) | 
| tags | 
Resource tags | 
Dictionary of tag names and values. See Tags in templates | 
| type | 
The resource type | 
'Microsoft.ContainerInstance/containerGroups' | 
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) | 
Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties
Container
| Name | 
Description | 
Value | 
| name | 
The user-provided name of the container instance. | 
string (required) | 
| properties | 
The properties of the container instance. | 
ContainerProperties (required) | 
ContainerExec
| Name | 
Description | 
Value | 
| command | 
The commands to execute within the container. | 
string[] | 
ContainerGroupDiagnostics
| Name | 
Description | 
Value | 
| logAnalytics | 
Container group log analytics information. | 
LogAnalytics | 
ContainerGroupIdentity
| Name | 
Description | 
Value | 
| type | 
The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. | 
'None' 'SystemAssigned' 'SystemAssigned, UserAssigned' 'UserAssigned' | 
| userAssignedIdentities | 
The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. | 
ContainerGroupIdentityUserAssignedIdentities | 
ContainerGroupIdentityUserAssignedIdentities
ContainerGroupNetworkProfile
| Name | 
Description | 
Value | 
| id | 
The identifier for a network profile. | 
string (required) | 
ContainerGroupProperties
| Name | 
Description | 
Value | 
| containers | 
The containers within the container group. | 
Container[] (required) | 
| diagnostics | 
The diagnostic information for a container group. | 
ContainerGroupDiagnostics | 
| dnsConfig | 
The DNS config information for a container group. | 
DnsConfiguration | 
| imageRegistryCredentials | 
The image registry credentials by which the container group is created from. | 
ImageRegistryCredential[] | 
| ipAddress | 
The IP address type of the container group. | 
IpAddress | 
| networkProfile | 
The network profile information for a container group. | 
ContainerGroupNetworkProfile | 
| 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[] | 
ContainerHttpGet
| Name | 
Description | 
Value | 
| path | 
The path to probe. | 
string | 
| port | 
The port number to probe. | 
int (required) | 
| scheme | 
The scheme. | 
'http' 'https' | 
ContainerPort
| Name | 
Description | 
Value | 
| port | 
The port number exposed within the container group. | 
int (required) | 
| protocol | 
The protocol associated with the port. | 
'TCP' 'UDP' | 
ContainerProbe
| Name | 
Description | 
Value | 
| exec | 
The execution command to probe | 
ContainerExec | 
| failureThreshold | 
The failure threshold. | 
int | 
| httpGet | 
The Http Get settings to probe | 
ContainerHttpGet | 
| initialDelaySeconds | 
The initial delay seconds. | 
int | 
| periodSeconds | 
The period seconds. | 
int | 
| successThreshold | 
The success threshold. | 
int | 
| timeoutSeconds | 
The timeout seconds. | 
int | 
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) | 
| livenessProbe | 
The liveness probe. | 
ContainerProbe | 
| ports | 
The exposed ports on the container instance. | 
ContainerPort[] | 
| readinessProbe | 
The readiness probe. | 
ContainerProbe | 
| resources | 
The resource requirements of the container instance. | 
ResourceRequirements (required) | 
| volumeMounts | 
The volume mounts available to the container instance. | 
VolumeMount[] | 
DnsConfiguration
| Name | 
Description | 
Value | 
| nameServers | 
The DNS servers for the container group. | 
string[] (required) | 
| options | 
The DNS options for the container group. | 
string | 
| searchDomains | 
The DNS search domains for hostname lookup in the container group. | 
string | 
EnvironmentVariable
| Name | 
Description | 
Value | 
| name | 
The name of the environment variable. | 
string (required) | 
| secureValue | 
The value of the secure environment variable. | 
string | 
| value | 
The value of the environment variable. | 
string | 
GitRepoVolume
| Name | 
Description | 
Value | 
| directory | 
Target directory name. Must not contain or start with '..'.  If '.' is supplied, the volume directory will be the git repository.  Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. | 
string | 
| repository | 
Repository URL | 
string (required) | 
| revision | 
Commit hash for the specified revision. | 
string | 
GpuResource
| Name | 
Description | 
Value | 
| count | 
The count of the GPU resource. | 
int (required) | 
| sku | 
The SKU of the GPU resource. | 
'K80' 'P100' 'V100' (required) | 
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 | 
| dnsNameLabel | 
The Dns name label for the IP. | 
string | 
| 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 or private VNET. | 
'Private' 'Public' (required) | 
LogAnalytics
| Name | 
Description | 
Value | 
| logType | 
The log type to be used. | 
'ContainerInsights' 'ContainerInstanceLogs' | 
| metadata | 
Metadata for log analytics. | 
LogAnalyticsMetadata | 
| workspaceId | 
The workspace id for log analytics | 
string (required) | 
| workspaceKey | 
The workspace key for log analytics | 
string (required) | 
Port
| Name | 
Description | 
Value | 
| port | 
The port number. | 
int (required) | 
| protocol | 
The protocol associated with the port. | 
'TCP' 'UDP' | 
ResourceLimits
| Name | 
Description | 
Value | 
| cpu | 
The CPU limit of this container instance. | 
int | 
| gpu | 
The GPU limit of this container instance. | 
GpuResource | 
| memoryInGB | 
The memory limit in GB of this container instance. | 
int | 
ResourceRequests
| Name | 
Description | 
Value | 
| cpu | 
The CPU request of this container instance. | 
int (required) | 
| gpu | 
The GPU request of this container instance. | 
GpuResource | 
| memoryInGB | 
The memory request in GB of this container instance. | 
int (required) | 
ResourceRequirements
| Name | 
Description | 
Value | 
| limits | 
The resource limits of this container instance. | 
ResourceLimits | 
| requests | 
The resource requests of this container instance. | 
ResourceRequests (required) | 
SecretVolume
Volume
| Name | 
Description | 
Value | 
| azureFile | 
The Azure File volume. | 
AzureFileVolume | 
| emptyDir | 
The empty directory volume. | 
any | 
| gitRepo | 
The git repo volume. | 
GitRepoVolume | 
| name | 
The name of the volume. | 
string (required) | 
| secret | 
The secret volume. | 
SecretVolume | 
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 | 
Usage Examples
Azure Quickstart Templates
The following Azure Quickstart templates deploy this resource type.
 
The containerGroups resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
To create a Microsoft.ContainerInstance/containerGroups resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
  type = "Microsoft.ContainerInstance/containerGroups@2018-10-01"
  name = "string"
  parent_id = "string"
  identity {
    type = "string"
    identity_ids = [
      "string"
    ]
  }
  ___location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      containers = [
        {
          name = "string"
          properties = {
            command = [
              "string"
            ]
            environmentVariables = [
              {
                name = "string"
                secureValue = "string"
                value = "string"
              }
            ]
            image = "string"
            livenessProbe = {
              exec = {
                command = [
                  "string"
                ]
              }
              failureThreshold = int
              httpGet = {
                path = "string"
                port = int
                scheme = "string"
              }
              initialDelaySeconds = int
              periodSeconds = int
              successThreshold = int
              timeoutSeconds = int
            }
            ports = [
              {
                port = int
                protocol = "string"
              }
            ]
            readinessProbe = {
              exec = {
                command = [
                  "string"
                ]
              }
              failureThreshold = int
              httpGet = {
                path = "string"
                port = int
                scheme = "string"
              }
              initialDelaySeconds = int
              periodSeconds = int
              successThreshold = int
              timeoutSeconds = int
            }
            resources = {
              limits = {
                cpu = int
                gpu = {
                  count = int
                  sku = "string"
                }
                memoryInGB = int
              }
              requests = {
                cpu = int
                gpu = {
                  count = int
                  sku = "string"
                }
                memoryInGB = int
              }
            }
            volumeMounts = [
              {
                mountPath = "string"
                name = "string"
                readOnly = bool
              }
            ]
          }
        }
      ]
      diagnostics = {
        logAnalytics = {
          logType = "string"
          metadata = {
            {customized property} = "string"
          }
          workspaceId = "string"
          workspaceKey = "string"
        }
      }
      dnsConfig = {
        nameServers = [
          "string"
        ]
        options = "string"
        searchDomains = "string"
      }
      imageRegistryCredentials = [
        {
          password = "string"
          server = "string"
          username = "string"
        }
      ]
      ipAddress = {
        dnsNameLabel = "string"
        ip = "string"
        ports = [
          {
            port = int
            protocol = "string"
          }
        ]
        type = "string"
      }
      networkProfile = {
        id = "string"
      }
      osType = "string"
      restartPolicy = "string"
      volumes = [
        {
          azureFile = {
            readOnly = bool
            shareName = "string"
            storageAccountKey = "string"
            storageAccountName = "string"
          }
          emptyDir = ?
          gitRepo = {
            directory = "string"
            repository = "string"
            revision = "string"
          }
          name = "string"
          secret = {
            {customized property} = "string"
          }
        }
      ]
    }
  }
}
Property Values
Microsoft.ContainerInstance/containerGroups
| Name | 
Description | 
Value | 
| identity | 
The identity of the container group, if configured. | 
ContainerGroupIdentity | 
| ___location | 
The resource ___location. | 
string | 
| name | 
The resource name | 
string (required) | 
| parent_id | 
The ID of the resource to apply this extension resource to. | 
string (required) | 
| properties | 
 | 
ContainerGroupProperties (required) | 
| tags | 
Resource tags | 
Dictionary of tag names and values. | 
| type | 
The resource type | 
"Microsoft.ContainerInstance/containerGroups@2018-10-01" | 
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) | 
Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties
Container
| Name | 
Description | 
Value | 
| name | 
The user-provided name of the container instance. | 
string (required) | 
| properties | 
The properties of the container instance. | 
ContainerProperties (required) | 
ContainerExec
| Name | 
Description | 
Value | 
| command | 
The commands to execute within the container. | 
string[] | 
ContainerGroupDiagnostics
| Name | 
Description | 
Value | 
| logAnalytics | 
Container group log analytics information. | 
LogAnalytics | 
ContainerGroupIdentity
| Name | 
Description | 
Value | 
| type | 
The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. | 
'None' 'SystemAssigned' 'SystemAssigned, UserAssigned' 'UserAssigned' | 
| userAssignedIdentities | 
The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. | 
ContainerGroupIdentityUserAssignedIdentities | 
ContainerGroupIdentityUserAssignedIdentities
ContainerGroupNetworkProfile
| Name | 
Description | 
Value | 
| id | 
The identifier for a network profile. | 
string (required) | 
ContainerGroupProperties
| Name | 
Description | 
Value | 
| containers | 
The containers within the container group. | 
Container[] (required) | 
| diagnostics | 
The diagnostic information for a container group. | 
ContainerGroupDiagnostics | 
| dnsConfig | 
The DNS config information for a container group. | 
DnsConfiguration | 
| imageRegistryCredentials | 
The image registry credentials by which the container group is created from. | 
ImageRegistryCredential[] | 
| ipAddress | 
The IP address type of the container group. | 
IpAddress | 
| networkProfile | 
The network profile information for a container group. | 
ContainerGroupNetworkProfile | 
| 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[] | 
ContainerHttpGet
| Name | 
Description | 
Value | 
| path | 
The path to probe. | 
string | 
| port | 
The port number to probe. | 
int (required) | 
| scheme | 
The scheme. | 
'http' 'https' | 
ContainerPort
| Name | 
Description | 
Value | 
| port | 
The port number exposed within the container group. | 
int (required) | 
| protocol | 
The protocol associated with the port. | 
'TCP' 'UDP' | 
ContainerProbe
| Name | 
Description | 
Value | 
| exec | 
The execution command to probe | 
ContainerExec | 
| failureThreshold | 
The failure threshold. | 
int | 
| httpGet | 
The Http Get settings to probe | 
ContainerHttpGet | 
| initialDelaySeconds | 
The initial delay seconds. | 
int | 
| periodSeconds | 
The period seconds. | 
int | 
| successThreshold | 
The success threshold. | 
int | 
| timeoutSeconds | 
The timeout seconds. | 
int | 
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) | 
| livenessProbe | 
The liveness probe. | 
ContainerProbe | 
| ports | 
The exposed ports on the container instance. | 
ContainerPort[] | 
| readinessProbe | 
The readiness probe. | 
ContainerProbe | 
| resources | 
The resource requirements of the container instance. | 
ResourceRequirements (required) | 
| volumeMounts | 
The volume mounts available to the container instance. | 
VolumeMount[] | 
DnsConfiguration
| Name | 
Description | 
Value | 
| nameServers | 
The DNS servers for the container group. | 
string[] (required) | 
| options | 
The DNS options for the container group. | 
string | 
| searchDomains | 
The DNS search domains for hostname lookup in the container group. | 
string | 
EnvironmentVariable
| Name | 
Description | 
Value | 
| name | 
The name of the environment variable. | 
string (required) | 
| secureValue | 
The value of the secure environment variable. | 
string | 
| value | 
The value of the environment variable. | 
string | 
GitRepoVolume
| Name | 
Description | 
Value | 
| directory | 
Target directory name. Must not contain or start with '..'.  If '.' is supplied, the volume directory will be the git repository.  Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. | 
string | 
| repository | 
Repository URL | 
string (required) | 
| revision | 
Commit hash for the specified revision. | 
string | 
GpuResource
| Name | 
Description | 
Value | 
| count | 
The count of the GPU resource. | 
int (required) | 
| sku | 
The SKU of the GPU resource. | 
'K80' 'P100' 'V100' (required) | 
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 | 
| dnsNameLabel | 
The Dns name label for the IP. | 
string | 
| 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 or private VNET. | 
'Private' 'Public' (required) | 
LogAnalytics
| Name | 
Description | 
Value | 
| logType | 
The log type to be used. | 
'ContainerInsights' 'ContainerInstanceLogs' | 
| metadata | 
Metadata for log analytics. | 
LogAnalyticsMetadata | 
| workspaceId | 
The workspace id for log analytics | 
string (required) | 
| workspaceKey | 
The workspace key for log analytics | 
string (required) | 
Port
| Name | 
Description | 
Value | 
| port | 
The port number. | 
int (required) | 
| protocol | 
The protocol associated with the port. | 
'TCP' 'UDP' | 
ResourceLimits
| Name | 
Description | 
Value | 
| cpu | 
The CPU limit of this container instance. | 
int | 
| gpu | 
The GPU limit of this container instance. | 
GpuResource | 
| memoryInGB | 
The memory limit in GB of this container instance. | 
int | 
ResourceRequests
| Name | 
Description | 
Value | 
| cpu | 
The CPU request of this container instance. | 
int (required) | 
| gpu | 
The GPU request of this container instance. | 
GpuResource | 
| memoryInGB | 
The memory request in GB of this container instance. | 
int (required) | 
ResourceRequirements
| Name | 
Description | 
Value | 
| limits | 
The resource limits of this container instance. | 
ResourceLimits | 
| requests | 
The resource requests of this container instance. | 
ResourceRequests (required) | 
SecretVolume
Volume
| Name | 
Description | 
Value | 
| azureFile | 
The Azure File volume. | 
AzureFileVolume | 
| emptyDir | 
The empty directory volume. | 
any | 
| gitRepo | 
The git repo volume. | 
GitRepoVolume | 
| name | 
The name of the volume. | 
string (required) | 
| secret | 
The secret volume. | 
SecretVolume | 
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 | 
Usage Examples
A basic example of deploying Azure Container Group instance.
terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}
provider "azapi" {
  skip_provider_registration = false
}
variable "resource_name" {
  type    = string
  default = "acctest0001"
}
variable "___location" {
  type    = string
  default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  ___location = var.___location
}
resource "azapi_resource" "containerGroup" {
  type      = "Microsoft.ContainerInstance/containerGroups@2023-05-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  ___location  = var.___location
  body = {
    properties = {
      containers = [
        {
          name = "hw"
          properties = {
            command = [
            ]
            environmentVariables = [
            ]
            image = "ubuntu:20.04"
            ports = [
              {
                port     = 80
                protocol = "TCP"
              },
            ]
            resources = {
              requests = {
                cpu        = 0.5
                memoryInGB = 0.5
              }
            }
          }
        },
      ]
      initContainers = [
      ]
      ipAddress = {
        autoGeneratedDomainNameLabelScope = "Unsecure"
        ports = [
          {
            port     = 80
            protocol = "TCP"
          },
        ]
        type = "Public"
      }
      osType        = "Linux"
      restartPolicy = "Always"
      volumes = [
      ]
    }
    tags = {
      environment = "Testing"
    }
    zones = [
    ]
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}
Azure Verified Modules
The following Azure Verified Modules can be used to deploy this resource type.