我应该为 Azure 虚拟机提供什么 DNS 名称标签?

use*_*704 5 dns azure windows-server-2008 azure-resource-manager

在我不断努力围绕 Azure 的新资源组模型(请参阅此处此处的先前问题)的过程中,我现在正在尝试创建一个将用作 Web 服务器的新虚拟机。

我有你的问题:

问题一:

假设我最终希望这个 VM 托管网站 woodswild.com,我应该给这个 VM 什么 DNS 名称标签?有关系吗?我所知道的只是它需要是全球唯一的。它是否需要反映我想要托管的域 (woodswild.com)?

问题二:

我什至需要设置 DNS 名称吗?

问题三:

而且,既然我已经创建了它,我还可以将 DNS 名称标签从“无”更改为某些内容吗?如果是这样,如何?

在此处输入图片说明

Mic*_*l B 5

根本不需要有一个 DNS 名称,或者有一个与您正在设置的内容有关的名称。我有一个脚本,我使用它从 GUID 创建一个!

这遵循将设置分配给 Azure 的通常过程。

  1. Get-something,将它分配给一个变量。
  2. 通过分配一些其他值来更改该变量的属性。
  3. 使用 Set-something cmdlet 将更改写入 Azure。

在这种情况下它有点复杂,因为我们想要的最终结构看起来像这样

"dnsSettings": {
   "domainNameLabel": "mytestdnsname",
   "fqdn": "mytestdnsname.westeurope.cloudapp.azure.com"
  }
Run Code Online (Sandbox Code Playgroud)

假设我们创建了这样的 PIP

New-AzureRmPublicIpAddress -Name test01PIP -ResourceGroupName test -AllocationMethod Dynamic -Location westeurope  
Run Code Online (Sandbox Code Playgroud)

完全限定域名是自动设置的,所以我们只需要像这样设置DomainNameLabel,

$ip = Get-AzureRmPublicIpAddress -Name test01PIP -ResourceGroupName test01[1] 
$ip.DnsSettings += @{DomainNameLabel = "mytestdnsname"}                   [2]
Set-AzureRmPublicIpAddress -PublicIpAddress $ip                           [3]
Run Code Online (Sandbox Code Playgroud)