'Getting ip addresses from json file using powershell

I have a script to get a list of ip address in a section of a json file. If the name is equal to AzureCloud.westeurope. The name and the ips are at different levels of the json file:

enter image description here

In my script I get my Json file and ConvertFrom-Json. I search the list of names to match AzureCloud.westeurope and then want to return the list of ips that are associated with that name. I then try to return the ips if the object name is equal to AzureCloud.westeurope. But the $ips variables is empty after I run my script. What am I dong wrong?

function GetIpListForRegion {
$data = (Get-Content $output | ConvertFrom-Json)

foreach($property in $data.values.name) {
    if($property -eq "AzureCloud.westeurope") {    
        $ips = $data.values.properties.addressPrefixes | Where-Object name -eq "AzureCloud.westeurope"
        Write-Host $ips


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source