This is a cache of https://docs.okd.io/latest/networking/networking_operators/external_dns_operator/nw-creating-dns-records-on-azure.html. It is a snapshot of the page at 2026-02-14T18:28:50.999+0000.
Creating <strong>dns</strong> records on Azure - Networking Operators | Networking | OKD 4
×

To create dns records on Microsoft Azure, use the External dns Operator. By using this Operator, you can manage external name resolution for your cluster services.

Using the External dns Operator on a Microsoft Entra Workload ID-enabled cluster or a cluster that runs in Microsoft Azure Government (MAG) regions is not supported.

Creating dns records on an Azure dns zone

To create dns records on a public or private dns zone for Azure, use the External dns Operator. The Operator manages external name resolution for your cluster.

Prerequisites
  • You must have administrator privileges.

  • The admin user must have access to the kube-system namespace.

Procedure
  1. Fetch the credentials from the kube-system namespace to use the cloud provider client by running the following command:

    $ CLIENT_ID=$(oc get secrets azure-credentials  -n kube-system  --template={{.data.azure_client_id}} | base64 -d)
    $ CLIENT_SECRET=$(oc get secrets azure-credentials  -n kube-system  --template={{.data.azure_client_secret}} | base64 -d)
    $ RESOURCE_GROUP=$(oc get secrets azure-credentials  -n kube-system  --template={{.data.azure_resourcegroup}} | base64 -d)
    $ SUBSCRIPTION_ID=$(oc get secrets azure-credentials  -n kube-system  --template={{.data.azure_subscription_id}} | base64 -d)
    $ TENANT_ID=$(oc get secrets azure-credentials  -n kube-system  --template={{.data.azure_tenant_id}} | base64 -d)
  2. Log in to Azure by running the following command:

    $ az login --service-principal -u "${CLIENT_ID}" -p "${CLIENT_SECRET}" --tenant "${TENANT_ID}"
  3. Get a list of routes by running the following command:

    $ oc get routes --all-namespaces | grep console
    Example output
    openshift-console          console             console-openshift-console.apps.test.azure.example.com                       console             https   reencrypt/Redirect     None
    openshift-console          downloads           downloads-openshift-console.apps.test.azure.example.com                     downloads           http    edge/Redirect          None
  4. Get a list of dns zones.

    1. For public dns zones, enter the following command:

      $ az network dns zone list --resource-group "${RESOURCE_GROUP}"
    2. For private dns zones, enter the following command:

      $ az network private-dns zone list -g "${RESOURCE_GROUP}"
  5. Create a YAML file, for example, external-dns-sample-azure.yaml, that defines the Externaldns object:

    Example external-dns-sample-azure.yaml file
    apiVersion: externaldns.olm.openshift.io/v1beta1
    kind: Externaldns
    metadata:
      name: sample-azure
    spec:
      zones:
      - "/subscriptions/1234567890/resourceGroups/test-azure-xxxxx-rg/providers/Microsoft.Network/dnszones/test.azure.example.com"
      provider:
        type: Azure
      source:
        openshiftRouteOptions:
          routerName: default
        type: OpenShiftRoute
    # ...

    where:

    metadata.name

    Specifies the External dns name.

    spec.zones

    Specifies the zone ID. For a private dns zone, change dnszones to privatednsZones.

    provider.type

    Specifies the provider type.

    source.openshiftRouteOptions

    Specifies the options for the source of dns records.

    routerName

    If the source type is OpenShiftRoute, you can pass the OpenShift Ingress Controller name. The External dns Operator selects the canonical hostname of that router as the target while creating the CNAME record.

    source.type

    Specifies the route resource as the source for the Azure dns records.

Troubleshooting
  1. Check the records created for the routes.

    1. For public dns zones, enter the following command:

      $ az network dns record-set list -g "${RESOURCE_GROUP}" -z "${ZONE_NAME}" | grep console
    2. For private dns zones, enter the following command:

      $ az network private-dns record-set list -g "${RESOURCE_GROUP}" -z "${ZONE_NAME}" | grep console