Posts tagged ‘Get-AzureVM’

Q: How to get Azure VM external IP address ( if you not use PublicIP service ) ?

A:  If you’re not using ReservedIP service field PublicIP will be empty ( as soon as there’s no reserved IP ) for command Get-AzureVM. I using Swtich-AzureMode just in case to be sure that we’re in right Azure mode in powershell right now.

PS C:\> Switch-AzureMode -Name AzureServiceManagement
PS C:\> Get-AzureVM

ServiceName                             Name                                    Status
———–                             —-                                    ——
abokov-jelastic                         abokov-jelastic                         ReadyRole

PS C:\> Get-AzureVM -ServiceName "abokov-jelastic" | Select-object  Name, DNSName, *IP*

Name                    : abokov-jelastic
DNSName                 :
IpAddress               :
PublicIPAddress         :
PublicIPName            :
PublicIPDomainNameLabel :
PublicIPFqdns           : {}
OperationDescription    : Get-AzureVM


You may see that this VM have DNS name, internal IP, but public IP is empty, nevertheless that there’s is an external IP address which is linked to that VM. To get external IP you may use command Get-AzureEndPoint which returns all information about all endpoints for that cloud service – in my case I have 7 open ports and to make this more readable I select only few fields from output.

PS C:\> Get-AzureVM -ServiceName "abokov-jelastic" | Get-AzureEndPoint | Select-Object Name, Port , *ip*

Name Port Vip VirtualIPName
—- —- — ————-
dns-TCP 53
dns-UDP 53
http 80
http4848 4848
https 443
https4949 4949
ssh 22