Microsoft.Web 容器應用程式

備註

此資源類型已移轉至 Microsoft.App 命名空間。 如需新的資源類型,請參閱 Microsoft.App containerApps。

如需移轉的相關信息,請參閱需要 動作:Namespace從 Microsoft.Web 移轉至 2022 年 3 月的 Microsoft.App。

Bicep 資源定義

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

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

資源格式

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

resource symbolicname 'Microsoft.Web/containerApps@2023-12-01' = {
  kind: 'string'
  location: 'string'
  name: 'string'
  properties: {
    configuration: {
      activeRevisionsMode: 'string'
      ingress: {
        allowInsecure: bool
        external: bool
        targetPort: int
        traffic: [
          {
            latestRevision: bool
            revisionName: 'string'
            weight: int
          }
        ]
        transport: 'string'
      }
      registries: [
        {
          passwordSecretRef: 'string'
          server: 'string'
          username: 'string'
        }
      ]
      secrets: [
        {
          name: 'string'
          value: 'string'
        }
      ]
    }
    kubeEnvironmentId: 'string'
    template: {
      containers: [
        {
          args: [
            'string'
          ]
          command: [
            'string'
          ]
          env: [
            {
              name: 'string'
              secretRef: 'string'
              value: 'string'
            }
          ]
          image: 'string'
          name: 'string'
          resources: {
            cpu: int
            memory: 'string'
          }
        }
      ]
      dapr: {
        appId: 'string'
        appPort: int
        components: [
          {
            metadata: [
              {
                name: 'string'
                secretRef: 'string'
                value: 'string'
              }
            ]
            name: 'string'
            type: 'string'
            version: 'string'
          }
        ]
        enabled: bool
      }
      revisionSuffix: 'string'
      scale: {
        maxReplicas: int
        minReplicas: int
        rules: [
          {
            azureQueue: {
              auth: [
                {
                  secretRef: 'string'
                  triggerParameter: 'string'
                }
              ]
              queueLength: int
              queueName: 'string'
            }
            custom: {
              auth: [
                {
                  secretRef: 'string'
                  triggerParameter: 'string'
                }
              ]
              metadata: {
                {customized property}: 'string'
              }
              type: 'string'
            }
            http: {
              auth: [
                {
                  secretRef: 'string'
                  triggerParameter: 'string'
                }
              ]
              metadata: {
                {customized property}: 'string'
              }
            }
            name: 'string'
          }
        ]
      }
    }
  }
  tags: {
    {customized property}: 'string'
  }
}

屬性值

Microsoft.Web/containerApps

名稱 說明 價值
類 資源種類。 字串
位置 資源位置。 字串 (必要)
名稱 資源名稱 字串 (必要)
屬性 ContainerApp 資源特定屬性 ContainerApp屬性
標記 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤

設定

名稱 說明 價值
activeRevisionsMode ActiveRevisionsMode 控制容器應用程式的使用中修訂處理方式:
<清單><專案>多個:多個修訂可以使用中。 如果未提供任何值,則這是預設</item><item>Single:一次只能使用一個修訂。 無法在此模式中使用修訂權數,</item></list>
'多個'
'單個'
入口 輸入組態。 輸入
登記處 容器應用程式所使用的容器的私人容器登錄認證集合 RegistryCredentials[]
秘密 容器應用程式所使用的秘密集合 秘密[]

容器

名稱 說明 價值
參數 容器啟動命令自變數。 字串[]
指令 容器啟動命令。 字串[]
環境 容器環境變數。 EnvironmentVar (環境變數)
圖片 容器映像標記。 字串
名稱 自訂容器名稱。 字串
資源 容器資源需求。 容器資源

ContainerApp屬性

名稱 說明 價值
組態 非版本設定的容器應用程式組態屬性。 配置
kubeEnvironmentId 容器應用程式 KubeEnvironment 的資源識別碼。 字串
樣板 容器應用程式已建立版本的應用程式定義。 範本

容器資源

名稱 說明 價值
中央處理器 核心中所需的CPU,例如0.5 整數 (int)
記憶體 所需的記憶體,例如 “250Mb” 字串

CustomScaleRule

名稱 說明 價值
認證 自訂調整規則的驗證秘密。 ScaleRuleAuth []
中繼資料 描述自定義縮放規則的元數據屬性。 CustomScaleRuleMetadata
型別 自訂調整規則的類型
例如:azure-servicebus、redis 等。
字串

CustomScaleRuleMetadata

名稱 說明 價值

Dapr

名稱 說明 價值
應用程式ID Dapr 應用程式識別碼 字串
appPort 達普側車的港口 整數 (int)
組件 Dapr 元件的集合 DaprComponent[]
已啟用 布爾值,指出 Dapr 側車是否已啟用 布爾 (bool)

Dapr元件

名稱 說明 價值
中繼資料 元件元數據 Dapr元數據
名稱 元件名稱 字串
型別 元件類型 字串
版本 元件版本 字串

Dapr元數據

名稱 說明 價值
名稱 元數據屬性名稱。 字串
secretRef 的 要從中提取元數據屬性值的容器應用程式秘密名稱。 字串
價值 元數據屬性值。 字串

EnvironmentVar

名稱 說明 價值
名稱 環境變數名稱。 字串
secretRef 的 要從中提取環境變數值的容器應用程式秘密名稱。 字串
價值 非秘密環境變數值。 字串

HttpScaleRule

名稱 說明 價值
認證 自訂調整規則的驗證秘密。 ScaleRuleAuth []
中繼資料 描述 HTTP 縮放規則的元資料屬性。 HttpScaleRuleMetadata

HttpScaleRuleMetadata

名稱 說明 價值

入口

名稱 說明 價值
allowInsecure(允許不安全) 布爾,指出是否允許 HTTP 連線。 如果設定為 false HTTP 連線,則會自動重新導向至 HTTPS 連線 布爾 (bool)
外部 布爾值,指出應用程式是否公開外部 HTTP 端點 布爾 (bool)
目標埠 來自輸入流量的容器中目標埠 整數 (int)
交通 TrafficWeight []
運輸 輸入傳輸通訊協定 自動或汽車
“http”
'http2'

QueueScaleRule

名稱 說明 價值
認證 佇列調整規則的驗證秘密。 ScaleRuleAuth []
隊列長度 佇列長度。 整數 (int)
佇列名稱 佇列名稱。 字串

註冊表憑據

名稱 說明 價值
密碼SecretRef 包含登錄登入密碼的秘密名稱 字串
伺服器 Container Registry 伺服器 字串
使用者名稱 Container Registry 用戶名稱 字串

資源標籤

名稱 說明 價值

規模

名稱 說明 價值
最大副本數 選擇性。 容器復本的數目上限。 如果未設定,則預設為10。 整數 (int)
最小副本數 選擇性。 容器復本數目下限。 整數 (int)
規則 調整規則。 ScaleRule[]

ScaleRule

名稱 說明 價值
azureQueue 以 Azure 隊列為基礎的調整。 QueueScaleRule
習慣 自定義縮放規則。 CustomScaleRule
http HTTP 要求型調整。 HttpScaleRule
名稱 調整規則名稱 字串

ScaleRuleAuth 的

名稱 說明 價值
secretRef 的 要從中提取驗證參數的容器應用程式秘密名稱。 字串
triggerParameter 使用秘密的觸發程序參數 字串

秘密

名稱 說明 價值
名稱 秘密名稱。 字串
價值 秘密值。 字串

約束:
敏感性值。 以安全參數的形式傳入。

範本

名稱 說明 價值
器皿 容器應用程式的容器定義清單。 容器[]
DAPR 容器應用程式的 Dapr 組態。 Dapr
revisionSuffix 附加至修訂名稱的使用者易記後綴 字串
級別 調整容器應用程式的屬性。 比例

TrafficWeight (流量權重)

名稱 說明 價值
latestRevision 版本 表示流量權數屬於最新的穩定修訂 布爾 (bool)
修訂名稱 修訂的名稱 字串
重量 指派給修訂的流量權數 整數 (int)

ARM 樣本資源定義

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

使用範例

資源格式

若要建立 Microsoft.Web/containerApps 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.Web/containerApps",
  "apiVersion": "2023-12-01",
  "name": "string",
  "kind": "string",
  "location": "string",
  "properties": {
    "configuration": {
      "activeRevisionsMode": "string",
      "ingress": {
        "allowInsecure": "bool",
        "external": "bool",
        "targetPort": "int",
        "traffic": [
          {
            "latestRevision": "bool",
            "revisionName": "string",
            "weight": "int"
          }
        ],
        "transport": "string"
      },
      "registries": [
        {
          "passwordSecretRef": "string",
          "server": "string",
          "username": "string"
        }
      ],
      "secrets": [
        {
          "name": "string",
          "value": "string"
        }
      ]
    },
    "kubeEnvironmentId": "string",
    "template": {
      "containers": [
        {
          "args": [ "string" ],
          "command": [ "string" ],
          "env": [
            {
              "name": "string",
              "secretRef": "string",
              "value": "string"
            }
          ],
          "image": "string",
          "name": "string",
          "resources": {
            "cpu": "int",
            "memory": "string"
          }
        }
      ],
      "dapr": {
        "appId": "string",
        "appPort": "int",
        "components": [
          {
            "metadata": [
              {
                "name": "string",
                "secretRef": "string",
                "value": "string"
              }
            ],
            "name": "string",
            "type": "string",
            "version": "string"
          }
        ],
        "enabled": "bool"
      },
      "revisionSuffix": "string",
      "scale": {
        "maxReplicas": "int",
        "minReplicas": "int",
        "rules": [
          {
            "azureQueue": {
              "auth": [
                {
                  "secretRef": "string",
                  "triggerParameter": "string"
                }
              ],
              "queueLength": "int",
              "queueName": "string"
            },
            "custom": {
              "auth": [
                {
                  "secretRef": "string",
                  "triggerParameter": "string"
                }
              ],
              "metadata": {
                "{customized property}": "string"
              },
              "type": "string"
            },
            "http": {
              "auth": [
                {
                  "secretRef": "string",
                  "triggerParameter": "string"
                }
              ],
              "metadata": {
                "{customized property}": "string"
              }
            },
            "name": "string"
          }
        ]
      }
    }
  },
  "tags": {
    "{customized property}": "string"
  }
}

屬性值

Microsoft.Web/containerApps

名稱 說明 價值
apiVersion API 版本 '2023-12-01'
類 資源種類。 字串
位置 資源位置。 字串 (必要)
名稱 資源名稱 字串 (必要)
屬性 ContainerApp 資源特定屬性 ContainerApp屬性
標記 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤
型別 資源類型 “Microsoft.Web/containerApps”

設定

名稱 說明 價值
activeRevisionsMode ActiveRevisionsMode 控制容器應用程式的使用中修訂處理方式:
<清單><專案>多個:多個修訂可以使用中。 如果未提供任何值,則這是預設</item><item>Single:一次只能使用一個修訂。 無法在此模式中使用修訂權數,</item></list>
'多個'
'單個'
入口 輸入組態。 輸入
登記處 容器應用程式所使用的容器的私人容器登錄認證集合 RegistryCredentials[]
秘密 容器應用程式所使用的秘密集合 秘密[]

容器

名稱 說明 價值
參數 容器啟動命令自變數。 字串[]
指令 容器啟動命令。 字串[]
環境 容器環境變數。 EnvironmentVar (環境變數)
圖片 容器映像標記。 字串
名稱 自訂容器名稱。 字串
資源 容器資源需求。 容器資源

ContainerApp屬性

名稱 說明 價值
組態 非版本設定的容器應用程式組態屬性。 配置
kubeEnvironmentId 容器應用程式 KubeEnvironment 的資源識別碼。 字串
樣板 容器應用程式已建立版本的應用程式定義。 範本

容器資源

名稱 說明 價值
中央處理器 核心中所需的CPU,例如0.5 整數 (int)
記憶體 所需的記憶體,例如 “250Mb” 字串

CustomScaleRule

名稱 說明 價值
認證 自訂調整規則的驗證秘密。 ScaleRuleAuth []
中繼資料 描述自定義縮放規則的元數據屬性。 CustomScaleRuleMetadata
型別 自訂調整規則的類型
例如:azure-servicebus、redis 等。
字串

CustomScaleRuleMetadata

名稱 說明 價值

Dapr

名稱 說明 價值
應用程式ID Dapr 應用程式識別碼 字串
appPort 達普側車的港口 整數 (int)
組件 Dapr 元件的集合 DaprComponent[]
已啟用 布爾值,指出 Dapr 側車是否已啟用 布爾 (bool)

Dapr元件

名稱 說明 價值
中繼資料 元件元數據 Dapr元數據
名稱 元件名稱 字串
型別 元件類型 字串
版本 元件版本 字串

Dapr元數據

名稱 說明 價值
名稱 元數據屬性名稱。 字串
secretRef 的 要從中提取元數據屬性值的容器應用程式秘密名稱。 字串
價值 元數據屬性值。 字串

EnvironmentVar

名稱 說明 價值
名稱 環境變數名稱。 字串
secretRef 的 要從中提取環境變數值的容器應用程式秘密名稱。 字串
價值 非秘密環境變數值。 字串

HttpScaleRule

名稱 說明 價值
認證 自訂調整規則的驗證秘密。 ScaleRuleAuth []
中繼資料 描述 HTTP 縮放規則的元資料屬性。 HttpScaleRuleMetadata

HttpScaleRuleMetadata

名稱 說明 價值

入口

名稱 說明 價值
allowInsecure(允許不安全) 布爾,指出是否允許 HTTP 連線。 如果設定為 false HTTP 連線,則會自動重新導向至 HTTPS 連線 布爾 (bool)
外部 布爾值,指出應用程式是否公開外部 HTTP 端點 布爾 (bool)
目標埠 來自輸入流量的容器中目標埠 整數 (int)
交通 TrafficWeight []
運輸 輸入傳輸通訊協定 自動或汽車
“http”
'http2'

QueueScaleRule

名稱 說明 價值
認證 佇列調整規則的驗證秘密。 ScaleRuleAuth []
隊列長度 佇列長度。 整數 (int)
佇列名稱 佇列名稱。 字串

註冊表憑據

名稱 說明 價值
密碼SecretRef 包含登錄登入密碼的秘密名稱 字串
伺服器 Container Registry 伺服器 字串
使用者名稱 Container Registry 用戶名稱 字串

資源標籤

名稱 說明 價值

規模

名稱 說明 價值
最大副本數 選擇性。 容器復本的數目上限。 如果未設定,則預設為10。 整數 (int)
最小副本數 選擇性。 容器復本數目下限。 整數 (int)
規則 調整規則。 ScaleRule[]

ScaleRule

名稱 說明 價值
azureQueue 以 Azure 隊列為基礎的調整。 QueueScaleRule
習慣 自定義縮放規則。 CustomScaleRule
http HTTP 要求型調整。 HttpScaleRule
名稱 調整規則名稱 字串

ScaleRuleAuth 的

名稱 說明 價值
secretRef 的 要從中提取驗證參數的容器應用程式秘密名稱。 字串
triggerParameter 使用秘密的觸發程序參數 字串

秘密

名稱 說明 價值
名稱 秘密名稱。 字串
價值 秘密值。 字串

約束:
敏感性值。 以安全參數的形式傳入。

範本

名稱 說明 價值
器皿 容器應用程式的容器定義清單。 容器[]
DAPR 容器應用程式的 Dapr 組態。 Dapr
revisionSuffix 附加至修訂名稱的使用者易記後綴 字串
級別 調整容器應用程式的屬性。 比例

TrafficWeight (流量權重)

名稱 說明 價值
latestRevision 版本 表示流量權數屬於最新的穩定修訂 布爾 (bool)
修訂名稱 修訂的名稱 字串
重量 指派給修訂的流量權數 整數 (int)

Terraform (AzAPI 提供者) 資源定義

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

  • 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

資源格式

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

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Web/containerApps@2023-12-01"
  name = "string"
  parent_id = "string"
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    kind = "string"
    properties = {
      configuration = {
        activeRevisionsMode = "string"
        ingress = {
          allowInsecure = bool
          external = bool
          targetPort = int
          traffic = [
            {
              latestRevision = bool
              revisionName = "string"
              weight = int
            }
          ]
          transport = "string"
        }
        registries = [
          {
            passwordSecretRef = "string"
            server = "string"
            username = "string"
          }
        ]
        secrets = [
          {
            name = "string"
            value = "string"
          }
        ]
      }
      kubeEnvironmentId = "string"
      template = {
        containers = [
          {
            args = [
              "string"
            ]
            command = [
              "string"
            ]
            env = [
              {
                name = "string"
                secretRef = "string"
                value = "string"
              }
            ]
            image = "string"
            name = "string"
            resources = {
              cpu = int
              memory = "string"
            }
          }
        ]
        dapr = {
          appId = "string"
          appPort = int
          components = [
            {
              metadata = [
                {
                  name = "string"
                  secretRef = "string"
                  value = "string"
                }
              ]
              name = "string"
              type = "string"
              version = "string"
            }
          ]
          enabled = bool
        }
        revisionSuffix = "string"
        scale = {
          maxReplicas = int
          minReplicas = int
          rules = [
            {
              azureQueue = {
                auth = [
                  {
                    secretRef = "string"
                    triggerParameter = "string"
                  }
                ]
                queueLength = int
                queueName = "string"
              }
              custom = {
                auth = [
                  {
                    secretRef = "string"
                    triggerParameter = "string"
                  }
                ]
                metadata = {
                  {customized property} = "string"
                }
                type = "string"
              }
              http = {
                auth = [
                  {
                    secretRef = "string"
                    triggerParameter = "string"
                  }
                ]
                metadata = {
                  {customized property} = "string"
                }
              }
              name = "string"
            }
          ]
        }
      }
    }
  }
}

屬性值

Microsoft.Web/containerApps

名稱 說明 價值
類 資源種類。 字串
位置 資源位置。 字串 (必要)
名稱 資源名稱 字串 (必要)
屬性 ContainerApp 資源特定屬性 ContainerApp屬性
標記 資源標籤 標記名稱和值的字典。
型別 資源類型 “Microsoft.Web/containerApps@2023-12-01”

設定

名稱 說明 價值
activeRevisionsMode ActiveRevisionsMode 控制容器應用程式的使用中修訂處理方式:
<清單><專案>多個:多個修訂可以使用中。 如果未提供任何值,則這是預設</item><item>Single:一次只能使用一個修訂。 無法在此模式中使用修訂權數,</item></list>
'多個'
'單個'
入口 輸入組態。 輸入
登記處 容器應用程式所使用的容器的私人容器登錄認證集合 RegistryCredentials[]
秘密 容器應用程式所使用的秘密集合 秘密[]

容器

名稱 說明 價值
參數 容器啟動命令自變數。 字串[]
指令 容器啟動命令。 字串[]
環境 容器環境變數。 EnvironmentVar (環境變數)
圖片 容器映像標記。 字串
名稱 自訂容器名稱。 字串
資源 容器資源需求。 容器資源

ContainerApp屬性

名稱 說明 價值
組態 非版本設定的容器應用程式組態屬性。 配置
kubeEnvironmentId 容器應用程式 KubeEnvironment 的資源識別碼。 字串
樣板 容器應用程式已建立版本的應用程式定義。 範本

容器資源

名稱 說明 價值
中央處理器 核心中所需的CPU,例如0.5 整數 (int)
記憶體 所需的記憶體,例如 “250Mb” 字串

CustomScaleRule

名稱 說明 價值
認證 自訂調整規則的驗證秘密。 ScaleRuleAuth []
中繼資料 描述自定義縮放規則的元數據屬性。 CustomScaleRuleMetadata
型別 自訂調整規則的類型
例如:azure-servicebus、redis 等。
字串

CustomScaleRuleMetadata

名稱 說明 價值

Dapr

名稱 說明 價值
應用程式ID Dapr 應用程式識別碼 字串
appPort 達普側車的港口 整數 (int)
組件 Dapr 元件的集合 DaprComponent[]
已啟用 布爾值,指出 Dapr 側車是否已啟用 布爾 (bool)

Dapr元件

名稱 說明 價值
中繼資料 元件元數據 Dapr元數據
名稱 元件名稱 字串
型別 元件類型 字串
版本 元件版本 字串

Dapr元數據

名稱 說明 價值
名稱 元數據屬性名稱。 字串
secretRef 的 要從中提取元數據屬性值的容器應用程式秘密名稱。 字串
價值 元數據屬性值。 字串

EnvironmentVar

名稱 說明 價值
名稱 環境變數名稱。 字串
secretRef 的 要從中提取環境變數值的容器應用程式秘密名稱。 字串
價值 非秘密環境變數值。 字串

HttpScaleRule

名稱 說明 價值
認證 自訂調整規則的驗證秘密。 ScaleRuleAuth []
中繼資料 描述 HTTP 縮放規則的元資料屬性。 HttpScaleRuleMetadata

HttpScaleRuleMetadata

名稱 說明 價值

入口

名稱 說明 價值
allowInsecure(允許不安全) 布爾,指出是否允許 HTTP 連線。 如果設定為 false HTTP 連線,則會自動重新導向至 HTTPS 連線 布爾 (bool)
外部 布爾值,指出應用程式是否公開外部 HTTP 端點 布爾 (bool)
目標埠 來自輸入流量的容器中目標埠 整數 (int)
交通 TrafficWeight []
運輸 輸入傳輸通訊協定 自動或汽車
“http”
'http2'

QueueScaleRule

名稱 說明 價值
認證 佇列調整規則的驗證秘密。 ScaleRuleAuth []
隊列長度 佇列長度。 整數 (int)
佇列名稱 佇列名稱。 字串

註冊表憑據

名稱 說明 價值
密碼SecretRef 包含登錄登入密碼的秘密名稱 字串
伺服器 Container Registry 伺服器 字串
使用者名稱 Container Registry 用戶名稱 字串

資源標籤

名稱 說明 價值

規模

名稱 說明 價值
最大副本數 選擇性。 容器復本的數目上限。 如果未設定,則預設為10。 整數 (int)
最小副本數 選擇性。 容器復本數目下限。 整數 (int)
規則 調整規則。 ScaleRule[]

ScaleRule

名稱 說明 價值
azureQueue 以 Azure 隊列為基礎的調整。 QueueScaleRule
習慣 自定義縮放規則。 CustomScaleRule
http HTTP 要求型調整。 HttpScaleRule
名稱 調整規則名稱 字串

ScaleRuleAuth 的

名稱 說明 價值
secretRef 的 要從中提取驗證參數的容器應用程式秘密名稱。 字串
triggerParameter 使用秘密的觸發程序參數 字串

秘密

名稱 說明 價值
名稱 秘密名稱。 字串
價值 秘密值。 字串

約束:
敏感性值。 以安全參數的形式傳入。

範本

名稱 說明 價值
器皿 容器應用程式的容器定義清單。 容器[]
DAPR 容器應用程式的 Dapr 組態。 Dapr
revisionSuffix 附加至修訂名稱的使用者易記後綴 字串
級別 調整容器應用程式的屬性。 比例

TrafficWeight (流量權重)

名稱 說明 價值
latestRevision 版本 表示流量權數屬於最新的穩定修訂 布爾 (bool)
修訂名稱 修訂的名稱 字串
重量 指派給修訂的流量權數 整數 (int)