question-mark
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.

webapp: Way to get 'Custom Domain Verification ID' for web app

See original GitHub issue

I need a way to get the Custom Domain Verification ID of a web app so that I can automate binding a custom host name.

image

I’ve looked through all the documentation and methods exposed on az webapp but I am unable to find a way to get the verification id which I can use to add a TXT record to an Azure DNS zone then bind the custom host name without performing the verification step manually.

This is a big hole in our environment creation process we would like to automate.

Sorry if I missed anything!

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
brandonwittwercommented, Oct 1, 2020

Building on SupriyaGangineni’s reply…

The domain verification id is the same for all app services on the same subscription. the following query gives you a list of all subscriptions you have access to.

az graph query -q "Resources | join kind=leftouter (ResourceContainers | where type=='microsoft.resources/subscriptions' | project SubName=name, subscriptionId) on subscriptionId | where type == 'microsoft.web/sites'| project vid = tostring(properties.customDomainVerificationId), SubName | distinct *"

4reactions
PabloJomercommented, Jun 21, 2021

@aarsan I want to know the same thing. Is it possible to get the id without a website? Kindly, Pablo

Nope this value can be used for app service only so which means you need a webapp/function app. Also, this value is already added as part of new SDK update change released a while back.

@panchagnula From what I can see the custom domain name verification id is unique for a subscription so two webapps within the same subscription would use the same id. In our use case it would be valuable to be able to get the id from the subscription without having to create a webapp/functionapp first. That way we could setup the infrastructure in one step and keep all our settings as code, without manual steps. I understand we could create a fake webapp to retrive the id but it seems suboptimal and is exactly the kind of thing you want to avoid with infrastructure as code. Could we open a new ticket to allow this to be retrieved some way directly from the subscription? Kindly, Pablo

I don’t understand the ask - the customDomainVerficationId can be used for AppService only so if you have a sub but no webapp resources, what is the purpose of using this DomainVerficationId - since this an AppServicePlan concept, will need a webapp resource. Sorry by design & at this point won’t be associated with Subscription alone. i.e you need atleast one webapp associated with a resource to use this.

We setup our infrastructure (functionapp & other resources) via a bicep/ARM template. In the bicep template we bind the custom hostname to the functionapp but this requires that we have already added the records with our DNS provider. Thus we a way to retrieve the record values and set these with our DNS provider before setting up our infrastructure. Since it’s not possible to get the value from the subscription alone this means we would have to create a webapp use the cli to get the id and then destroy the webapp. If we want to automate the task. Since the value is unique for the subscription alone it feels like it would be better for everyone if it could be retrieved directly from there. Or if it was possible for MS to share how the value is calculated.

Kindly, Pablo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial: Create custom Azure DNS records for a web app
In this tutorial, you learn how to create custom domain DNS records for web apps using Azure DNS.
Read more >
Add and Secure a Custom Domain on Your Azure App ...
Verifying and adding custom domain · Go to your App Service and navigate to the “Custom domain” section under “Settings”. · Click on...
Read more >
Is the Custom Domain Verification shared across an Azure ...
Adding to Cindy Pau's answer you can use the Azure CLI command to get the custom domain verification id value:
Read more >
Custom Domains in Azure Web Apps
This section discusses registering a domain name. If you already have a domain name, you can skip to the next section. Before setting...
Read more >
Add a custom domain to an Azure Web App - TechLabs
Create external DNS records · Create DNS CNAME record · Create DNS TXT record to verify domain ownership · Create DNS TXT record...
Read more >

github_iconTop Related Medium Post

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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found