使用 Azure Stack Hub 中的 DNSUse DNS in Azure Stack Hub

Azure Stack Hub 支持以下 Azure DNS 功能:Azure Stack Hub supports the following Azure DNS features:

  • DNS 主机名解析。DNS hostname resolution.
  • 使用 API 创建和管理 DNS 区域和记录。Create and manage DNS zones and records using the API.

支持 DNS 主机名解析Support for DNS hostname resolution

可以为公用 IP 资源指定一个 DNS 域名标签。You can specify a DNS domain name label for public IP resources. Azure Stack Hub 使用 domainnamelabel.location.cloudapp.azurestack.external 作为标签名称并将其映射到 Azure Stack Hub 托管 DNS 服务器中的公共 IP 地址。Azure Stack Hub uses domainnamelabel.location.cloudapp.azurestack.external for the label name and maps it to the public IP address in Azure Stack Hub-managed DNS servers.

例如,如果创建一个公共 IP 资源并以 contoso 作为本地 Azure Stack Hub 位置中的域名标签,则完全限定域名 (FQDN) contoso.local.cloudapp.azurestack.external 会解析为资源的公共 IP 地址。For example, if you create a public IP resource with contoso as a domain name label in the local Azure Stack Hub location, the fully qualified domain name (FQDN) contoso.local.cloudapp.azurestack.external resolves to the public IP address of the resource. 可以使用此 FQDN 创建自定义域 CNAME 记录,该记录指向 Azure Stack Hub 中的公共 IP 地址。You can use this FQDN to create a custom domain CNAME record that points to the public IP address in Azure Stack Hub.

若要了解有关名称解析的详细信息,请参阅 DNS 解析一文。To learn more about name resolution, see the DNS resolution article.


创建的每个域名标签在其 Azure Stack Hub 位置中必须是唯一的。Each domain name label you create must be unique within its Azure Stack Hub location.

以下屏幕截图显示了使用门户创建公共 IP 地址时的“创建公共 IP 地址”对话框****:The following screenshot shows the Create public IP address dialog for creating a public IP address using the portal:

创建公共 IP 地址

示例方案Example scenario

你有一个用于处理来自 Web 应用的请求的负载均衡器。You have a load balancer processing requests from a web app. 负载均衡器的后面是一个在一台或多台虚拟机上运行的网站。Behind the load balancer is a web site running on one or more virtual machines. 可以使用 DNS 名称而非 IP 地址来访问进行了负载均衡的网站。You can access the load-balanced web site using a DNS name, instead of an IP address.

使用 API 创建和管理 DNS 区域和记录Create and manage DNS zones and records using the APIs

可以在 Azure Stack Hub 中创建和管理 DNS 区域和记录。You can create and manage DNS zones and records in Azure Stack Hub.

Azure Stack Hub 使用与 Azure DNS API 一致的 API 提供与 Azure 类似的 DNS 服务。Azure Stack Hub provides a DNS service similar to Azure, using APIs that are consistent with the Azure DNS APIs. 通过将域托管在 Azure Stack Hub DNS 中,可以使用相同的凭据、API 和工具来管理 DNS 记录。By hosting your domains in Azure Stack Hub DNS, you can manage your DNS records using the same credentials, APIs, and tools. 还可以使用与其他 Azure 服务相同的计费和支持功能。You can also use the same billing and support as your other Azure services.

Azure Stack Hub DNS 的基础结构比 Azure 的更为精简。The Azure Stack Hub DNS infrastructure is more compact than Azure. Azure Stack Hub 部署的大小和位置会影响 DNS 的范围、规模和性能。The size and location of an Azure Stack Hub deployment affects DNS scope, scale, and performance. 这还意味着性能、可用性、全局分发和高可用性可能会因部署而异。This also means that performance, availability, global distribution, and high availability can vary from deployment to deployment.

与 Azure DNS 比较Comparison with Azure DNS

Azure Stack Hub 中的 DNS 类似于 Azure 中的 DNS,但有几个重要例外:DNS in Azure Stack Hub is similar to DNS in Azure, but there are a few important exceptions:

  • 不支持 AAAA 记录:Azure Stack Hub 不支持 AAAA 记录,因为 Azure Stack Hub 不支持 IPv6 地址。Does not support AAAA records: Azure Stack Hub doesn't support AAAA records because Azure Stack Hub does not support IPv6 addresses. 这是 Azure DNS 与 Azure Stack Hub DNS 之间的主要差异。This is a key difference between DNS in Azure and Azure Stack Hub.

  • 不是多租户:Azure Stack Hub 中的 DNS 服务不是多租户服务。Is not multi-tenant: The DNS Service in Azure Stack Hub is not multi-tenant. 租户不能创建相同的 DNS 区域。Tenants cannot create the same DNS zone. 只有第一个尝试创建该区域的订阅会成功,以后的请求都会失败。Only the first subscription that attempts to create the zone succeeds, and later requests fail. 这是 Azure DNS 与 Azure Stack Hub DNS 之间另一个主要差异。This is another key difference between Azure and Azure Stack Hub DNS.

  • 标记、元数据和 Etag:Azure Stack Hub 在处理标记、元数据、Etag 和限制的方式方面也有一些细微差异。Tags, metadata, and Etags: There are minor differences in the way Azure Stack Hub handles tags, metadata, Etags, and limits.

若要了解有关 Azure DNS 的更多信息,请参阅 DNS 区域和记录To learn more about Azure DNS, see DNS zones and records.


Azure Stack Hub DNS 支持在 DNS 区域资源上使用 Azure 资源管理器标记。Azure Stack Hub DNS supports using Azure Resource Manager tags on DNS zone resources. 它不支持 DNS 记录集上的标记。It does not support tags on DNS record sets. 作为替代方法,在 DNS 记录集上支持“元数据”,如下一部分所述。****As an alternative, metadata is supported on DNS record sets, as explained in the next section.


作为记录集标记的替代方法,Azure Stack Hub DNS 支持使用“元数据”** 批注记录集。As an alternative to record set tags, Azure Stack Hub DNS supports annotating record sets using metadata. 与标记相类似,通过元数据可将名称/值对与每个记录集相关联。Similar to tags, metadata enables you to associate name-value pairs with each record set. 例如,元数据可用于记录每个记录集的用途。For example, metadata is useful to record the purpose of each record set. 与标记不同的是,不能使用元数据提供 Azure 帐单的筛选视图,且不能在 Azure 资源管理器策略中指定元数据。Unlike tags, you can't use metadata to provide a filtered view of your Azure bill, and metadata cannot be specified in an Azure Resource Manager policy.


假设两个人或两个进程尝试同时修改一条 DNS 记录。Suppose two people or two processes try to modify a DNS record at the same time. 哪一个占先?Which one wins? 占先方是否知道他们/它们覆盖了其他人/进程创建的更改?And does the winner know that they've overwritten changes created by someone else?

Azure Stack Hub DNS 使用 Etag** 来安全地处理对同一资源的并发更改。Azure Stack Hub DNS uses Etags to safely handle concurrent changes to the same resource. Etag 与 Azure 资源管理器“标记”** 不同。Etags are different from Azure Resource Manager Tags. 每个 DNS 资源(区域或记录集)都有与其相关联的 Etag。Each DNS resource (zone or record set) has an Etag associated with it. 检索资源时,还会检索其 Etag。When a resource is retrieved, its Etag is also retrieved. 更新资源时,可以选择传递回 Etag 以便 Azure Stack Hub DNS 可以验证服务器上的 Etag 是否匹配。When you update a resource, you can choose to pass back the Etag so Azure Stack Hub DNS can verify the Etag on the server matches. 由于对资源的每次更新都会导致重新生成 Etag,Etag 不匹配表示发生了并发更改。Since each update to a resource results in the Etag being regenerated, an Etag mismatch indicates a concurrent change has occurred. 创建新的资源时也可以使用 Etag,以确保该资源尚不存在。Etags can also be used when you create a new resource to ensure the resource does not already exist.

默认情况下,Azure Stack Hub DNS PowerShell cmdlet 使用 Etag 来阻止对区域和记录集的并发更改。By default, Azure Stack Hub DNS PowerShell cmdlets use Etags to block concurrent changes to zones and record sets. 可以使用可选的 -Overwrite 开关取消 Etag 检查。You can use the optional -Overwrite switch to suppress Etag checks. 如果没有 Etag 检查,则会覆盖已发生的任何并发更改。With no Etag checks, any concurrent changes that have occurred are overwritten.

Etag 是在 Azure Stack Hub DNS REST API 级别使用 HTTP 标头指定的。At the level of the Azure Stack Hub DNS REST API, Etags are specified using HTTP headers. 下表介绍了它们的行为:Their behavior is described in the following table:

标头Header 行为Behavior
None PUT 始终成功(没有 Etag 检查)。PUT always succeeds (no Etag checks).
If-matchIf-match 只有当资源存在并且 Etag 匹配时,PUT 才会成功。PUT only succeeds if resource exists and Etag matches.
If-match *If-match * 只有当资源存在时,PUT 才会成功。PUT only succeeds if resource exists.
If-none-match *If-none-match * 只有当资源不存在时,PUT 才会成功。PUT only succeeds if resource doesn't exist.


使用 Azure Stack Hub DNS 时,以下默认限制适用:The following default limits apply when using Azure Stack Hub DNS:

资源Resource 默认限制Default limit
每个订阅的区域数Zones per subscription 100100
每个区域的记录集数Record sets per zone 50005000
每个记录集的记录数Records per record set 20 个20

后续步骤Next steps