Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
Hi Anilkumar,
Current versions of Azure portal Create Web App wizard always use Secure Unique Default Hostname with TenantReuse option. The important thing to understand is the name you enter must be unique for the region you select. In other words, the name (not including hash) must not currently be in use in that region.
If the name you enter is already in use, you will see error similar to "The app name <name> is not available in <region>" or "The app name <name> is not available" and no hash will be displayed. Obviously the first version of the error text is more clear, but both versions of the text mean that the name is already taken in that region. Please see screenshot below:
To illustrate let's walk through example:
- Someone creates a Web App named "contoso" with Secure Unique Default Hostname in West US, via portal, which results in auto-generated URL of contoso-eh7dcgxrmdkpw9xz-westus-01.azurewebsites.net
- Another person (different tenant than #1) attempts to create Web App named "contoso" with Secure Unique Default Hostname in West US, via portal, but gets "The app name contoso is not available in West US". This error is expected since "contoso" has already been taken in region West US by tenant in #1
- The first person deletes their contoso web app in West US
- The second person again attempts to create Web App named "contoso" with Secure Unique Default Hostname in West US, via portal, which succeeds and results in auto-generated URL of contoso-dg4jcnrush92asxn-westus-01.azurewebsites.net. Notice that the hash is different than the first person's--this is expected behavior.
Below is key excerpt from Unique Default Name article regarding regional uniqueness requirement:
How does the region in the unique default hostname work
The region in the unique default hostname would be based on the region where the site is located. Since the unique default hostname is now regionalized, you will be able to create a site called “test” in different regions. The site name however still must be regionally unique, which means that there can only be one site called “test” in East US regardless if they have different hash values.
...
With the above in mind, answers to your questions below:
Q-(a): What determines whether Azure uses the traditional name.azurewebsites.net format versus the new name-<hash>.<location>.azurewebsites.net format?
A-(a): The portal wizard always uses the new name-<hash>.<location>.azurewebsites.net format, however, if the name you enter is unavailable in the selected region, it doesn't display the generated hash and suffix since deployment would fail anyway. The hash is generated, just not shown in the user interface.
The portal wizard used to give the option to use Secure Unique Default Hostname or original behavior, but that was recently removed.
Q-(b): Why does Azure add the suffix for some available names but not for others?
A-(b): As mentioned above, if the name isn't available in the selected region, it doesn't show the hash and suffix. In terms of clarity, I'm unsure if it would be more/less confusing if they showed hash and suffix along with error message. Either way the result is the same--you can't create the web app since the name is already taken in the region.
Q-(c): Is the suffix related to the availability of the original *.azurewebsites.net hostname, or is there another internal rule/algorithm that determines when it is applied?
A-(c): No, the suffix isn't related to availability of original *.azurewebsite.net hostname.
Q-(d): Is there any Microsoft documentation that explains the logic behind this hostname generation?
A-(d): The article I linked to above explains part of it, but doesn't cover peculiarities of portal wizard.
SPECIAL THANKS to MVP Andreas Baumgarten for helping verify various scenarios and providing technical input.
Please click Accept Answer and upvote if the above was helpful.
Thanks.
-TP