- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the 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
- Related Articles
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the Azure VM username using Azure CLI in PowerShell?
- How to retrieve the Azure VM Subscription Name using PowerShell?
- How to retrieve the Azure VM NIC name using PowerShell?
- How to retrieve the Azure VM vNet name using PowerShell?
- How to get the Azure VM virtual Network and the Subnet name using PowerShell?
- How to get Azure VM activity logs using PowerShell?
- How to get the Azure VM available sizes using PowerShell?
- How to get the installed Azure VM extension using PowerShell?
- How to retrieve the Azure VM nic name using Azure CLI in PowerShell?
- How to get the available azure VM size using Azure CLI in PowerShell?
- How to get the location of the Azure VM using Azure CLI in PowerShell?
- How to get the Azure VM disk encryption settings using PowerShell?
- How to get the Azure VM disk caching settings using PowerShell?
- How to get the Azure VM storage account type using PowerShell?

Advertisements