
In this Azure PowerShell article, we will discuss how to get the Public IP of Azure Virtual Machine using Azure PowerShell, and along with that, we will also discuss a few other topics.
Table of Contents
How to get public IP address of Azure VM using PowerShell
Well, you can easily use Azure PowerShell to retrieve the Public IP address of your Azure Virtual machine within seconds.
When you have the requirement to retrieve all the properties of your Virtual machine like name, Resource Group name, Location, ID, and many more, including the Public IP address of your Azure Virtual Machine, then you can simply execute the below Azure PowerShell cmdlet.
Get-AzPublicIpAddress -ResourceGroupName Resource Group Name | Where-Object {$_.name -like "*Virtual Machine Name*" }
Example: You can retrieve all the details of the TsInfoVM1 and get Azure VM IP address using Powershell, which belongs to the Demo123 Resource Group.
Get-AzPublicIpAddress -ResourceGroupName Demo123 | Where-Object {$_.name -like "*TsInfoVM1*" }
Once I executed the above Azure PowerShell cmdlet, I got the output as below.
Name : TsInfoVM1-ip
ResourceGroupName : Demo123
Location : eastus
Id : /subscriptions/1cdf4300-1233-4518-9c9c-feaa72a5cbd1/resourc
eGroups/Demo123/providers/Microsoft.Network/publicIPAddress
es/TsInfoVM1-ip
Etag : W/"2aaebff2-1c21-47ba-8750-9db7cd548c9a"
ResourceGuid : 0d81f214-43dc-4612-938c-353cae02a798
ProvisioningState : Succeeded
Tags :
PublicIpAllocationMethod : Dynamic
IpAddress : 20.228.214.47
PublicIpAddressVersion : IPv4
IdleTimeoutInMinutes : 4
IpConfiguration : {
"Id": "/subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd
1/resourceGroups/Demo123/providers/Microsoft.Network/networ
kInterfaces/tsinfovm1353/ipConfigurations/ipconfig1"
}
DnsSettings : null
Zones : {}
Sku : {
"Name": "Basic",
"Tier": "Regional"
}
IpTags : []
You can see it here

Now, if you want to retrieve only the Public IP address of your Azure Virtual Machine, then you can use the below Azure PowerShell cmdlet.
Retrieve only the Public IP address of your Azure Virtual Machine
Get-AzPublicIpAddress -ResourceGroupName Resource Group Name | Where-Object {$_.name -like "Virtual Machine Name" } | Select-Object { $_.IpAddress }
As an example below, the Azure PowerShell cmdlet will retrieve only the Public IP address of the TsInfoVM1 virtual machine that belongs to the Demo123 Resource Group.
Get-AzPublicIpAddress -ResourceGroupName Demo123 | Where-Object {$_.name -like "TsInfoVM1" } | Select-Object { $_.IpAddress }
Once you execute the above cmdlet, you will get the output below.
$_.IpAddress
--------------
20.228.214.47
You can see it below.

Get-AzPublicIpAddress
Get-AzPublicIpAddress is an excellent Azure PowerShell cmdlet to retrieve one or multiple Public IP addresses of the resources in a Resource Group.
Syntax: Below is the simple syntax of the Get-AzPublicIpAddress Azure PowerShell cmdlet.
Get-AzPublicIpAddress
[-Name <String>]
[-ResourceGroupName <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzPublicIpAddress -Name resource name -ResourceGroupName Resource group name
Get-AzPublicIpAddress -Name resource name*
For Example, The below Azure PowerShell cmdlet will retrieve most of the properties along with the Public IP addresses of the TsInfoVM1 under the Demo123 resource group.
Get-AzPublicIpAddress -Name TsInfoVM1-ip -ResourceGroupName Demo123
After running the above cmdlet, I got the output as below.

Or, you can also execute the cmdlet with filter conditions like below
Get-AzPublicIpAddress -Name TsInfoVM1*
If you execute the above cmdlet, you will get the output like the above.
Name : TsInfoVM1-ip
ResourceGroupName : Demo123
Location : eastus
Id : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourc
eGroups/Demo123/providers/Microsoft.Network/publicIPAddress
es/TsInfoVM1-ip
Etag : W/"f34fc0fa-8eb9-449e-bd15-ecf7ab04abb0"
ResourceGuid : 0d81f214-43dc-4612-938c-353cae02a798
ProvisioningState : Succeeded
Tags :
PublicIpAllocationMethod : Dynamic
IpAddress : 20.127.76.41
PublicIpAddressVersion : IPv4
IdleTimeoutInMinutes : 4
IpConfiguration : {
"Id": "/subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd
1/resourceGroups/Demo123/providers/Microsoft.Network/networ
kInterfaces/tsinfovm1353/ipConfigurations/ipconfig1"
}
DnsSettings : null
Zones : {}
Sku : {
"Name": "Basic",
"Tier": "Regional"
}
IpTags : []
You may also like following the articles below
- Azure PowerShell List Virtual Machines
- Get Storage Accounts Azure PowerShell
- How to access Azure VM (Virtual Machine)
Wrapping Up
Well, in this article, we have discussed how to retrieve the Public IP of Azure Virtual Machine using Azure PowerShell.

I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.