Skip to content

Instantly share code, notes, and snippets.

@gerrytan
Created July 20, 2026 04:40
Show Gist options
  • Select an option

  • Save gerrytan/f2f859cd09cbdb0d9f85a6cc8ad25640 to your computer and use it in GitHub Desktop.

Select an option

Save gerrytan/f2f859cd09cbdb0d9f85a6cc8ad25640 to your computer and use it in GitHub Desktop.
Redacted Azure preflight HTTP request/response

Request:

curl -H 'content-type: application/json' \
  -H 'user-agent: HashiCorp Terraform/<redacted> (+https://www.terraform.io) terraform-provider-azapi/<redacted> pid-<redacted>' \
  -H 'x-ms-correlation-request-id: <redacted-correlation-id>' \
  -H 'authorization: Bearer <redacted-access-token>' \
  -H 'accept: application/json' \
  --compressed \
  -X POST 'https://management.azure.com/providers/Microsoft.Resources/validateResources?api-version=2020-10-01' \
  -d '{
    "provider": "Microsoft.Network",
    "type": "virtualNetworks",
    "location": "eastasia",
    "scope": "/subscriptions/<redacted-subscription-id>/resourceGroups/<redacted-resource-group>",
    "resources": [
      {
        "apiVersion": "2025-05-01",
        "name": "<redacted-resource-name>",
        "properties": {
          "addressSpace": {
            "addressPrefixes": [
              "10.0.0.0/16"
            ]
          },
          "dhcpOptions": {
            "dnsServers": []
          },
          "enableDdosProtection": false,
          "privateEndpointVNetPolicies": "Disabled",
          "subnets": [],
          "virtualNetworkPeerings": []
        }
      }
    ],
    "performPreflightWithoutRbacWriteCheck": true
  }'

Response:

HTTP/2.0 400
cache-control: no-cache
pragma: no-cache
content-length: <redacted>
content-type: application/json; charset=utf-8
expires: -1
x-ms-failure-cause: gateway
x-ms-ratelimit-remaining-tenant-writes: <redacted>
x-ms-request-id: <redacted-request-id>
x-ms-correlation-request-id: <redacted-correlation-id>
x-ms-routing-request-id: <redacted-routing-request-id>
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-cache: CONFIG_NOCACHE
x-msedge-ref: Ref A: <redacted> Ref B: <redacted> Ref C: <redacted-timestamp>
date: <redacted-date>

{
  "error": {
    "code": "ResourceValidationFailed",
    "message": "Resource validation failed, correlation id: '<redacted-correlation-id>', see details for more information.",
    "details": [
      {
        "code": "InvalidTemplateDeployment",
        "message": "The template deployment failed with error: 'Authorization failed for template resource '<redacted-resource-name>' of type 'Microsoft.Network/virtualNetworks'. The client '<redacted-client-id>' with object id '<redacted-object-id>' does not have permission to perform action 'Microsoft.Network/virtualNetworks/read' at scope '/subscriptions/<redacted-subscription-id>/resourceGroups/<redacted-resource-group>/providers/Microsoft.Network/virtualNetworks/<redacted-resource-name>'.'."
      }
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment