Microsoft.ContainerInstance containerGroups 2022-09-01

Bicep 資源定義

containerGroups 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄

資源格式

若要建立 Microsoft.ContainerInstance/containerGroups 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.ContainerInstance/containerGroups@2022-09-01' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  identity: {
    type: 'string'
    userAssignedIdentities: {}
  }
  properties: {
    containers: [
      {
        name: 'string'
        properties: {
          command: [
            'string'
          ]
          environmentVariables: [
            {
              name: 'string'
              secureValue: 'string'
              value: 'string'
            }
          ]
          image: 'string'
          livenessProbe: {
            exec: {
              command: [
                'string'
              ]
            }
            failureThreshold: int
            httpGet: {
              httpHeaders: [
                {
                  name: 'string'
                  value: 'string'
                }
              ]
              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: {
              httpHeaders: [
                {
                  name: 'string'
                  value: 'string'
                }
              ]
              path: 'string'
              port: int
              scheme: 'string'
            }
            initialDelaySeconds: int
            periodSeconds: int
            successThreshold: int
            timeoutSeconds: int
          }
          resources: {
            limits: {
              cpu: int
              gpu: {
                count: int
                sku: 'string'
              }
              memoryInGB: json('decimal-as-string')
            }
            requests: {
              cpu: int
              gpu: {
                count: int
                sku: 'string'
              }
              memoryInGB: json('decimal-as-string')
            }
          }
          volumeMounts: [
            {
              mountPath: 'string'
              name: 'string'
              readOnly: bool
            }
          ]
        }
      }
    ]
    diagnostics: {
      logAnalytics: {
        logType: 'string'
        metadata: {}
        workspaceId: 'string'
        workspaceKey: 'string'
        workspaceResourceId: 'string'
      }
    }
    dnsConfig: {
      nameServers: [
        'string'
      ]
      options: 'string'
      searchDomains: 'string'
    }
    encryptionProperties: {
      identity: 'string'
      keyName: 'string'
      keyVersion: 'string'
      vaultBaseUrl: 'string'
    }
    extensions: [
      {
        name: 'string'
        properties: {
          extensionType: 'string'
          protectedSettings: any()
          settings: any()
          version: 'string'
        }
      }
    ]
    imageRegistryCredentials: [
      {
        identity: 'string'
        identityUrl: 'string'
        password: 'string'
        server: 'string'
        username: 'string'
      }
    ]
    initContainers: [
      {
        name: 'string'
        properties: {
          command: [
            'string'
          ]
          environmentVariables: [
            {
              name: 'string'
              secureValue: 'string'
              value: 'string'
            }
          ]
          image: 'string'
          volumeMounts: [
            {
              mountPath: 'string'
              name: 'string'
              readOnly: bool
            }
          ]
        }
      }
    ]
    ipAddress: {
      autoGeneratedDomainNameLabelScope: 'string'
      dnsNameLabel: 'string'
      ip: 'string'
      ports: [
        {
          port: int
          protocol: 'string'
        }
      ]
      type: 'string'
    }
    osType: 'string'
    restartPolicy: 'string'
    sku: 'string'
    subnetIds: [
      {
        id: 'string'
        name: 'string'
      }
    ]
    volumes: [
      {
        azureFile: {
          readOnly: bool
          shareName: 'string'
          storageAccountKey: 'string'
          storageAccountName: 'string'
        }
        emptyDir: any()
        gitRepo: {
          directory: 'string'
          repository: 'string'
          revision: 'string'
        }
        name: 'string'
        secret: {}
      }
    ]
  }
  zones: [
    'string'
  ]
}

屬性值

containerGroups

名稱 描述
NAME 資源名稱 字串 (必要)

字元限制:1-63

合法字元:
小寫字母、數字和連字號。

不能以連字號開頭或結尾。 不允許連續的連字號。
location 資源位置。 字串
tags 資源標籤。 標記名稱和值的字典。 請參閱 範本中的標記
身分識別 容器群組的身分識別 (如果已設定)。 ContainerGroupIdentity
properties 容器群組屬性 ContainerGroupPropertiesProperties (必要)
zones (區域) 容器群組的區域。 string[]

ContainerGroupIdentity

名稱 描述
類型 容器群組使用的身分識別類型。 「SystemAssigned、UserAssigned」類型同時包含隱含建立的身分識別,和一組使用者指派的身分識別。 「None」類型會從容器群組移除任何身分識別。 'None'
'SystemAssigned'
'SystemAssigned,UserAssigned'
'UserAssigned'
userAssignedIdentities 容器群組相關的使用者身分識別清單。 物件 (object)

ContainerGroupPropertiesProperties

名稱 描述
containers 容器群組中的容器。 Container[] (必要)
診斷 容器群組的診斷資訊。 ContainerGroupDiagnostics
dnsConfig 容器群組的 DNS 設定資訊。 DnsConfiguration
encryptionProperties 容器群組的加密屬性。 EncryptionProperties
擴充功能 虛擬 kubelet 所使用的擴充功能 DeploymentExtensionSpec[]
imageRegistryCredentials 建立容器群組的來源映像登錄認證。 ImageRegistryCredential[]
initContainers 容器群組的 Init 容器。 InitContainerDefinition[]
ipAddress 容器群組的 IP 位址類型。 IpAddress
osType 容器群組中容器所需的作業系統類型。 'Linux'
需要 『Windows』 ()
restartPolicy 容器群組中所有容器的重新啟動原則。
- Always 一律重新啟動
- OnFailure 失敗時重新啟動
- Never 永不重新啟動
'Always'
'Never'
'OnFailure'
sku 容器群組的 SKU。 'Dedicated'
'Standard'
subnetIds 容器群組的子網資源標識碼。 ContainerGroupSubnetId[]
磁碟區 此容器群組中容器可裝載的磁碟區清單。 Volume[]

容器

名稱 描述
NAME 容器執行個體的使用者提供名稱。 需要字串 ()
properties 容器執行個體的屬性。 ContainerProperties (必要)

ContainerProperties

名稱 描述
命令 容器執行個體中以 exec 格式執行的命令。 string[]
environmentVariables 容器執行個體中設定的環境變數。 EnvironmentVariable[]
image 建立容器執行個體使用的映像名稱。 需要字串 ()
livenessProbe 活躍度探查。 ContainerProbe
連接埠 容器執行個體上公開的連接埠。 ContainerPort[]
readinessProbe 整備度探查。 ContainerProbe
resources 容器執行個體的資源需求。 ResourceRequirements (必要)
volumeMounts 容器執行個體可用的磁碟區裝載。 VolumeMount[]

EnvironmentVariable

名稱 描述
NAME 環境變數的名稱。 需要字串 ()
secureValue 安全環境變數的值。 字串
value 環境變數的值。 字串

ContainerProbe

名稱 描述
exec 要探查的執行命令 ContainerExec
failureThreshold 失敗閾值。 int
httpGet 要探查的 Http 取得設定 ContainerHttpGet
initialDelaySeconds 初始延遲秒數。 int
periodSeconds 期間長度秒數。 int
successThreshold 成功閾值。 int
timeoutSeconds 逾時秒數。 int

ContainerExec

名稱 描述
命令 容器中執行的命令。 string[]

ContainerHttpGet

名稱 描述
httpHeaders HTTP 標頭。 HttpHeader[]
path 探查的路徑。 string
連接埠 探查的連接埠號碼。 int (必要)
scheme 配置。 'http'
'https'

HttpHeader

名稱 描述
NAME 標頭名稱。 字串
value 標頭值。 字串

ContainerPort

名稱 描述
連接埠 容器群組中公開的連接埠號碼。 int (必要)
protocol 連接埠相關的通訊協定。 'TCP'
'UDP'

ResourceRequirements

名稱 描述
限制 此容器執行個體的資源限制。 ResourceLimits
requests 此容器執行個體的資源要求。 ResourceRequests (必要)

ResourceLimits

名稱 描述
cpu 此容器執行個體的 CPU 限制。 int
gpu 此容器執行個體的 GPU 限制。 GpuResource
memoryInGB 此容器執行個體的記憶體限制 GB。 若要指定十進位值,請使用 json () 函式。 int 或 json decimal

GpuResource

名稱 描述
count GPU 資源的計數。 int (必要)
sku GPU 資源的 SKU。 'K80'
'P100'
'V100' (必要)

ResourceRequests

名稱 描述
cpu 此容器執行個體的 CPU 要求。 int (必要)
gpu 此容器執行個體的 GPU 要求。 GpuResource
memoryInGB 此容器執行個體的記憶體要求 GB。 若要指定十進位值,請使用 json () 函式。 int 或 json 十進位 (必要)

VolumeMount

名稱 描述
mountPath 容器中磁碟區的裝載路徑。 不得包含冒號 (:)。 需要字串 ()
NAME 磁碟區裝載的名稱。 需要字串 ()
readOnly 此旗標指出磁碟區裝載是否為唯讀。 bool

ContainerGroupDiagnostics

名稱 描述
logAnalytics 容器群組記錄分析資訊。 LogAnalytics

LogAnalytics

名稱 描述
logType 要使用的記錄類型。 'ContainerInsights'
'ContainerInstanceLogs'
中繼資料 記錄分析的中繼資料。 物件 (object)
workspaceId 記錄分析的工作區標識碼 需要字串 ()
workspaceKey 記錄分析的工作區金鑰 需要字串 ()
workspaceResourceId 記錄分析的工作區資源標識碼 字串

DnsConfiguration

名稱 描述
nameServers 容器群組的 DNS 伺服器。 string[] (必要)
選項 容器群組的 DNS 選項。 字串
searchDomains 容器群組中適用於主機名稱查詢的 DNS 搜尋網域。 字串

EncryptionProperties

名稱 描述
身分識別 keyvault 受控識別。 字串
keyName 加密金鑰名稱。 需要字串 ()
keyVersion 加密金鑰版本。 需要字串 ()
vaultBaseUrl Keyvault 基底 URL。 需要字串 ()

DeploymentExtensionSpec

名稱 描述
NAME 延伸模組的名稱。 需要字串 ()
properties 擴充功能特定屬性 DeploymentExtensionSpecProperties

DeploymentExtensionSpecProperties

名稱 描述
extensionType 要新增的擴充功能類型。 需要字串 ()
protectedSettings 延伸模組的受保護設定。 針對 Bicep,您可以使用 any () 函式。
設定 延伸模組的設定。 針對 Bicep,您可以使用 any () 函式。
version 所使用的擴充功能版本。 需要字串 ()

ImageRegistryCredential

名稱 描述
身分識別 私人登錄的身分識別。 字串
identityUrl 私人登錄的身分識別 URL。 字串
password 私人登錄的密碼。 字串
伺服器 Docker 映像登錄伺服器不具通訊協定 (例如「http」和「https」)。 需要字串 ()
使用者名稱 私人登錄的使用者名稱。 字串

InitContainerDefinition

名稱 描述
NAME Init 容器的名稱。 需要字串 ()
properties Init 容器的屬性。 需要 initContainerPropertiesDefinition ()

InitContainerPropertiesDefinition

名稱 描述
命令 Init 容器中以 exec 格式執行的命令。 string[]
environmentVariables Init 容器中設定的環境變數。 EnvironmentVariable[]
image Init 容器的映像。 字串
volumeMounts Init 容器可用的磁碟區裝載。 VolumeMount[]

IpAddress

名稱 描述
autoGeneratedDomainNameLabelScope 表示安全性列舉的值。 如果未選取 ,則 「不安全」值是預設值,表示物件的域名標籤不會受到子域接管的保護。 如果選取 'TenantReuse' 值,則為預設值,表示物件域名標籤可以在相同的租用戶內重複使用。 'SubscriptionReuse' 值表示物件域名標籤可以在相同的訂用帳戶內重複使用。 'ResourceGroupReuse' 值表示物件域名標籤可以在相同的資源群組內重複使用。 'NoReuse' 值表示無法在相同的資源群組、訂用帳戶或租用戶中重複使用物件的域名標籤。 'Noreuse'
'ResourceGroupReuse'
'SubscriptionReuse'
'TenantReuse'
'Unsecure'
dnsNameLabel IP 的 DNS 名稱標籤。 字串
ip 公開至公用網際網路的 IP。 字串
連接埠 容器群組上公開的連接埠清單。 Port[] (必要)
類型 如果 IP 公開至公用網際網路或私人 VNET 時指定。 'Private'
必要) 'Public' (

連接埠

名稱 描述
連接埠 連接埠號碼。 需要 int ()
protocol 連接埠相關的通訊協定。 'TCP'
'UDP'

ContainerGroupSubnetId

名稱 描述
id 虛擬網路和子網的資源標識碼。 需要字串 ()
NAME 子網的易記名稱。 字串

磁碟區

名稱 描述
azureFile Azure 檔案磁碟區。 AzureFileVolume
emptyDir 空白的目錄磁碟區。 針對 Bicep,您可以使用 any () 函式。
gitRepo Git 存放庫磁碟區。 GitRepoVolume
NAME 磁碟區的名稱。 字串 (必要)
secret 祕密磁碟區。 物件 (object)

AzureFileVolume

名稱 描述
readOnly 此旗標指出作為磁碟區裝載的 Azure 檔案共用是否為唯讀。 bool
shareName 作為磁碟區裝載的 Azure 檔案共用名稱。 字串 (必要)
storageAccountKey 存取 Azure 檔案共用使用的儲存體帳戶存取金鑰。 字串
storageAccountName 包含 Azure 檔案共用的儲存體帳戶名稱。 字串 (必要)

GitRepoVolume

名稱 描述
directory 目標目錄名稱。 不能包含「..」或以「..」為開頭。 如果提供「.」,磁片區目錄即為 git 存放庫。 此外,若有指定,磁片區會包含在指定名稱子目錄中的 git 存放庫。 字串
repository 存放庫 URL 字串 (必要)
revision 認可指定修訂的雜湊。 字串

快速入門範本

下列快速入門範本會部署此資源類型。

範本 描述
AKS 上 SQL Server 可用性群組

部署至 Azure
這會建立新的 AKS 叢集,然後使用使用 Duffle 和 ACI 部署的 CNAB 套件,將 SQL Server 可用性群組部署到其中
建立 WordPress 網站

部署至 Azure
此範本會在容器實例上建立 WordPress 網站
在虛擬網路中建立 WordPress 網站

部署至 Azure
此範本會在虛擬網路中的容器實例上建立 WordPress 網站。 並輸出可存取 WordPress 網站的公用網站 FQDN。
Azure 容器執行個體 - BC 搭配 SQL Server 和 IIS

部署至 Azure
在 Azure 容器執行個體 上部署具有功能完整的獨立式 Microsoft Dynamics 365 Business Central 環境的單一 Windows 容器。
具有 容器執行個體 和 應用程式閘道 的 Front Door

部署至 Azure
此範本會建立具有容器群組和 應用程式閘道 的 Front Door Standard/Premium。
具有 Azure 容器執行個體 的 Front Door Standard/Premium

部署至 Azure
此範本會建立具有容器群組的 Front Door Standard/Premium。
Azure 容器執行個體 - 具有健康情況探查的容器

部署至 Azure
使用 Azure 容器執行個體 部署具有健康情況探查的Linux容器。
Azure 容器執行個體 - 具有公用IP的Linux容器

部署至 Azure
使用 Azure 容器執行個體,透過公用IP部署可存取的單一Linux容器。
Azure 容器執行個體 - 具有安全 envVar 的容器

部署至 Azure
使用 Azure 容器執行個體 部署具有安全環境變數的Linux容器。
Azure 容器執行個體 - 具有 emptyDir 的 Linux 容器

部署至 Azure
部署兩個使用 Azure 容器執行個體 共用 emptyDir 磁碟區的 Linux 容器。
Azure 容器執行個體 - 具有 gitRepo 的 Linux 容器

部署至 Azure
使用 Azure 容器執行個體 部署使用 gitRepo 磁碟區的 Linux 容器。
Azure 容器執行個體 - 具有秘密的容器

部署至 Azure
使用 Azure 容器執行個體 部署具有秘密磁碟區的Linux容器。
建立具有永續性記憶體的隨選 SFTP 伺服器

部署至 Azure
此範本示範使用 Azure 容器實例 (ACI) 的隨選 SFTP 伺服器。
使用現有記憶體帳戶的隨選 SFTP 伺服器

部署至 Azure
此範本示範使用 Azure 容器實例 (ACI) 的隨選 SFTP 伺服器。
透過容器建立記憶體帳戶檔案共用

部署至 Azure
此範本會透過容器實例中的 azure-cli 建立記憶體帳戶和檔案共用
ACI 中的 UDP 容器

部署至 Azure
此範本會建立 ACI 資源,並透過 UDP 公開容器
Azure 容器執行個體 - VNet

部署至 Azure
將容器實例部署至 Azure 虛擬網路。
使用憑證建立 應用程式閘道

部署至 Azure
此範本示範如何產生 金鑰保存庫 自我簽署憑證,然後從 應用程式閘道 參考。

ARM 範本資源定義

containerGroups 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄

資源格式

若要建立 Microsoft.ContainerInstance/containerGroups 資源,請將下列 JSON 新增至您的範本。

{
  "type": "Microsoft.ContainerInstance/containerGroups",
  "apiVersion": "2022-09-01",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "identity": {
    "type": "string",
    "userAssignedIdentities": {}
  },
  "properties": {
    "containers": [
      {
        "name": "string",
        "properties": {
          "command": [ "string" ],
          "environmentVariables": [
            {
              "name": "string",
              "secureValue": "string",
              "value": "string"
            }
          ],
          "image": "string",
          "livenessProbe": {
            "exec": {
              "command": [ "string" ]
            },
            "failureThreshold": "int",
            "httpGet": {
              "httpHeaders": [
                {
                  "name": "string",
                  "value": "string"
                }
              ],
              "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": {
              "httpHeaders": [
                {
                  "name": "string",
                  "value": "string"
                }
              ],
              "path": "string",
              "port": "int",
              "scheme": "string"
            },
            "initialDelaySeconds": "int",
            "periodSeconds": "int",
            "successThreshold": "int",
            "timeoutSeconds": "int"
          },
          "resources": {
            "limits": {
              "cpu": "int",
              "gpu": {
                "count": "int",
                "sku": "string"
              },
              "memoryInGB": "[json('decimal-as-string')]"
            },
            "requests": {
              "cpu": "int",
              "gpu": {
                "count": "int",
                "sku": "string"
              },
              "memoryInGB": "[json('decimal-as-string')]"
            }
          },
          "volumeMounts": [
            {
              "mountPath": "string",
              "name": "string",
              "readOnly": "bool"
            }
          ]
        }
      }
    ],
    "diagnostics": {
      "logAnalytics": {
        "logType": "string",
        "metadata": {},
        "workspaceId": "string",
        "workspaceKey": "string",
        "workspaceResourceId": "string"
      }
    },
    "dnsConfig": {
      "nameServers": [ "string" ],
      "options": "string",
      "searchDomains": "string"
    },
    "encryptionProperties": {
      "identity": "string",
      "keyName": "string",
      "keyVersion": "string",
      "vaultBaseUrl": "string"
    },
    "extensions": [
      {
        "name": "string",
        "properties": {
          "extensionType": "string",
          "protectedSettings": {},
          "settings": {},
          "version": "string"
        }
      }
    ],
    "imageRegistryCredentials": [
      {
        "identity": "string",
        "identityUrl": "string",
        "password": "string",
        "server": "string",
        "username": "string"
      }
    ],
    "initContainers": [
      {
        "name": "string",
        "properties": {
          "command": [ "string" ],
          "environmentVariables": [
            {
              "name": "string",
              "secureValue": "string",
              "value": "string"
            }
          ],
          "image": "string",
          "volumeMounts": [
            {
              "mountPath": "string",
              "name": "string",
              "readOnly": "bool"
            }
          ]
        }
      }
    ],
    "ipAddress": {
      "autoGeneratedDomainNameLabelScope": "string",
      "dnsNameLabel": "string",
      "ip": "string",
      "ports": [
        {
          "port": "int",
          "protocol": "string"
        }
      ],
      "type": "string"
    },
    "osType": "string",
    "restartPolicy": "string",
    "sku": "string",
    "subnetIds": [
      {
        "id": "string",
        "name": "string"
      }
    ],
    "volumes": [
      {
        "azureFile": {
          "readOnly": "bool",
          "shareName": "string",
          "storageAccountKey": "string",
          "storageAccountName": "string"
        },
        "emptyDir": {},
        "gitRepo": {
          "directory": "string",
          "repository": "string",
          "revision": "string"
        },
        "name": "string",
        "secret": {}
      }
    ]
  },
  "zones": [ "string" ]
}

屬性值

containerGroups

名稱 描述
類型 資源類型 'Microsoft.ContainerInstance/containerGroups'
apiVersion 資源 API 版本 '2022-09-01'
NAME 資源名稱 需要字串 ()

字元限制:1-63

合法字元:
小寫字母、數字和連字號。

不能以連字號開頭或結尾。 不允許連續的連字號。
location 資源位置。 字串
tags 資源標籤。 標記名稱和值的字典。 請參閱 範本中的標籤
身分識別 容器群組的身分識別 (如果已設定)。 ContainerGroupIdentity
properties 容器群組屬性 ContainerGroupPropertiesProperties 必要 ()
zones (區域) 容器群組的區域。 string[]

ContainerGroupIdentity

名稱 描述
類型 容器群組使用的身分識別類型。 「SystemAssigned、UserAssigned」類型同時包含隱含建立的身分識別,和一組使用者指派的身分識別。 「None」類型會從容器群組移除任何身分識別。 'None'
'SystemAssigned'
'SystemAssigned, UserAssigned'
'UserAssigned'
userAssignedIdentities 容器群組相關的使用者身分識別清單。 物件 (object)

ContainerGroupPropertiesProperties

名稱 描述
containers 容器群組中的容器。 Container[] 必要) (
診斷 容器群組的診斷資訊。 ContainerGroupDiagnostics
dnsConfig 容器群組的 DNS 設定資訊。 DnsConfiguration
encryptionProperties 容器群組的加密屬性。 EncryptionProperties
擴充功能 virtual kubelet 所使用的擴充功能 DeploymentExtensionSpec[]
imageRegistryCredentials 建立容器群組的來源映像登錄認證。 ImageRegistryCredential[]
initContainers 容器群組的 Init 容器。 InitContainerDefinition[]
ipAddress 容器群組的 IP 位址類型。 IpAddress
osType 容器群組中容器所需的作業系統類型。 'Linux'
需要 『Windows』 ()
restartPolicy 容器群組中所有容器的重新啟動原則。
- Always 一律重新啟動
- OnFailure 失敗時重新啟動
- Never 永不重新啟動
'Always'
'Never'
'OnFailure'
sku 容器群組的 SKU。 'Dedicated'
'Standard'
subnetIds 容器群組的子網資源標識碼。 ContainerGroupSubnetId[]
磁碟區 此容器群組中容器可裝載的磁碟區清單。 Volume[]

容器

名稱 描述
NAME 容器執行個體的使用者提供名稱。 需要字串 ()
properties 容器執行個體的屬性。 ContainerProperties (必要)

ContainerProperties

名稱 描述
命令 容器執行個體中以 exec 格式執行的命令。 string[]
environmentVariables 容器執行個體中設定的環境變數。 EnvironmentVariable[]
image 建立容器執行個體使用的映像名稱。 需要字串 ()
livenessProbe 活躍度探查。 ContainerProbe
連接埠 容器執行個體上公開的連接埠。 ContainerPort[]
readinessProbe 整備度探查。 ContainerProbe
resources 容器執行個體的資源需求。 ResourceRequirements (必要)
volumeMounts 容器執行個體可用的磁碟區裝載。 VolumeMount[]

EnvironmentVariable

名稱 描述
NAME 環境變數的名稱。 需要字串 ()
secureValue 安全環境變數的值。 字串
value 環境變數的值。 字串

ContainerProbe

名稱 描述
exec 要探查的執行命令 ContainerExec
failureThreshold 失敗閾值。 int
httpGet 要探查的 Http 取得設定 ContainerHttpGet
initialDelaySeconds 初始延遲秒數。 int
periodSeconds 期間長度秒數。 int
successThreshold 成功閾值。 int
timeoutSeconds 逾時秒數。 int

ContainerExec

名稱 描述
命令 容器中執行的命令。 string[]

ContainerHttpGet

名稱 描述
httpHeaders HTTP 標頭。 HttpHeader[]
path 探查的路徑。 string
連接埠 探查的連接埠號碼。 需要 int ()
scheme 配置。 'http'
'https'

HttpHeader

名稱 描述
NAME 標頭名稱。 字串
value 標頭值。 字串

ContainerPort

名稱 描述
連接埠 容器群組中公開的連接埠號碼。 int (必要)
protocol 連接埠相關的通訊協定。 'TCP'
'UDP'

ResourceRequirements

名稱 描述
限制 此容器執行個體的資源限制。 ResourceLimits
requests 此容器執行個體的資源要求。 ResourceRequests (必要)

ResourceLimits

名稱 描述
cpu 此容器執行個體的 CPU 限制。 int
gpu 此容器執行個體的 GPU 限制。 GpuResource
memoryInGB 此容器執行個體的記憶體限制 GB。 若要指定十進位值,請使用 json () 函式。 int 或 json decimal

GpuResource

名稱 描述
count GPU 資源的計數。 int (必要)
sku GPU 資源的 SKU。 'K80'
'P100'
'V100' (必要)

ResourceRequests

名稱 描述
cpu 此容器執行個體的 CPU 要求。 int (必要)
gpu 此容器執行個體的 GPU 要求。 GpuResource
memoryInGB 此容器執行個體的記憶體要求 GB。 若要指定十進位值,請使用 json () 函式。 int 或 json 十進位 (必要)

VolumeMount

名稱 描述
mountPath 容器中磁碟區的裝載路徑。 不得包含冒號 (:)。 字串 (必要)
NAME 磁碟區裝載的名稱。 字串 (必要)
readOnly 此旗標指出磁碟區裝載是否為唯讀。 bool

ContainerGroupDiagnostics

名稱 描述
logAnalytics 容器群組記錄分析資訊。 LogAnalytics

LogAnalytics

名稱 描述
logType 要使用的記錄類型。 'ContainerInsights'
'ContainerInstanceLogs'
中繼資料 記錄分析的中繼資料。 物件 (object)
workspaceId 記錄分析的工作區標識碼 需要字串 ()
workspaceKey 記錄分析的工作區金鑰 需要字串 ()
workspaceResourceId 記錄分析的工作區資源標識碼 字串

DnsConfiguration

名稱 描述
nameServers 容器群組的 DNS 伺服器。 string[] (必要)
選項 容器群組的 DNS 選項。 字串
searchDomains 容器群組中適用於主機名稱查詢的 DNS 搜尋網域。 字串

EncryptionProperties

名稱 描述
身分識別 keyvault 受控識別。 字串
keyName 加密金鑰名稱。 需要字串 ()
keyVersion 加密金鑰版本。 需要字串 ()
vaultBaseUrl Keyvault 基底 URL。 需要字串 ()

DeploymentExtensionSpec

名稱 描述
NAME 延伸模組的名稱。 需要字串 ()
properties 擴充功能特定屬性 DeploymentExtensionSpecProperties

DeploymentExtensionSpecProperties

名稱 描述
extensionType 要新增的擴充功能類型。 需要字串 ()
protectedSettings 延伸模組的受保護設定。
設定 延伸模組的設定。
version 所使用的擴充功能版本。 需要字串 ()

ImageRegistryCredential

名稱 描述
身分識別 私人登錄的身分識別。 字串
identityUrl 私人登錄的身分識別 URL。 字串
password 私人登錄的密碼。 字串
伺服器 Docker 映像登錄伺服器不具通訊協定 (例如「http」和「https」)。 需要字串 ()
使用者名稱 私人登錄的使用者名稱。 字串

InitContainerDefinition

名稱 描述
NAME Init 容器的名稱。 需要字串 ()
properties Init 容器的屬性。 需要 initContainerPropertiesDefinition ()

InitContainerPropertiesDefinition

名稱 描述
命令 Init 容器中以 exec 格式執行的命令。 string[]
environmentVariables Init 容器中設定的環境變數。 EnvironmentVariable[]
image Init 容器的映像。 字串
volumeMounts Init 容器可用的磁碟區裝載。 VolumeMount[]

IpAddress

名稱 描述
autoGeneratedDomainNameLabelScope 表示安全性列舉的值。 如果未選取 ,則 'Unsecure' 值是預設值,表示物件的域名卷標不會受到子域接管的保護。 如果選取 'TenantReuse' 值,則為預設值,表示物件域名標籤可以在相同的租用戶內重複使用。 'SubscriptionReuse' 值表示物件域名標籤可以在相同的訂用帳戶內重複使用。 'ResourceGroupReuse' 值表示物件域名標籤可以在相同的資源群組內重複使用。 'NoReuse' 值表示無法在相同的資源群組、訂用帳戶或租用戶內重複使用物件的域名標籤。 'Noreuse'
'ResourceGroupReuse'
'SubscriptionReuse'
'TenantReuse'
'Unsecure'
dnsNameLabel IP 的 DNS 名稱標籤。 字串
ip 公開至公用網際網路的 IP。 字串
連接埠 容器群組上公開的連接埠清單。 [] (必要)
類型 如果 IP 公開至公用網際網路或私人 VNET 時指定。 'Private'
必要) 'Public' (

連接埠

名稱 描述
連接埠 連接埠號碼。 int (必要)
protocol 連接埠相關的通訊協定。 'TCP'
'UDP'

ContainerGroupSubnetId

名稱 描述
id 虛擬網路和子網的資源標識碼。 字串 (必要)
NAME 子網的易記名稱。 字串

磁碟區

名稱 描述
azureFile Azure 檔案磁碟區。 AzureFileVolume
emptyDir 空白的目錄磁碟區。
gitRepo Git 存放庫磁碟區。 GitRepoVolume
NAME 磁碟區的名稱。 字串 (必要)
secret 祕密磁碟區。 物件 (object)

AzureFileVolume

名稱 描述
readOnly 此旗標指出作為磁碟區裝載的 Azure 檔案共用是否為唯讀。 bool
shareName 作為磁碟區裝載的 Azure 檔案共用名稱。 字串 (必要)
storageAccountKey 存取 Azure 檔案共用使用的儲存體帳戶存取金鑰。 字串
storageAccountName 包含 Azure 檔案共用的儲存體帳戶名稱。 字串 (必要)

GitRepoVolume

名稱 描述
directory 目標目錄名稱。 不能包含「..」或以「..」為開頭。 如果提供「.」,磁片區目錄即為 git 存放庫。 此外,若有指定,磁片區會包含在指定名稱子目錄中的 git 存放庫。 字串
repository 存放庫 URL 需要字串 ()
revision 認可指定修訂的雜湊。 字串

快速入門範本

下列快速入門範本會部署此資源類型。

範本 描述
在 AKS 上 SQL Server 可用性群組

部署至 Azure
這會建立新的 AKS 叢集,然後使用使用 Duffle 和 ACI 部署的 CNAB 套件,將 SQL Server 可用性群組部署到其中
建立 WordPress 網站

部署至 Azure
此範本會在容器實例上建立 WordPress 網站
在虛擬網路中建立 WordPress 網站

部署至 Azure
此範本會在虛擬網路中的容器實例上建立 WordPress 網站。 並輸出可存取 WordPress 網站的公用網站 FQDN。
Azure 容器執行個體 - BC 搭配 SQL Server 和 IIS

部署至 Azure
在 Azure 容器執行個體 上部署具有功能完整的獨立式 Microsoft Dynamics 365 Business Central 環境的單一 Windows 容器。
具有 容器執行個體 和 應用程式閘道 的 Front Door

部署至 Azure
此範本會建立具有容器群組和 應用程式閘道 的 Front Door Standard/Premium。
Front Door Standard/Premium with Azure 容器執行個體

部署至 Azure
此範本會建立具有容器群組的 Front Door Standard/Premium。
Azure 容器執行個體 - 具有健康情況探查的容器

部署至 Azure
使用 Azure 容器執行個體 部署具有健康情況探查的Linux容器。
Azure 容器執行個體 - 具有公用IP的Linux容器

部署至 Azure
使用 Azure 容器執行個體,部署可透過公用IP存取的單一Linux容器。
Azure 容器執行個體 - 具有安全 envVar 的容器

部署至 Azure
使用 Azure 容器執行個體 部署具有安全環境變數的Linux容器。
Azure 容器執行個體 - 具有 emptyDir 的 Linux 容器

部署至 Azure
部署兩個使用 Azure 容器執行個體 共用 emptyDir 磁碟區的 Linux 容器。
Azure 容器執行個體 - Linux 容器與 gitRepo

部署至 Azure
使用 Azure 容器執行個體 部署使用 gitRepo 磁碟區的 Linux 容器。
Azure 容器執行個體 - 具有秘密的容器

部署至 Azure
使用 Azure 容器執行個體 部署具有秘密磁碟區的Linux容器。
建立具有永續性記憶體的隨選 SFTP 伺服器

部署至 Azure
此範本示範使用 Azure 容器實例的隨選 SFTP 伺服器, (ACI) 。
使用現有記憶體帳戶的隨選 SFTP 伺服器

部署至 Azure
此範本示範使用 Azure 容器實例的隨選 SFTP 伺服器, (ACI) 。
透過容器建立記憶體帳戶檔案共用

部署至 Azure
此範本會透過容器實例中的 azure-cli 建立記憶體帳戶和檔案共用
ACI 中的 UDP 容器

部署至 Azure
此範本會建立 ACI 資源,並透過 UDP 公開容器
Azure 容器執行個體 - VNet

部署至 Azure
將容器實例部署至 Azure 虛擬網路。
使用憑證建立 應用程式閘道

部署至 Azure
此範本示範如何產生 金鑰保存庫 自我簽署憑證,然後從 應用程式閘道 參考。

Terraform (AzAPI 提供者) 資源定義

containerGroups 資源類型可以使用目標作業來部署:

  • 資源群組

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

資源格式

若要建立 Microsoft.ContainerInstance/containerGroups 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.ContainerInstance/containerGroups@2022-09-01"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  identity {
    type = "string"
    identity_ids = []
  }
  body = jsonencode({
    properties = {
      containers = [
        {
          name = "string"
          properties = {
            command = [
              "string"
            ]
            environmentVariables = [
              {
                name = "string"
                secureValue = "string"
                value = "string"
              }
            ]
            image = "string"
            livenessProbe = {
              exec = {
                command = [
                  "string"
                ]
              }
              failureThreshold = int
              httpGet = {
                httpHeaders = [
                  {
                    name = "string"
                    value = "string"
                  }
                ]
                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 = {
                httpHeaders = [
                  {
                    name = "string"
                    value = "string"
                  }
                ]
                path = "string"
                port = int
                scheme = "string"
              }
              initialDelaySeconds = int
              periodSeconds = int
              successThreshold = int
              timeoutSeconds = int
            }
            resources = {
              limits = {
                cpu = int
                gpu = {
                  count = int
                  sku = "string"
                }
                memoryInGB = "decimal-as-string"
              }
              requests = {
                cpu = int
                gpu = {
                  count = int
                  sku = "string"
                }
                memoryInGB = "decimal-as-string"
              }
            }
            volumeMounts = [
              {
                mountPath = "string"
                name = "string"
                readOnly = bool
              }
            ]
          }
        }
      ]
      diagnostics = {
        logAnalytics = {
          logType = "string"
          metadata = {}
          workspaceId = "string"
          workspaceKey = "string"
          workspaceResourceId = "string"
        }
      }
      dnsConfig = {
        nameServers = [
          "string"
        ]
        options = "string"
        searchDomains = "string"
      }
      encryptionProperties = {
        identity = "string"
        keyName = "string"
        keyVersion = "string"
        vaultBaseUrl = "string"
      }
      extensions = [
        {
          name = "string"
          properties = {
            extensionType = "string"
            version = "string"
          }
        }
      ]
      imageRegistryCredentials = [
        {
          identity = "string"
          identityUrl = "string"
          password = "string"
          server = "string"
          username = "string"
        }
      ]
      initContainers = [
        {
          name = "string"
          properties = {
            command = [
              "string"
            ]
            environmentVariables = [
              {
                name = "string"
                secureValue = "string"
                value = "string"
              }
            ]
            image = "string"
            volumeMounts = [
              {
                mountPath = "string"
                name = "string"
                readOnly = bool
              }
            ]
          }
        }
      ]
      ipAddress = {
        autoGeneratedDomainNameLabelScope = "string"
        dnsNameLabel = "string"
        ip = "string"
        ports = [
          {
            port = int
            protocol = "string"
          }
        ]
        type = "string"
      }
      osType = "string"
      restartPolicy = "string"
      sku = "string"
      subnetIds = [
        {
          id = "string"
          name = "string"
        }
      ]
      volumes = [
        {
          azureFile = {
            readOnly = bool
            shareName = "string"
            storageAccountKey = "string"
            storageAccountName = "string"
          }
          gitRepo = {
            directory = "string"
            repository = "string"
            revision = "string"
          }
          name = "string"
          secret = {}
        }
      ]
    }
    zones = [
      "string"
    ]
  })
}

屬性值

containerGroups

名稱 描述
類型 資源類型 “Microsoft.ContainerInstance/containerGroups@2022-09-01”
NAME 資源名稱 需要字串 ()

字元限制:1-63

合法字元:
小寫字母、數字和連字號。

不能以連字號開頭或結尾。 不允許連續的連字號。
location 資源位置。 字串
parent_id 若要部署至資源群組,請使用該資源群組的標識碼。 需要字串 ()
tags 資源標籤。 標記名稱和值的字典。
身分識別 容器群組的身分識別 (如果已設定)。 ContainerGroupIdentity
properties 容器群組屬性 ContainerGroupPropertiesProperties (必要)
zones (區域) 容器群組的區域。 string[]

ContainerGroupIdentity

名稱 描述
類型 容器群組使用的身分識別類型。 「SystemAssigned、UserAssigned」類型同時包含隱含建立的身分識別,和一組使用者指派的身分識別。 「None」類型會從容器群組移除任何身分識別。 “SystemAssigned”
“SystemAssigned, UserAssigned”
“UserAssigned”
identity_ids 容器群組相關的使用者身分識別清單。 使用者身分識別標識碼的陣列。

ContainerGroupPropertiesProperties

名稱 描述
containers 容器群組中的容器。 Container[] (必要)
診斷 容器群組的診斷資訊。 ContainerGroupDiagnostics
dnsConfig 容器群組的 DNS 設定資訊。 DnsConfiguration
encryptionProperties 容器群組的加密屬性。 EncryptionProperties
擴充功能 虛擬 kubelet 所使用的擴充功能 DeploymentExtensionSpec[]
imageRegistryCredentials 建立容器群組的來源映像登錄認證。 ImageRegistryCredential[]
initContainers 容器群組的 Init 容器。 InitContainerDefinition[]
ipAddress 容器群組的 IP 位址類型。 IpAddress
osType 容器群組中容器所需的作業系統類型。 "Linux"
“Windows” (必要)
restartPolicy 容器群組中所有容器的重新啟動原則。
- Always 一律重新啟動
- OnFailure 失敗時重新啟動
- Never 永不重新啟動
“Always”
“Never”
“OnFailure”
sku 容器群組的 SKU。 “專用”
“Standard”
subnetIds 容器群組的子網資源標識碼。 ContainerGroupSubnetId[]
磁碟區 此容器群組中容器可裝載的磁碟區清單。 Volume[]

容器

名稱 描述
NAME 容器執行個體的使用者提供名稱。 字串 (必要)
properties 容器執行個體的屬性。 ContainerProperties (必要)

ContainerProperties

名稱 描述
命令 容器執行個體中以 exec 格式執行的命令。 string[]
environmentVariables 容器執行個體中設定的環境變數。 EnvironmentVariable[]
image 建立容器執行個體使用的映像名稱。 字串 (必要)
livenessProbe 活躍度探查。 ContainerProbe
連接埠 容器執行個體上公開的連接埠。 ContainerPort[]
readinessProbe 整備度探查。 ContainerProbe
resources 容器執行個體的資源需求。 ResourceRequirements (必要)
volumeMounts 容器執行個體可用的磁碟區裝載。 VolumeMount[]

EnvironmentVariable

名稱 描述
NAME 環境變數的名稱。 字串 (必要)
secureValue 安全環境變數的值。 字串
value 環境變數的值。 字串

ContainerProbe

名稱 描述
exec 要探查的執行命令 ContainerExec
failureThreshold 失敗閾值。 int
httpGet 要探查的 Http 取得設定 ContainerHttpGet
initialDelaySeconds 初始延遲秒數。 int
periodSeconds 期間長度秒數。 int
successThreshold 成功閾值。 int
timeoutSeconds 逾時秒數。 int

ContainerExec

名稱 描述
命令 容器中執行的命令。 string[]

ContainerHttpGet

名稱 描述
httpHeaders HTTP 標頭。 HttpHeader[]
path 探查的路徑。 string
連接埠 探查的連接埠號碼。 int (必要)
scheme 配置。 “http”
“https”

HttpHeader

名稱 描述
NAME 標頭名稱。 字串
value 標頭值。 字串

ContainerPort

名稱 描述
連接埠 容器群組中公開的連接埠號碼。 int (必要)
protocol 連接埠相關的通訊協定。 “TCP”
“UDP”

ResourceRequirements

名稱 描述
限制 此容器執行個體的資源限制。 ResourceLimits
requests 此容器執行個體的資源要求。 ResourceRequests (必要)

ResourceLimits

名稱 描述
cpu 此容器執行個體的 CPU 限制。 int
gpu 此容器執行個體的 GPU 限制。 GpuResource
memoryInGB 此容器執行個體的記憶體限制 GB。 將十進位值指定為字串。 int 或 json decimal

GpuResource

名稱 描述
count GPU 資源的計數。 需要 int ()
sku GPU 資源的 SKU。 “K80”
“P100”
“V100” (必要)

ResourceRequests

名稱 描述
cpu 此容器執行個體的 CPU 要求。 需要 int ()
gpu 此容器執行個體的 GPU 要求。 GpuResource
memoryInGB 此容器執行個體的記憶體要求 GB。 將十進位值指定為字串。 需要 int 或 json 十進位 ()

VolumeMount

名稱 描述
mountPath 容器中磁碟區的裝載路徑。 不得包含冒號 (:)。 需要字串 ()
NAME 磁碟區裝載的名稱。 需要字串 ()
readOnly 此旗標指出磁碟區裝載是否為唯讀。 bool

ContainerGroupDiagnostics

名稱 描述
logAnalytics 容器群組記錄分析資訊。 LogAnalytics

LogAnalytics

名稱 描述
logType 要使用的記錄類型。 “ContainerInsights”
“ContainerInstanceLogs”
中繼資料 記錄分析的中繼資料。 物件 (object)
workspaceId 記錄分析的工作區標識碼 需要字串 ()
workspaceKey 記錄分析的工作區金鑰 需要字串 ()
workspaceResourceId 記錄分析的工作區資源標識碼 字串

DnsConfiguration

名稱 描述
nameServers 容器群組的 DNS 伺服器。 string[] (必要)
選項 容器群組的 DNS 選項。 字串
searchDomains 容器群組中適用於主機名稱查詢的 DNS 搜尋網域。 字串

EncryptionProperties

名稱 描述
身分識別 keyvault 受控識別。 字串
keyName 加密金鑰名稱。 字串 (必要)
keyVersion 加密金鑰版本。 字串 (必要)
vaultBaseUrl Keyvault 基底 URL。 字串 (必要)

DeploymentExtensionSpec

名稱 描述
NAME 延伸模組的名稱。 字串 (必要)
properties 擴充功能特定屬性 DeploymentExtensionSpecProperties

DeploymentExtensionSpecProperties

名稱 描述
extensionType 要加入的延伸模組類型。 字串 (必要)
protectedSettings 延伸模組的受保護設定。
設定 延伸模組的設定。
version 所使用的擴充功能版本。 字串 (必要)

ImageRegistryCredential

名稱 描述
身分識別 私人登錄的身分識別。 字串
identityUrl 私人登錄的身分識別 URL。 字串
password 私人登錄的密碼。 字串
伺服器 Docker 映像登錄伺服器不具通訊協定 (例如「http」和「https」)。 字串 (必要)
使用者名稱 私人登錄的使用者名稱。 字串

InitContainerDefinition

名稱 描述
NAME Init 容器的名稱。 字串 (必要)
properties Init 容器的屬性。 InitContainerPropertiesDefinition (必要)

InitContainerPropertiesDefinition

名稱 描述
命令 Init 容器中以 exec 格式執行的命令。 string[]
environmentVariables Init 容器中設定的環境變數。 EnvironmentVariable[]
image Init 容器的映像。 字串
volumeMounts Init 容器可用的磁碟區裝載。 VolumeMount[]

IpAddress

名稱 描述
autoGeneratedDomainNameLabelScope 表示安全性列舉的值。 如果未選取 ,則 'Unsecure' 值是預設值,表示物件的域名卷標不會受到子域接管的保護。 如果選取 'TenantReuse' 值,則為預設值,表示物件域名標籤可以在相同的租用戶內重複使用。 'SubscriptionReuse' 值表示物件域名標籤可以在相同的訂用帳戶內重複使用。 'ResourceGroupReuse' 值表示物件域名標籤可以在相同的資源群組內重複使用。 'NoReuse' 值表示無法在相同的資源群組、訂用帳戶或租用戶內重複使用物件的域名標籤。 “Noreuse”
“ResourceGroupReuse”
“SubscriptionReuse”
“TenantReuse”
“不安全”
dnsNameLabel IP 的 DNS 名稱標籤。 字串
ip 公開至公用網際網路的 IP。 字串
連接埠 容器群組上公開的連接埠清單。 [] (必要)
類型 如果 IP 公開至公用網際網路或私人 VNET 時指定。 “Private”
「公用」 (必要)

連接埠

名稱 描述
連接埠 連接埠號碼。 int (必要)
protocol 連接埠相關的通訊協定。 “TCP”
“UDP”

ContainerGroupSubnetId

名稱 描述
id 虛擬網路和子網的資源標識碼。 字串 (必要)
NAME 子網的易記名稱。 字串

磁碟區

名稱 描述
azureFile Azure 檔案磁碟區。 AzureFileVolume
emptyDir 空白的目錄磁碟區。
gitRepo Git 存放庫磁碟區。 GitRepoVolume
NAME 磁碟區的名稱。 字串 (必要)
secret 祕密磁碟區。 物件 (object)

AzureFileVolume

名稱 描述
readOnly 此旗標指出作為磁碟區裝載的 Azure 檔案共用是否為唯讀。 bool
shareName 作為磁碟區裝載的 Azure 檔案共用名稱。 字串 (必要)
storageAccountKey 存取 Azure 檔案共用使用的儲存體帳戶存取金鑰。 字串
storageAccountName 包含 Azure 檔案共用的儲存體帳戶名稱。 字串 (必要)

GitRepoVolume

名稱 描述
directory 目標目錄名稱。 不能包含「..」或以「..」為開頭。 如果提供「.」,磁片區目錄即為 git 存放庫。 此外,若有指定,磁片區會包含在指定名稱子目錄中的 git 存放庫。 字串
repository 存放庫 URL 字串 (必要)
revision 認可指定修訂的雜湊。 字串