繁体   English   中英

Azure Powershell-如何从VM获取FQDN?

[英]Azure powershell - how to get FQDN from a VM?

我正在自动化几个Azure VM的部署,并且我想将WinRM集成到每个Azure VM中以完成部署。 如何从创建虚拟机的脚本中找到虚拟机的FQDN?

我在找:

$psVirtualMachine = Add-AzureRmVMNetworkInterface -VM $psVirtualMachine -Id $Nic.Id

$CreateNewVM = New-AzureRMVM -ResourceGroupName $ResourceGroupName -Location $GeoLocation -VM $psVirtualMachine

Enter-PSSession -ConnectionUri https://<-- $CreateNewVM.FQDN -->:5986 -Credential $Cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck) -Authentication Negotiate

如何从创建虚拟机的脚本中找到虚拟机的FQDN?

默认情况下,Azure不会为Azure VM创建FQDN,我们可以使用Powershell设置公共IP地址设置来为Azure VM设置FQDN。

我们可以使用以下命令获取FQDN:

$FQDN = (Get-AzureRmPublicIpAddress -Name 'name of public IP' -ResourceGroupName jasonvm).DnsSettings.Fqdn

像这样:

PS C:\Users> (Get-AzureRmPublicIpAddress -Name 'jasonvm-ip' -ResourceGroupName jasonvm).DnsSettings.Fqdn
jasontest321.japaneast.cloudapp.azure.com

要为Azure VM设置FQDN,我们可以使用此Powershell

New-AzureRmPublicIpAddress  -Name -ResourceGroupName -Location -DomainNameLabel

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM