
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get Azure VM DNS Name Using PowerShell
We can find the DNS name of the VM from the Azure Portal as shown below from the Azure VM Overview tab.
This DNS setting is associated with the Public IP address. To retrieve the DNS settings we first need to retrieve the Public IP details. For this example, suppose we have the Azure VM TestMachine2k16 and we need to retrieve its DNS settings (Assuming you are connected to the proper Azure account and the subscription).
$vm = Get-AzVM -VMName TestMachine2k16 $pubip = Get-AzPublicIpAddress -ResourceGroupName $vm.ResourceGroupName | where{$_.Id -match $vm.Name}
$pubip variable has the attached Public IP properties. You can retrieve the DNS name using its DNS property.
PS C:\> $pubip.DnsSettings
Output
To get the FQDN, further expand that variable.
PS C:\> $pubip.DnsSettings.fqdn automationlab.eastus2.cloudapp.azure.com
Advertisements