title | description | services | author | ms.service | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|
Set up an apex domain with Azure DNS in Azure Static Web Apps |
Configure the root domain with Azure DNS in Azure Static Web Apps |
static-web-apps |
craigshoemaker |
static-web-apps |
how-to |
02/11/2022 |
cshoe |
Domain names without a subdomain are known as apex or root domains. For example, the domain www.example.com
is the www
subdomain joined with the example.com
apex domain.
This guide demonstrates how to use TXT
and ALIAS
records to configure your apex domain in Azure DNS.
The following procedure requires you to copy settings from an Azure DNS zone you create and your existing static web app. Consider opening the Azure portal in two different windows to make it easier to switch between the two services.
-
Open the Azure portal.
-
Navigate to your static web app.
-
Under Settings, select Custom domains.
-
Select the + Add button.
-
In the Enter domain tab, enter your apex domain name.
For instance, if your domain name is
example.com
, enterexample.com
into this box (without any subdomains). -
Select the Next button.
-
In the Validate + Configure tab, enter the following values.
Setting Value Domain name This value should match the domain name you entered in the previous step. Hostname record type Select TXT. -
Select the Generate code button.
Wait as the code is generated. It make take a minute or so to complete.
-
Once the
TXT
record value is generated, select the copy button (next to the generated value) to copy the code to the clipboard. -
Select the Close button.
-
Navigate to your Azure DNS zone instance.
-
Select the + Record set button.
-
Enter the following values in the Add record set window.
Setting Property Name Enter @ Type Select TXT - Text record type. TTL Keep default value. TTL unit Keep default value. Value Paste in the TXT
record value in your clipboard from your static web app. -
Select the OK button.
-
Return to your static web app in the Azure portal.
-
Under Settings, select Custom domains.
Observe the Status for the row of your apex domain. Once the validation is complete, then your apex domain will be publicly available.
While this validation is running, create an ALIAS record to finalize the configuration.
-
Return to the Azure DNS zone in the Azure portal.
-
Select the + Record set button button.
-
Enter the following values in the Add record set window.
Setting Property Name Enter @ Type Select A - Alias to IPv4 address Alias record set Select Yes. Alias type Select Azure resource Choose a subscription Select your Azure subscription. Azure resource Select the name of your static web app. TTL Keep default value. TTL unit Keep default value. -
Select the OK button.
-
Open a new browser tab and navigate to your apex domain.
After the DNS records are updated, you should see your static web app in the browser. Also, inspect the location to verify that your site is served securely using
https
.
[!div class="nextstepaction"] Manage the default domain