Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error adding Custom Domain to CDN

See original GitHub issue

The following Farmer program fails to deploy with the following error. I’m not sure what to do about this. If I remove the domain name the problem goes away.

Deploying ARM template (please be patient, this can take a while)...
Unhandled exception. System.Exception: Azure Error: InvalidTemplate
Message: Deployment template validation failed: 'The template resource 'my-7e453-cdn-endpoint/my-7e453-cdn-endpointdomain' for type 'Microsoft.Cdn/profiles/endpoints/customDomains' at line '69' and column '62' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see for usage details.'.
  let storageAcc = storageAccount {
    name "my7e453storage"
    sku Storage.Sku.Standard_LRS
    use_static_website "/path/to/content" "index.html"

  let cdnProfile = cdn {
    name ("my7e453-cdn")
    add_endpoints [
      (endpoint {
        name ("my-7e453-cdn-endpoint")
        origin (storageAcc.WebsitePrimaryEndpoint |> System.Uri).Host
        optimise_for Cdn.OptimizationType.GeneralWebDelivery
        custom_domain_name ""

  // Generate the ARM template
  arm { 
    location Location.UKSouth
    add_resource storageAcc
    add_resource cdnProfile

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

TheRSPcommented, Nov 4, 2020

Sorry it took me so long to respond. The stated change is much nicer. Thank you

isaacabrahamcommented, Nov 4, 2020

BTW if in the short term you want to fix the ARM templates generated, it’s just going to be the Custom Domain name in the template - you’ll need to prefix the path with the profile name e.g. in the example above, “my7e453-cdn/”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot map custom domain to CDN endpoint
I have a DNS Zone and have added a CNAME record that maps to my Azure CDN Endpoint resource. It created the verify...
Read more >
Unable to map custom domain name to CDN endpoint
Hi there, I created a DNS zone for a subdomain and added those NS records to the root domain I have in...
Read more >
Adding custom domain to second CDN endpoint fails #30112
After I have added "" to the first endpoint and go to add it to the second I get the following error:
Read more >
Unable to access CDN endpoint via custom subdomain
When I skip the cdnverify step, e.g. assign the azureedge CNAME value directly to a host called “v2”, and add that as a...
Read more >
Error enabling custom https on CDN custom domain
This occurs via the CLI ( az cdn custom-domain enable-https ) and through the web portal. We have digicert set up as an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found