// Module included in the following assemblies:
//
// * installing/installing_azure/installing-azure-user-infra.adoc
// * installing/installing_azure_stack_hub/installing-azure-stack-hub-user-infra.adoc
// * installing/installing_azure/installing-restricted-networks-azure-user-provisioned.adoc

ifeval::["{context}" == "installing-azure-stack-hub-user-infra"]
:ash:
endif::[]

:_mod-docs-content-type: PROCEDURE
[id="installation-azure-create-dns-zones_{context}"]
= Example for creating DNS zones

[role="_abstract"]
To create the required DNS zones for a user-provisioned cluster, you can add public and private DNS zones that resolve your cluster domain. You should choose the DNS strategy that fits your scenario.

ifndef::ash[]
For this example, link:https://docs.microsoft.com/en-us/azure/dns/dns-overview[Azure's DNS solution]
is used, so you will create a new public DNS zone for external (internet)
visibility and a private DNS zone for internal cluster resolution.
endif::ash[]
ifdef::ash[]
For this example, link:https://docs.microsoft.com/en-us/azure-stack/operator/azure-stack-integrate-dns?view=azs-2102[Azure Stack Hub's datacenter DNS integration] is used, so you will create a DNS zone.
endif::ash[]

ifndef::ash[]
[NOTE]
====
The public DNS zone is not required to exist in the same resource group as the
cluster deployment and might already exist in your organization for the desired base domain. If that is the case, you can skip creating the public DNS zone; be sure the installation config you generated earlier reflects that scenario.
====
endif::ash[]

ifdef::ash[]
[NOTE]
====
The DNS zone is not required to exist in the same resource group as the
cluster deployment and might already exist in your organization for the desired base domain. If that is the case, you can skip creating the DNS zone; be sure the installation config you generated earlier reflects that scenario.
====
endif::ash[]

.Procedure

ifndef::ash[]
. Create the new public DNS zone in the resource group exported in the
`BASE_DOMAIN_RESOURCE_GROUP` environment variable:
endif::ash[]
ifdef::ash[]
* Create the new DNS zone in the resource group exported in the
`BASE_DOMAIN_RESOURCE_GROUP` environment variable:
endif::ash[]
+
[source,terminal]
----
$ az network dns zone create -g ${BASE_DOMAIN_RESOURCE_GROUP} -n ${CLUSTER_NAME}.${BASE_DOMAIN}
----
+
ifndef::ash[You can skip this step if you are using a public DNS zone that already exists.]
ifdef::ash[You can skip this step if you are using a DNS zone that already exists.]

ifndef::ash[]
. Create the private DNS zone in the same resource group as the rest of this
deployment:
+
[source,terminal]
----
$ az network private-dns zone create -g ${RESOURCE_GROUP} -n ${CLUSTER_NAME}.${BASE_DOMAIN}
----
endif::ash[]

ifeval::["{context}" == "installing-azure-user-infra"]
:!ash:
endif::[]
