Oct 21 2022 05:32 AM - edited Oct 21 2022 05:37 AM
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
****@****:/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.
Oct 25 2022 01:04 AM
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 tests
Let us know.
Nov 09 2022 07:28 AM
Nov 09 2022 07:58 AM
Nov 16 2022 05:53 PM
SolutionNov 30 2022 03:17 AM
Thank you for testing this and clarifying.It indeed works but only worked when I created the csv from the Ubuntu machine, weird. I was wary about the error message and decided to create the csv from the linux box then it works.
Thank you again.