Azure / azure-quickstart-templates

Azure Quickstart Templates
https://aka.ms/azqst
MIT License
14.06k stars 16.13k forks source link

Template for CDN Endpoint with Custom Domain #7154

Open stack247 opened 4 years ago

stack247 commented 4 years ago

[cdn-with-custom-domains]() - not available yet

Issue Details

Do you guys have ARM template example for CDN Profile with CDN endpoint that has custom domain?

We follow the doc laid out here: Microsoft.Cdn profiles/endpoints/customDomains template reference, but got 400 Client Error: Bad Request error message.

Template

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "variables": {
    "profileName": "test-profile",
    "endpointName": "test-endpoint",
    "skuName": "Standard_Microsoft"
  },
  "resources": [
    {
      "name": "[variables('profileName')]",
      "type": "Microsoft.Cdn/profiles",
      "location": "northcentralus",
      "apiVersion": "2019-04-15",
      "sku": {
        "name": "[variables('skuName')]"
      },
      "resources": [
        {
          "apiVersion": "2019-04-15",
          "dependsOn": [
            "[resourceId('Microsoft.Cdn/profiles', variables('profileName'))]"
          ],
          "location": "northcentralus",
          "name": "[variables('endpointName')]",
          "type": "endpoints",
          "properties": {
            "originHostHeader": "astorageaccount.a33.web.core.windows.net",
            "isHttpAllowed": true,
            "isHttpsAllowed": true,
            "queryStringCachingBehavior": "IgnoreQueryString",
            "contentTypesToCompress": [
              "text/plain",
              "text/html"
            ],
            "isCompressionEnabled": true,
            "origins": [
              {
                "name": "origin",
                "properties": {
                  "hostName": "astorageaccount.a33.web.core.windows.net"
                }
              }
            ]
          },
          "resources":[
            {
              "apiVersion": "2019-04-15",
              "name": "Custom Domain",
              "type": "customDomains",
              "properties": {
                "hostName": "custom.domain.com"
              }
            }
          ]
        }
      ]
    }
  ],
  "outputs": {
  }
}

Error

400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/<guid>/resourcegroups/test-profile/providers/Microsoft.Resources/deployments/Deployment?api-version=2018-05-01

Repro steps

  1. Save the template in a json file.
  2. Run az command to deploy the template. az group deployment create --name "Deployment" --mode Complete --resource-group such-resource-group --template-file "such-cdn.json"
MCKLMT commented 4 years ago

@stack247 Did you solved your issue?