URGENT!! How to extract report of all Azure VMs in a subscription with Dynamic Private IP addresses?

Sam Turner 1 Reputation point


I need to extract a report of all Azure VMs that have been assigned Dynamic private IP addresses in a subscription. Please help how can I achieve it?


Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,283 questions
{count} votes

1 answer

Sort by: Most helpful
  1. prmanhas-MSFT 17,891 Reputation points Microsoft Employee

    @Sam Turner Can you check if the below script mentioned here solves your query:

    $vms = get-azvm
    $nics = get-aznetworkinterface | where VirtualMachine -NE $null #skip Nics with no VM

    foreach($nic in $nics)
    $vm = $vms | where-object -Property Id -EQ $nic.VirtualMachine.id
    $prv = $nic.IpConfigurations | select-object -ExpandProperty PrivateIpAddress
    $alloc = $nic.IpConfigurations | select-object -ExpandProperty PrivateIpAllocationMethod
    if ($vm.Name -NE $null) {
    Write-Output "$($vm.Name) : $prv , $alloc"

    This article might be helpful too.

    Hope it helps!!!

    Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as convenient to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.

    1 person found this answer helpful.
    0 comments No comments