What DNS Name Label should I give my Azure Virtual Machine?

烈酒焚心 提交于 2019-12-06 13:41:55

There is no requirement at all to either have a DNS name, or to have one that is anything to do with what you are setting up. I have a script that I use that creates one from a GUID!

This follows the usual process of assigning a setting to Azure.

  1. Get-something, assign it to a variable.
  2. Change a property of that variable, by assigning some other value.
  3. Write the change to Azure using the Set-something cmdlet.

in this case it is a little complicated since the ultimate structure we want looks like this

DnsSettings  : {
        "DomainNameLabel": "mytestdnsname",
        "Fqdn": "mytestdnsname.westeurope.cloudapp.azure.com"
               }

presuming we created an PIP like this

New-AzureRmPublicIpAddress -Name test01PIP -ResourceGroupName test01 `
                           -AllocationMethod Dynamic -Location westeurope  

The fully qualified domain name is set automatically, so we just need to set the DomainNameLabel which we do like this,

$ip =get-AzureRmPublicIpAddress -Name test01PIP -ResourceGroupName test01 [1] 
$ip.DnsSettings += @{DomainNameLabel = "mytestdnsname"}                   [2]
Set-AzureRmPublicIpAddress -PublicIpAddress $ip                           [3]

The name does not matter for your future planing to run a website on it. At this point you can use it to access the machine yourself. And in the end the machine will endup behind a loadbalancer. So the name is only for your internal use to find it beside it ip address.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!