共用方式為


App Resiliency - Update

更新應用程式的復原原則。
更新容器應用程式復原原則。

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}?api-version=2025-02-02-preview

URI 參數

名稱 位於 必要 類型 Description
appName
path True

string

pattern: ^[-\w\._\(\)]+$

容器應用程式的名稱。

name
path True

string

pattern: ^[-\w\._\(\)]+$

復原原則的名稱。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

資源群組的名稱。 名稱不區分大小寫。

subscriptionId
path True

string (uuid)

目標訂用帳戶的標識碼。 此值必須是 UUID。

api-version
query True

string

minLength: 1

要用於這項作業的 API 版本。

要求本文

名稱 類型 Description
properties.circuitBreakerPolicy

CircuitBreakerPolicy

定義斷路器條件的原則

properties.httpConnectionPool

HttpConnectionPool

定義 HTTP 連線共用的參數

properties.httpRetryPolicy.matches.errors

string[]

可以觸發重試的錯誤

properties.httpRetryPolicy.matches.headers

HeaderMatch[]

必須存在的標頭,才能重試要求

properties.httpRetryPolicy.matches.httpStatusCodes

integer[] (int32)

可觸發重試的其他 HTTP 狀態代碼

properties.httpRetryPolicy.maxRetries

integer (int32)

要求重試的次數上限

properties.httpRetryPolicy.retryBackOff.initialDelayInMilliseconds

integer (int64)

在重試要求之前,以毫秒為單位的初始延遲

properties.httpRetryPolicy.retryBackOff.maxIntervalInMilliseconds

integer (int64)

重試之間的間隔上限,以毫秒為單位

properties.tcpConnectionPool

TcpConnectionPool

定義 tcp 連線共用的參數

properties.tcpRetryPolicy

TcpRetryPolicy

定義 tcp 要求重試條件的原則

properties.timeoutPolicy

TimeoutPolicy

設定要求逾時的原則

回應

名稱 類型 Description
200 OK

AppResiliency

還行

Other Status Codes

DefaultErrorResponse

常見的錯誤回應。

範例

Update App Resiliency

範例要求

PATCH https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0/resiliencyPolicies/resiliency-policy-1?api-version=2025-02-02-preview

{
  "properties": {
    "timeoutPolicy": {
      "responseTimeoutInSeconds": 30,
      "connectionTimeoutInSeconds": 40
    }
  }
}

範例回覆

{
  "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0/resiliencyPolicies/resiliency-policy-1",
  "name": "resiliency-policy-1",
  "type": "Microsoft.App/containerApps/resiliencyPolicies",
  "properties": {
    "timeoutPolicy": {
      "responseTimeoutInSeconds": 30,
      "connectionTimeoutInSeconds": 40
    },
    "httpRetryPolicy": {
      "maxRetries": 5,
      "retryBackOff": {
        "initialDelayInMilliseconds": 1000,
        "maxIntervalInMilliseconds": 10000
      },
      "matches": {
        "headers": [
          {
            "header": "X-Content-Type",
            "match": {
              "prefixMatch": "GOATS"
            }
          }
        ],
        "httpStatusCodes": [
          502,
          503
        ],
        "errors": [
          "5xx",
          "connect-failure",
          "reset",
          "retriable-headers",
          "retriable-status-codes"
        ]
      }
    },
    "tcpRetryPolicy": {
      "maxConnectAttempts": 3
    },
    "circuitBreakerPolicy": {
      "consecutiveErrors": 5,
      "intervalInSeconds": 10,
      "maxEjectionPercent": 50
    },
    "tcpConnectionPool": {
      "maxConnections": 100
    },
    "httpConnectionPool": {
      "http1MaxPendingRequests": 1024,
      "http2MaxRequests": 1024
    }
  }
}

定義

名稱 Description
AppResiliency

設定應用程式復原的設定

CircuitBreakerPolicy

定義斷路器條件的原則

createdByType

建立資源的身分識別類型。

DefaultErrorResponse

App Service 錯誤回應。

Details

詳細數據或錯誤

Error

錯誤模型。

HeaderMatch

符合標頭所需的條件

HttpConnectionPool

定義 HTTP 連線共用的參數

systemData

與建立和上次修改資源相關的元數據。

TcpConnectionPool

定義 tcp 連線共用的參數

TcpRetryPolicy

定義 tcp 要求重試條件的原則

TimeoutPolicy

設定要求逾時的原則

AppResiliency

設定應用程式復原的設定

名稱 類型 Description
id

string (arm-id)

資源的完整資源標識碼。 例如 “/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”

name

string

資源的名稱

properties.circuitBreakerPolicy

CircuitBreakerPolicy

定義斷路器條件的原則

properties.httpConnectionPool

HttpConnectionPool

定義 HTTP 連線共用的參數

properties.httpRetryPolicy.matches.errors

string[]

可以觸發重試的錯誤

properties.httpRetryPolicy.matches.headers

HeaderMatch[]

必須存在的標頭,才能重試要求

properties.httpRetryPolicy.matches.httpStatusCodes

integer[] (int32)

可觸發重試的其他 HTTP 狀態代碼

properties.httpRetryPolicy.maxRetries

integer (int32)

要求重試的次數上限

properties.httpRetryPolicy.retryBackOff.initialDelayInMilliseconds

integer (int64)

在重試要求之前,以毫秒為單位的初始延遲

properties.httpRetryPolicy.retryBackOff.maxIntervalInMilliseconds

integer (int64)

重試之間的間隔上限,以毫秒為單位

properties.tcpConnectionPool

TcpConnectionPool

定義 tcp 連線共用的參數

properties.tcpRetryPolicy

TcpRetryPolicy

定義 tcp 要求重試條件的原則

properties.timeoutPolicy

TimeoutPolicy

設定要求逾時的原則

systemData

systemData

包含 createdBy 和 modifiedBy 資訊的 Azure Resource Manager 元數據。

type

string

資源的類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”

CircuitBreakerPolicy

定義斷路器條件的原則

名稱 類型 Description
consecutiveErrors

integer (int32)

斷路器開啟之前的連續錯誤數目

intervalInSeconds

integer (int32)

端點檢查之間的時間間隔,以秒為單位。 如果檢查失敗,以及如果檢查成功,關閉斷路器,這可能會導致開啟斷路器。 預設值為 10s。

maxEjectionPercent

integer (int32)

符合失敗閾值後將會退出的主機百分比上限

createdByType

建立資源的身分識別類型。

Description
Application
Key
ManagedIdentity
User

DefaultErrorResponse

App Service 錯誤回應。

名稱 類型 Description
error

Error

錯誤模型。

Details

詳細數據或錯誤

名稱 類型 Description
code

string

以程式設計方式識別錯誤的標準化字串。

message

string

詳細的錯誤描述和偵錯資訊。

target

string

詳細的錯誤描述和偵錯資訊。

Error

錯誤模型。

名稱 類型 Description
code

string

以程式設計方式識別錯誤的標準化字串。

details

Details[]

詳細數據或錯誤

innererror

string

偵錯錯誤的詳細資訊。

message

string

詳細的錯誤描述和偵錯資訊。

target

string

詳細的錯誤描述和偵錯資訊。

HeaderMatch

符合標頭所需的條件

名稱 類型 Description
header

string

標頭的名稱

match.exactMatch

string

標頭的確切值

match.prefixMatch

string

標頭的前置詞值

match.regexMatch

string

標頭的 Regex 值

match.suffixMatch

string

標頭的後綴值

HttpConnectionPool

定義 HTTP 連線共用的參數

名稱 類型 Description
http1MaxPendingRequests

integer (int32)

允許的暫止 HTTP1 要求數目上限

http2MaxRequests

integer (int32)

允許的 HTTP2 要求數目上限

systemData

與建立和上次修改資源相關的元數據。

名稱 類型 Description
createdAt

string (date-time)

資源建立的時間戳(UTC)。

createdBy

string

建立資源的身分識別。

createdByType

createdByType

建立資源的身分識別類型。

lastModifiedAt

string (date-time)

上次修改的資源時間戳 (UTC)

lastModifiedBy

string

上次修改資源的身分識別。

lastModifiedByType

createdByType

上次修改資源的身分識別類型。

TcpConnectionPool

定義 tcp 連線共用的參數

名稱 類型 Description
maxConnections

integer (int32)

允許的 TCP 連線數目上限

TcpRetryPolicy

定義 tcp 要求重試條件的原則

名稱 類型 Description
maxConnectAttempts

integer (int32)

線上到 tcp 服務的嘗試次數上限

TimeoutPolicy

設定要求逾時的原則

名稱 類型 Description
connectionTimeoutInSeconds

integer (int32)

逾時,以秒為單位,要求起始連接

responseTimeoutInSeconds

integer (int32)

要求回應的逾時,以秒為單位