Blog Post

Apps on Azure Blog
2 MIN READ

Create and bind the custom domain contains special Unicode character in App Service Using Azure CLI

Guptatushar's avatar
Guptatushar
Icon for Microsoft rankMicrosoft
Apr 18, 2023

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:

 

 

Solution :

 

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

 

 

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

 

 

 

 

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

 

 

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

 

 

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

 

 

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

Updated Nov 09, 2023
Version 2.0
No CommentsBe the first to comment