Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.56k stars 5k forks source link

[BUG] Microsoft.Resources/stable/2020-06-01 `Deployments_Get` method doesn't return resource providers used in deployment template #28517

Open teowa opened 5 months ago

teowa commented 5 months ago

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/e367672ea9422797ec90bfdf21a9434218359311/specification/resources/resource-manager/Microsoft.Resources/stable/2020-06-01/resources.json#L1686

API Spec version

2020-06-01

Describe the bug

https://github.com/Azure/azure-rest-api-specs/blob/e367672ea9422797ec90bfdf21a9434218359311/specification/resources/resource-manager/Microsoft.Resources/stable/2020-06-01/resources.json#L5010-L5017

When use Deployments_Get method the returned providers does not contain providers used in template, only Microsoft.Resources is returned

Expected behavior

return resource providers needed for the deployment, as shown below, Microsoft.Insights should be returned.

Actual behavior

only Microsoft.Resources provider is returned

Reproduction Steps

PUT /subscriptions/xxx/resourcegroups/wt-test-rgtd/providers/Microsoft.Resources/deployments/test?api-version=2020-06-01 HTTP/1.1

Host: management.azure.com User-Agent: Go/go1.21.6 (amd64-linux) go-autorest/v14.2.1 Azure-SDK-For-Go/v66.0.0 resources/2020-06-01 HashiCorp Terraform/1.5.5 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/dev pid-222c6c49-1b0a-5959-a213-6608f9eb8820 Content-Length: 1297 Content-Type: application/json; charset=utf-8 X-Ms-Correlation-Request-Id: 24185cac-6105-ed54-7d5d-5dd9da2de858 Accept-Encoding: gzip

{
  "properties": {
    "template": {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "metadata": {
        "_generator": {
          "name": "bicep",
          "templateHash": "2475081129043918723",
          "version": "0.26.54.24096"
        }
      },
      "parameters": {
        "subscriptionId": {
          "type": "string"
        }
      },
      "resources": [
        {
          "apiVersion": "2022-09-01",
          "name": "activityLogAlert",
          "properties": {
            "expressionEvaluationOptions": {
              "scope": "inner"
            },
            "mode": "Incremental",
            "parameters": {
              "subscriptionId": {
                "value": "[parameters('subscriptionId')]"
              }
            },
            "template": {
              "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "metadata": {
                "_generator": {
                  "name": "bicep",
                  "templateHash": "6702635675896398084",
                  "version": "0.26.54.24096"
                }
              },
              "parameters": {
                "subscriptionId": {
                  "type": "string"
                }
              },
              "resources": [
                {
                  "apiVersion": "2020-10-01",
                  "location": "westeurope",
                  "name": "test",
                  "properties": {
                    "condition": {
                      "allOf": [
                        {
                          "equals": "ResourceHealth",
                          "field": "category"
                        }
                      ]
                    },
                    "enabled": false,
                    "scopes": [
                      "[parameters('subscriptionId')]"
                    ]
                  },
                  "type": "Microsoft.Insights/activityLogAlerts"
                }
              ]
            }
          },
          "type": "Microsoft.Resources/deployments"
        }
      ]
    },
    "parameters": {
      "subscriptionId": {
        "value": "/subscriptions/xxx"
      }
    },
    "mode": "Incremental",
    "debugSetting": {
      "detailLevel": "none"
    }
  },
  "tags": {

  }
}

HTTP/2.0 201 Created Content-Length: 715 Azure-Asyncoperation: https://management.azure.com/subscriptions/xxx/resourcegroups/wt-test-rgtd/providers/Microsoft.Resources/deployments/test/operationStatuses/08584899072982870417?api-version=2020-06-01 Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Fri, 29 Mar 2024 08:06:29 GMT Expires: -1 Pragma: no-cache Strict-Transport-Security: max-age=31536000; includeSubDomains X-Cache: CONFIG_NOCACHE X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: 24185cac-6105-ed54-7d5d-5dd9da2de858 X-Ms-Ratelimit-Remaining-Subscription-Writes: 1197 X-Ms-Request-Id: 5a8ce622-acce-4f2b-8776-5817d8319a1e X-Ms-Routing-Request-Id: JAPANWEST:20240329T080630Z:5a8ce622-acce-4f2b-8776-5817d8319a1e X-Msedge-Ref: Ref A: 2979EBA9FC074CC695459B1321D30F25 Ref B: TYO201100116053 Ref C: 2024-03-29T08:06:25Z

{
  "id": "/subscriptions/xxx/resourceGroups/wt-test-rgtd/providers/Microsoft.Resources/deployments/test",
  "name": "test",
  "type": "Microsoft.Resources/deployments",
  "tags": {

  },
  "properties": {
    "templateHash": "15209968032183167622",
    "parameters": {
      "subscriptionId": {
        "type": "String",
        "value": "/subscriptions/xxx"
      }
    },
    "mode": "Incremental",
    "debugSetting": {
      "detailLevel": "None"
    },
    "provisioningState": "Accepted",
    "timestamp": "2024-03-29T08:06:28.8275937Z",
    "duration": "PT0.0000917S",
    "correlationId": "24185cac-6105-ed54-7d5d-5dd9da2de858",
    "providers": [
      {
        "namespace": "Microsoft.Resources",
        "resourceTypes": [
          {
            "resourceType": "deployments",
            "locations": [
              null
            ]
          }
        ]
      }
    ],
    "dependencies": [

    ]
  }
}

GET /subscriptions/xxx/resourcegroups/wt-test-rgtd/providers/Microsoft.Resources/deployments/test?api-version=2020-06-01 HTTP/1.1

Host: management.azure.com User-Agent: Go/go1.21.6 (amd64-linux) go-autorest/v14.2.1 Azure-SDK-For-Go/v66.0.0 resources/2020-06-01 HashiCorp Terraform/1.5.5 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/dev pid-222c6c49-1b0a-5959-a213-6608f9eb8820 X-Ms-Correlation-Request-Id: 24185cac-6105-ed54-7d5d-5dd9da2de858 Accept-Encoding: gzip: timestamp=2024-03-29T08:07:02.606Z 2024-03-29T08:07:02.900Z [DEBUG] provider.terraform-provider-azurerm: AzureRM Response for https://management.azure.com/subscriptions/xxx/resourcegroups/wt-test-rgtd/providers/Microsoft.Resources/deployments/test?api-version=2020-06-01: HTTP/2.0 200 OK Content-Length: 878 Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Fri, 29 Mar 2024 08:07:00 GMT Expires: -1 Pragma: no-cache Strict-Transport-Security: max-age=31536000; includeSubDomains X-Cache: CONFIG_NOCACHE X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: 24185cac-6105-ed54-7d5d-5dd9da2de858 X-Ms-Ratelimit-Remaining-Subscription-Reads: 11998 X-Ms-Request-Id: 5e93ec62-8d79-42c9-9890-4a7e86d8f8fb X-Ms-Routing-Request-Id: JAPANWEST:20240329T080701Z:5e93ec62-8d79-42c9-9890-4a7e86d8f8fb X-Msedge-Ref: Ref A: 64FD99D0B8124B6AAD07B48E4F232F84 Ref B: TYO201100116053 Ref C: 2024-03-29T08:07:01Z

{
  "id": "/subscriptions/xxx/resourceGroups/wt-test-rgtd/providers/Microsoft.Resources/deployments/test",
  "name": "test",
  "type": "Microsoft.Resources/deployments",
  "tags": {

  },
  "properties": {
    "templateHash": "15209968032183167622",
    "parameters": {
      "subscriptionId": {
        "type": "String",
        "value": "/subscriptions/xxx"
      }
    },
    "mode": "Incremental",
    "debugSetting": {
      "detailLevel": "None"
    },
    "provisioningState": "Succeeded",
    "timestamp": "2024-03-29T08:06:50.1294663Z",
    "duration": "PT21.3019643S",
    "correlationId": "24185cac-6105-ed54-7d5d-5dd9da2de858",
    "providers": [
      {
        "namespace": "Microsoft.Resources",
        "resourceTypes": [
          {
            "resourceType": "deployments",
            "locations": [
              null
            ]
          }
        ]
      }
    ],
    "dependencies": [

    ],
    "outputResources": [
      {
        "id": "/subscriptions/xxx/resourceGroups/wt-test-rgtd/providers/Microsoft.Insights/activityLogAlerts/test"
      }
    ]
  }
}

Environment

Terraform azurerm provider

zzhxiaofeng commented 4 months ago

@vukelich Please help have a look, thank you.