Create and bind the custom domain contains special Unicode character in App Service Using Azure CLI
Published Apr 17 2023 10:04 PM 2,954 Views
Microsoft

Overview :

 

Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile back ends. 

 

Azure App Service provides a highly scalable, self-patching web hosting service. This blog shows you how to create and map the custom Domain Name System (DNS) name contains a special unicode character to App Service using Azure CLI.

 

Problem:

 

If you try to create and bind the custom domain containing special Unicode character in Azure App Service using Azure CLI with the below command it will throw the following error:

 

Azure CLI Command:

 

az appservice domain create --contact-info

                            --hostname

                            --resource-group

                            [--accept-terms]

                            [--auto-renew]

                            [--dryrun]

                            [--privacy]

                            [--tags]

 

Error Message:

 

(DeploymentFailed) At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.

Code: DeploymentFailed

Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.

Target: /subscriptions/xxxxxxxxxxxxxxxx/resourceGroups/xxxxxxx/providers/Microsoft.Resources/deployments/xxxxxxx

Exception Details:      (BadRequest) {

          "code": "BadRequest",

          "message": "The domain name 'xxxãxxxx.net' is invalid."

        }

        Code: BadRequest

        Message: {

          "code": "BadRequest",

          "message": "The domain name 'xxxxãxxxx.net' is invalid."

        }

        Target: /subscriptions/xxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxx/providers/Microsoft.Resources/deployments/domain_deploy_xxxxxx

 

Error Screenshot:

 

Guptatushar_0-1681734933293.png

 

Solution :

 

1. Convert the custom domain to puny code using Punycode converter (IDN converter), Punycode to Unicode :wrench: (punycoder.com)

 

Guptatushar_1-1681734933297.png

 

2. Create the custom domain using Punycode custom domain as below:

 

Command : az appservice domain create -g '<resourcegroupname>' --hostname '<puny code converted hostname>' --contact-info=@'contact.json' --accept-terms --verbose

 

Guptatushar_2-1681734933299.png

 

Guptatushar_7-1681735187106.png

 

 

3. To add the custom domain with the app service we can use the below command:

 

az webapp config hostname add [--hostname]

                              [--ids]

                              [--resource-group]

                              [--slot]

                              [--subscription]

                              [--webapp-name]

 

4. Make sure the newly created domain consists the DNS records as per Map existing custom DNS name - Azure App Service | Microsoft Learn.

 

5. If we try to add the puny code custom domain to the app service then we will land into the below issue:

 

Command : az webapp config hostname add --webapp-name '<App Service Name>' --resource-group '<Resource Group Name>' --hostname '<Puny Code Converted Hostname>' --verbose

 

Guptatushar_4-1681734933303.png

 

6. To bind the custom domain to the app service we need to use the custom domain contain special Unicode character as below:

 

Command: az webapp config hostname add --webapp-name '<App Service Name>' --resource-group '<Resource Group>' --hostname '<Hostname With Unicode Character>' --verbose

 

Guptatushar_5-1681734933307.png

 

7. Browse the app service using the custom domain contains special Unicode character.

 

Guptatushar_6-1681734933309.png

 

Conclusion :

 

With this solution you will be able to create and map the custom domain consisting the special Unicode character to App Service using Azure CLI.

 

References :

 

Overview - Azure App Service | Microsoft Learn

Map existing custom DNS name - Azure App Service | Microsoft Learn

az appservice domain | Microsoft Learn

az webapp config hostname | Microsoft Learn

Version history
Last update:
‎Nov 08 2023 07:05 PM
Updated by: