Deployments - What If At Subscription Scope

傳回部署在訂用帳戶範圍內執行的變更。

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf?api-version=2021-04-01

URI 參數

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

string

部署的名稱。

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

subscriptionId
path True

string

Microsoft Azure 訂用帳戶標識碼。

api-version
query True

string

用於此作業的 API 版本。

要求本文

名稱 必要 類型 Description
properties True

DeploymentWhatIfProperties

部署屬性。

location

string

儲存部署數據的位置。

回應

名稱 類型 Description
200 OK

WhatIfOperationResult

確定 - 傳回 What-If 作業狀態

202 Accepted

已接受 - 傳回位置標頭中的 URL,以查詢長時間執行的作業狀態。

Headers

  • Location: string
  • Retry-After: string
Other Status Codes

CloudError

描述作業失敗原因的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

Predict template changes at subscription scope

Sample Request

POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000001/providers/Microsoft.Resources/deployments/my-deployment/whatIf?api-version=2021-04-01

{
  "location": "westus",
  "properties": {
    "templateLink": {
      "uri": "https://example.com/exampleTemplate.json"
    },
    "parameters": {},
    "mode": "Incremental"
  }
}

Sample Response

{
  "status": "Succeeded",
  "properties": {
    "changes": [
      {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myExistingIdentity",
        "changeType": "Modify",
        "before": {
          "apiVersion": "2018-11-30",
          "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myExistingIdentity",
          "type": "Microsoft.ManagedIdentity/userAssignedIdentities",
          "name": "myExistingIdentity",
          "location": "westus2"
        },
        "after": {
          "apiVersion": "2018-11-30",
          "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myExistingIdentity",
          "type": "Microsoft.ManagedIdentity/userAssignedIdentities",
          "name": "myExistingIdentity",
          "location": "westus2",
          "tags": {
            "myNewTag": "my tag value"
          }
        },
        "delta": [
          {
            "path": "tags.myNewTag",
            "propertyChangeType": "Create",
            "after": "my tag value"
          }
        ]
      },
      {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myNewIdentity",
        "changeType": "Create",
        "after": {
          "apiVersion": "2018-11-30",
          "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myNewIdentity",
          "type": "Microsoft.ManagedIdentity/userAssignedIdentities",
          "name": "myNewIdentity",
          "location": "eastus",
          "tags": {
            "myOtherNewTag": "another new tag value"
          }
        }
      },
      {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group2",
        "changeType": "Create",
        "after": {
          "apiVersion": "2019-03-01",
          "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group2",
          "type": "Microsoft.Resources/resourceGroups",
          "name": "my-resource-group2",
          "location": "{location3}"
        }
      }
    ]
  }
}
Location: /subscriptions/00000000-0000-0000-0000-000000000000/ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

定義

名稱 Description
ChangeType

執行部署時,將會對資源進行變更的類型。

CloudError

資源管理要求的錯誤回應。

DebugSetting

偵錯設定。

DeploymentMode

用來部署資源的模式。 此值可以是累加或完成。 在 [增量] 模式中,部署資源時不會刪除範本中未包含的現有資源。 在 [完成] 模式中,會部署資源,且不會包含在範本中的資源群組中現有的資源會遭到刪除。 使用 [完成] 模式時請小心,因為您可能不小心刪除資源。

DeploymentWhatIf

部署假設狀況作業參數。

DeploymentWhatIfProperties

部署假設狀況屬性。

DeploymentWhatIfSettings

部署 What-If 作業設定。

ErrorAdditionalInfo

資源管理錯誤其他資訊。

ErrorResponse

錯誤回應

ExpressionEvaluationOptions

指定範本表示式是在父範本或巢狀範本的範圍內評估。

ExpressionEvaluationOptionsScopeType

要用於評估巢狀範本中參數、變數和函式的範圍。

OnErrorDeployment

錯誤行為的部署。

OnErrorDeploymentType

錯誤行為類型的部署。 可能的值為 LastSuccessful 和 SpecificDeployment。

ParametersLink

表示部署參數參考的實體。

PropertyChangeType

屬性的類型會變更。

TemplateLink

實體,代表範本的參考。

WhatIfChange

What-If 作業所預測之單一資源變更的相關信息。

WhatIfOperationResult

What-If 作業的結果。 包含可取得下一組結果的預測變更和 URL 連結清單。

WhatIfPropertyChange

資源屬性的預測變更。

WhatIfResultFormat

What-If 結果的格式

ChangeType

執行部署時,將會對資源進行變更的類型。

名稱 類型 Description
Create

string

資源不存在於目前狀態,但處於所需狀態。 執行部署時,將會建立資源。

Delete

string

資源存在於目前狀態,而且缺少所需的狀態。 執行部署時,將會刪除資源。

Deploy

string

資源存在於目前狀態和所需的狀態,且在執行部署時將會重新部署。 資源的屬性不一定會變更。

Ignore

string

資源存在於目前狀態,而且缺少所需的狀態。 執行部署時,將不會部署或修改資源。

Modify

string

資源存在於目前狀態和所需的狀態,並在執行部署時重新部署。 資源的屬性將會變更。

NoChange

string

資源存在於目前狀態和所需的狀態,且在執行部署時將會重新部署。 資源的屬性將不會變更。

Unsupported

string

What-If 不支持資源。

CloudError

資源管理要求的錯誤回應。

名稱 類型 Description
error

ErrorResponse

錯誤回應
所有 Azure Resource Manager API 的常見錯誤回應,可傳回失敗作業的錯誤詳細數據。 (這也會遵循 OData 錯誤回應格式。)

DebugSetting

偵錯設定。

名稱 類型 Description
detailLevel

string

指定要記錄以進行偵錯的資訊類型。 允許的值為 none、requestContent、responseContent 或 requestContent 和 responseContent,並以逗號分隔。 預設值是 [none]。 設定此值時,請仔細考慮您在部署期間傳入的信息類型。 透過記錄要求或回應的相關資訊,您可能會公開透過部署作業擷取的機密資料。

DeploymentMode

用來部署資源的模式。 此值可以是累加或完成。 在 [增量] 模式中,部署資源時不會刪除範本中未包含的現有資源。 在 [完成] 模式中,會部署資源,且不會包含在範本中的資源群組中現有的資源會遭到刪除。 使用 [完成] 模式時請小心,因為您可能不小心刪除資源。

名稱 類型 Description
Complete

string

Incremental

string

DeploymentWhatIf

部署假設狀況作業參數。

名稱 類型 Description
location

string

要儲存部署數據的位置。

properties

DeploymentWhatIfProperties

部署屬性。

DeploymentWhatIfProperties

部署假設狀況屬性。

名稱 類型 Description
debugSetting

DebugSetting

部署的偵錯設定。

expressionEvaluationOptions

ExpressionEvaluationOptions

指定範本表示式是在父範本或巢狀範本的範圍內評估。 僅適用於巢狀範本。 如果未指定,預設值為外部。

mode

DeploymentMode

用來部署資源的模式。 此值可以是累加或完成。 在 [增量] 模式中,部署資源時不會刪除範本中未包含的現有資源。 在 [完成] 模式中,會部署資源,且不會包含在範本中的資源群組中現有的資源會遭到刪除。 使用 [完成] 模式時請小心,因為您可能不小心刪除資源。

onErrorDeployment

OnErrorDeployment

錯誤行為的部署。

parameters

object

定義範本部署參數的名稱和值組。 當您想要直接在要求中提供參數值,而不是連結至現有的參數檔案時,請使用這個專案。 使用parametersLink屬性或parameters屬性,但不能同時使用兩者。 它可以是 JObject 或格式正確的 JSON 字串。

parametersLink

ParametersLink

參數檔案的 URI。 您可以使用這個項目連結至現有的參數檔案。 使用parametersLink屬性或parameters屬性,但不能同時使用兩者。

template

object

範本內容。 當您想要直接在要求中傳遞範本語法,而不是連結至現有的範本時,請使用這個專案。 它可以是 JObject 或格式正確的 JSON 字串。 使用templateLink屬性或範本屬性,但不能同時使用兩者。

templateLink

TemplateLink

範本的 URI。 使用templateLink屬性或範本屬性,但不能同時使用兩者。

whatIfSettings

DeploymentWhatIfSettings

選擇性 What-If 作業設定。

DeploymentWhatIfSettings

部署 What-If 作業設定。

名稱 類型 Description
resultFormat

WhatIfResultFormat

What-If 結果的格式

ErrorAdditionalInfo

資源管理錯誤其他資訊。

名稱 類型 Description
info

object

其他資訊。

type

string

其他信息類型。

ErrorResponse

錯誤回應

名稱 類型 Description
additionalInfo

ErrorAdditionalInfo[]

錯誤其他資訊。

code

string

錯誤碼。

details

ErrorResponse[]

錯誤詳細資料。

message

string

錯誤訊息。

target

string

錯誤目標。

ExpressionEvaluationOptions

指定範本表示式是在父範本或巢狀範本的範圍內評估。

名稱 類型 Description
scope

ExpressionEvaluationOptionsScopeType

要用於評估巢狀範本中參數、變數和函式的範圍。

ExpressionEvaluationOptionsScopeType

要用於評估巢狀範本中參數、變數和函式的範圍。

名稱 類型 Description
Inner

string

NotSpecified

string

Outer

string

OnErrorDeployment

錯誤行為的部署。

名稱 類型 Description
deploymentName

string

要用於錯誤案例的部署。

type

OnErrorDeploymentType

錯誤行為類型的部署。 可能的值為 LastSuccessful 和 SpecificDeployment。

OnErrorDeploymentType

錯誤行為類型的部署。 可能的值為 LastSuccessful 和 SpecificDeployment。

名稱 類型 Description
LastSuccessful

string

SpecificDeployment

string

表示部署參數參考的實體。

名稱 類型 Description
contentVersion

string

如果包含,則必須符合範本中的 ContentVersion。

uri

string

參數檔案的 URI。

PropertyChangeType

屬性的類型會變更。

名稱 類型 Description
Array

string

屬性是陣列,包含巢狀變更。

Create

string

屬性不存在於目前狀態,但存在於所需的狀態。 執行部署時,將會建立 屬性。

Delete

string

屬性存在於目前狀態中,而且遺漏所需的狀態。 執行部署時,將會刪除它。

Modify

string

屬性同時存在於目前和所需的狀態,而且不同。 執行部署時,屬性的值將會變更。

NoEffect

string

不會設定或更新屬性。

實體,代表範本的參考。

名稱 類型 Description
contentVersion

string

如果包含,則必須符合範本中的 ContentVersion。

id

string

範本規格的資源識別碼。請使用id或 uri 屬性,但不能同時使用兩者。

queryString

string

例如,要與 templateLink URI 搭配使用的 SAS 令牌) 查詢字串 (。

relativePath

string

relativePath 屬性可用來在相對於父系的位置上部署連結的範本。 如果父範本與 TemplateSpec 連結,這會參考 TemplateSpec 中的成品。 如果父系與 URI 連結,子部署將會是父系和 relativePath URI 的組合

uri

string

要部署之範本的 URI。 請使用 uri 或 id 屬性,但不要同時使用兩者。

WhatIfChange

What-If 作業所預測之單一資源變更的相關信息。

名稱 類型 Description
after

object

執行部署之後,資源的預測快照集。

before

object

執行部署之前的資源快照集。

changeType

ChangeType

執行部署時,將會對資源進行變更的類型。

delta

WhatIfPropertyChange[]

資源屬性的預測變更。

resourceId

string

資源識別碼

unsupportedReason

string

What-If 為何不支持資源的說明。

WhatIfOperationResult

What-If 作業的結果。 包含可取得下一組結果的預測變更和 URL 連結清單。

名稱 類型 Description
error

ErrorResponse

錯誤回應
What-If 作業失敗時發生錯誤。

properties.changes

WhatIfChange[]

What-If 作業所預測的資源變更清單。

status

string

What-If 作業的狀態。

WhatIfPropertyChange

資源屬性的預測變更。

名稱 類型 Description
after

object

執行部署之後的屬性值。

before

object

在執行部署之前的屬性值。

children

WhatIfPropertyChange[]

巢狀屬性變更。

path

string

屬性的路徑。

propertyChangeType

PropertyChangeType

屬性的類型會變更。

WhatIfResultFormat

What-If 結果的格式

名稱 類型 Description
FullResourcePayloads

string

ResourceIdOnly

string