Deployments - What If At Subscription Scope

Returns changes that will be made by the deployment if executed at the scope of the subscription.

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

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

The ID of the target subscription.

deploymentName
path True
  • string

The name of the deployment.

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

api-version
query True
  • string

The API version to use for this operation.

Request Body

Name Required Type Description
location
  • string

The location to store the deployment data.

properties True

The deployment properties.

Responses

Name Type Description
200 OK

OK - Returns What-If operation status

202 Accepted

Accepted - Returns URL in Location header to query for long-running operation status.

Headers

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

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

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

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Predict template changes at subscription scope

Sample Request

POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000001/providers/Microsoft.Resources/deployments/exampleDeploymentName/whatIf?api-version=2019-10-01
{
  "location": "westus",
  "properties": {
    "templateLink": "https://example.com/exampleTemplate.json",
    "parameters": {},
    "mode": "Incremental"
  }
}

Sample Response

{
  "status": "succeeded",
  "properties": {
    "changes": [
      {
        "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myExistingIdentity",
        "changeType": "Modify",
        "before": {
          "apiVersion": "2018-11-30",
          "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/myResourceGroup/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/myResourceGroup/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/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myNewIdentity",
        "changeType": "Create",
        "after": {
          "apiVersion": "2018-11-30",
          "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/myResourceGroup/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/myResourceGroup2",
        "changeType": "Create",
        "after": {
          "apiVersion": "2019-03-01",
          "id": "/subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/myResourceGroup2",
          "type": "Microsoft.Resources/resourceGroups",
          "name": "myResourceGroup2",
          "location": "{location3}"
        }
      }
    ]
  }
}
Location: /subscriptions/4d0ca63b-7939-4c9c-afbe-5fafae501724/operationresults/ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Definitions

ChangeType

Type of change that will be made to the resource when the deployment is executed.

CloudError

An error response for a resource management request.

DebugSetting

The debug setting.

DeploymentMode

The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.

DeploymentWhatIf

Deployment What-if operation parameters.

DeploymentWhatIfProperties

Deployment What-if properties.

DeploymentWhatIfSettings

Deployment What-If operation settings.

ErrorAdditionalInfo

The resource management error additional info.

ErrorResponse

The resource management error response.

OnErrorDeployment

Deployment on error behavior.

OnErrorDeploymentType

The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment.

ParametersLink

Entity representing the reference to the deployment parameters.

PropertyChangeType

The type of property change.

TemplateLink

Entity representing the reference to the template.

WhatIfChange

Information about a single resource change predicted by What-If operation.

WhatIfOperationResult

Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results.

WhatIfPropertyChange

The predicted change to the resource property.

WhatIfResultFormat

The format of the What-If results

ChangeType

Type of change that will be made to the resource when the deployment is executed.

Name Type Description
Create
  • string

The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed.

Delete
  • string

The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed.

Deploy
  • string

The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change.

Ignore
  • string

The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed.

Modify
  • string

The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change.

NoChange
  • string

The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change.

CloudError

An error response for a resource management request.

Name Type Description
error

The resource management error response.

DebugSetting

The debug setting.

Name Type Description
detailLevel
  • string

Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations.

DeploymentMode

The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.

Name Type Description
Complete
  • string
Incremental
  • string

DeploymentWhatIf

Deployment What-if operation parameters.

Name Type Description
location
  • string

The location to store the deployment data.

properties

The deployment properties.

DeploymentWhatIfProperties

Deployment What-if properties.

Name Type Description
debugSetting

The debug setting of the deployment.

mode

The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.

onErrorDeployment

The deployment on error behavior.

parameters
  • object

Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string.

parametersLink

The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both.

template
  • object

The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both.

templateLink

The URI of the template. Use either the templateLink property or the template property, but not both.

whatIfSettings

Optional What-If operation settings.

DeploymentWhatIfSettings

Deployment What-If operation settings.

Name Type Description
resultFormat

The format of the What-If results

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info
  • object

The additional info.

type
  • string

The additional info type.

ErrorResponse

The resource management error response.

Name Type Description
additionalInfo

The error additional info.

code
  • string

The error code.

details

The error details.

message
  • string

The error message.

target
  • string

The error target.

OnErrorDeployment

Deployment on error behavior.

Name Type Description
deploymentName
  • string

The deployment to be used on error case.

type

The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment.

OnErrorDeploymentType

The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment.

Name Type Description
LastSuccessful
  • string
SpecificDeployment
  • string

Entity representing the reference to the deployment parameters.

Name Type Description
contentVersion
  • string

If included, must match the ContentVersion in the template.

uri
  • string

The URI of the parameters file.

PropertyChangeType

The type of property change.

Name Type Description
Array
  • string

The property is an array and contains nested changes.

Create
  • string

The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed.

Delete
  • string

The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed.

Modify
  • string

The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed.

Entity representing the reference to the template.

Name Type Description
contentVersion
  • string

If included, must match the ContentVersion in the template.

uri
  • string

The URI of the template to deploy.

WhatIfChange

Information about a single resource change predicted by What-If operation.

Name Type Description
after
  • object

The predicted snapshot of the resource after the deployment is executed.

before
  • object

The snapshot of the resource before the deployment is executed.

changeType

Type of change that will be made to the resource when the deployment is executed.

delta

The predicted changes to resource properties.

resourceId
  • string

Resource ID

WhatIfOperationResult

Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results.

Name Type Description
error

Error when What-If operation fails.

properties.changes

List of resource changes predicted by What-If operation.

status
  • string

Status of the What-If operation.

WhatIfPropertyChange

The predicted change to the resource property.

Name Type Description
after
  • object

The value of the property after the deployment is executed.

before
  • object

The value of the property before the deployment is executed.

children

Nested property changes.

path
  • string

The path of the property.

propertyChangeType

The type of property change.

WhatIfResultFormat

The format of the What-If results

Name Type Description
FullResourcePayloads
  • string
ResourceIdOnly
  • string