---
title: "Get a list of container groups in the specified subscription."
method: GET
path: "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups"
---

# Get a list of container groups in the specified subscription.

`GET /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups`

Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.

## Path parameters

- `subscriptionId` string, required

## Query parameters

- `api-version` string, required

## Response `200`

OK

- ContainerGroupListResult — The container group list response that contains the container group properties.
  - `value` ContainerGroup[] — The list of container groups.
    - `id` string — The resource id.
    - `name` string — The resource name.
    - `type` string — The resource type.
    - `location` string — The resource location.
    - `tags` object — The resource tags.
    - `properties` object, required
      - `provisioningState` string — The provisioning state of the container group. This only appears in the response.
      - `containers` Container[], required — The containers within the container group.
        - `name` string, required — The user-provided name of the container instance.
        - `properties` ContainerProperties, required — The container instance properties.
          - `image` string, required — The name of the image used to create the container instance.
          - `command` string[] — The commands to execute within the container instance in exec form.
          - `ports` ContainerPort[] — The exposed ports on the container instance.
            - `protocol` 'TCP' | 'UDP' — The protocol associated with the port.
            - `port` integer, required — The port number exposed within the container group.
          - `environmentVariables` EnvironmentVariable[] — The environment variables to set in the container instance.
            - `name` string, required — The name of the environment variable.
            - `value` string, required — The value of the environment variable.
          - `instanceView` object — The instance view of the container instance. Only valid in response.
            - `restartCount` integer — The number of times that the container instance has been restarted.
            - `currentState` ContainerState — The container instance state.
              - …
            - `previousState` ContainerState — The container instance state.
              - …
            - `events` Event[] — The events of the container instance.
              - …
          - `resources` ResourceRequirements, required — The resource requirements.
            - `requests` ResourceRequests, required — The resource requests.
              - …
            - `limits` ResourceLimits — The resource limits.
              - …
          - `volumeMounts` VolumeMount[] — The volume mounts available to the container instance.
            - `name` string, required — The name of the volume mount.
            - `mountPath` string, required — The path within the container where the volume should be mounted. Must not contain colon (:).
            - `readOnly` boolean — The flag indicating whether the volume mount is read-only.
      - `imageRegistryCredentials` ImageRegistryCredential[] — The image registry credentials by which the container group is created from.
        - `server` string, required — The Docker image registry server without a protocol such as "http" and "https".
        - `username` string, required — The username for the private registry.
        - `password` string — The password for the private registry.
      - `restartPolicy` 'Always' | 'OnFailure' | 'Never' — Restart policy for all containers within the container group. - `Always` Always restart - `OnFailure` Restart on failure - `Never` Never restart
      - `ipAddress` IpAddress — IP address for the container group.
        - `ports` Port[], required — The list of ports exposed on the container group.
          - `protocol` 'TCP' | 'UDP' — The protocol associated with the port.
          - `port` integer, required — The port number.
        - `type` 'Public', required — Specifies if the IP is exposed to the public internet.
        - `ip` string — The IP exposed to the public internet.
        - `dnsNameLabel` string — The Dns name label for the IP.
        - `fqdn` string — The FQDN for the IP.
      - `osType` 'Windows' | 'Linux', required — The operating system type required by the containers in the container group.
      - `volumes` Volume[] — The list of volumes that can be mounted by containers in this container group.
        - `name` string, required — The name of the volume.
        - `azureFile` AzureFileVolume — The properties of the Azure File volume. Azure File shares are mounted as volumes.
          - `shareName` string, required — The name of the Azure File share to be mounted as a volume.
          - `readOnly` boolean — The flag indicating whether the Azure File shared mounted as a volume is read-only.
          - `storageAccountName` string, required — The name of the storage account that contains the Azure File share.
          - `storageAccountKey` string — The storage account access key used to access the Azure File share.
        - `emptyDir` EmptyDirVolume — The empty directory volume.
        - `secret` SecretVolume — The secret volume.
        - `gitRepo` GitRepoVolume — Represents a volume that is populated with the contents of a git repository
          - `directory` string — 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.
          - `repository` string, required — Repository URL
          - `revision` string — Commit hash for the specified revision.
      - `instanceView` object — The instance view of the container group. Only valid in response.
        - `events` Event[] — The events of this container group.
          - `count` integer — The count of the event.
          - `firstTimestamp` string, date-time — The date-time of the earliest logged event.
          - `lastTimestamp` string, date-time — The date-time of the latest logged event.
          - `name` string — The event name.
          - `message` string — The event message.
          - `type` string — The event type.
        - `state` string — The state of the container group. Only valid in response.
  - `nextLink` string — The URI to fetch the next page of container groups.

---

[API](https://skmtc.dev/azure/apis/containerinstance-microsoft-containerinstance-containerinsta.md) · [All operations](https://skmtc.dev/azure/apis/containerinstance-microsoft-containerinstance-containerinsta/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/azure/containerinstance-microsoft-containerinstance-containerinsta/revisions/b5d42c2aa627/schema)
