Forum Discussion
WilliamBonomo
Oct 21, 2022Brass Contributor
Frontdoor Custom Domain in Bulk
Hi Everyone.
We are on the brink of migrating our onprem workload to Azure AKS.
We have hundreds of clients and every client has its own subdomain p.e client1.contoso.com.
To avoid unexpected overload we'll migrate them in batches and for that, we'll need to create custom domains on Azure Frondoor to forward the clients included in those batches to the correct cluster. The batches are composed of 40-50 clients and creating these custom domains one by one would be a pain.
I wrote a bash loop to create the custom domains from a csv file using the following command, which works fine when creating only one domain but it doesn't if I edit it for the loop.
az afd custom-domain create -g rg-test-frontdoor --custom-domain-name client1-contoso-com --profile-name FrontDoor01 --host-name client1.contoso.com --minimum-tls-version TLS12 --certificate-type ManagedCertificate --no-wait
The loop:
#! /bin/bash
while IFS="," read -r domainName domainHost
do
az afd custom-domain create -g rg-test-frontdoor --custom-domain-name $domainName --profile-name FrontDoor01 --host-name $domainHost --minimum-tls-version TLS12 --certificate-type ManagedCertificate --no-wait
echo "Creating: $domainName, $domain"
echo ""
done < <(tail -n +2 domains1.csv)
And my test CSV:
domainName,domainHost
client1-contoso-com,client1.contoso.com
client2-contoso-com,client2.contoso.com
Running the above bash script as createDomains.sh I get the following:
****@****:/mnt/c/scripts/FrondoorCSV$ ./createdomains.sh
Command group 'afd' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
'. dRequest) Property 'AfdDomain.HostName' cannot be set to 'client1.contoso.com
Code: BadRequest
'. sage: Property 'AfdDomain.HostName' cannot be set to 'client1.contoso.com
Creating: client1-contoso-com, client1.contoso.com
Command group 'afd' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
'. dRequest) Property 'AfdDomain.HostName' cannot be set to 'client2.contoso.com
Code: BadRequest
'. sage: Property 'AfdDomain.HostName' cannot be set to 'client2.contoso.com
Creating: client2-contoso-com, client2.contoso.com
Any ideas on how can I make it work, or a workaround for this massive job?
I'd need something to automate the TXT record to DNS zone but this is in the second plan.
Thank you in advance, Will.
- Hello,
Sorry for the delay of my answer.
I used the following configuration:
- VM based on Ubuntu 20.04
- Frond Door Standard pricing tier
The content of my csv file is:
domainName,domainHost
domain1,www.amo02160-1.com
domain3,www.amo02160-3.com
domain5,www.amo02160-5.com
domain7,www.amo02160-7.com
I tried with your csv content and I have no issue to create the domains on my AFD.
Let me know.
- arnaud_grow-unaBrass Contributor
Hello,WilliamBonomo
Do you have the same issue when you're launching the command manually?
Do you have the same bahavior when you're launching the script with only 1 custom domain?I tried on my side with your script and csv and it works well.
For your information I used a Standard AFD during my testsLet us know.
- WilliamBonomoBrass ContributorCan I also ask you how your CSV looks like?
- arnaud_grow-unaBrass ContributorHello,
Sorry for the delay of my answer.
I used the following configuration:
- VM based on Ubuntu 20.04
- Frond Door Standard pricing tier
The content of my csv file is:
domainName,domainHost
domain1,www.amo02160-1.com
domain3,www.amo02160-3.com
domain5,www.amo02160-5.com
domain7,www.amo02160-7.com
I tried with your csv content and I have no issue to create the domains on my AFD.
Let me know.
- WilliamBonomoBrass ContributorHi,
Thanks for getting back to me.
Yes if I run the command manually it works fine.
Same behavior if running with only one customer domain.
Can I ask you what OS are you using the CLI? I've tried on two different Ubuntu machines.