I have such a code:
<code># Extract zones
$Zones = az network private-dns zone list -g "rg-test-westeurope" --query '[].{Name: name}' --output json | ConvertFrom-Json
# Initialize an empty array to store record sets
$RecordSets = @()
# Iterate over each zone
foreach ($zone in $Zones) {
$zone.Name
# List record sets for the current zone and append to the array
$RecordSets += az network private-dns record-set a list -g "rg-test-westeurope" -z $zone.Name --query '[].{Zone:$zone.Name, IPv4: aRecords[0].ipv4Address, Name: name}' --output json | ConvertFrom-Json
}
</code>
<code># Extract zones
$Zones = az network private-dns zone list -g "rg-test-westeurope" --query '[].{Name: name}' --output json | ConvertFrom-Json
# Initialize an empty array to store record sets
$RecordSets = @()
# Iterate over each zone
foreach ($zone in $Zones) {
$zone.Name
# List record sets for the current zone and append to the array
$RecordSets += az network private-dns record-set a list -g "rg-test-westeurope" -z $zone.Name --query '[].{Zone:$zone.Name, IPv4: aRecords[0].ipv4Address, Name: name}' --output json | ConvertFrom-Json
}
</code>
# Extract zones
$Zones = az network private-dns zone list -g "rg-test-westeurope" --query '[].{Name: name}' --output json | ConvertFrom-Json
# Initialize an empty array to store record sets
$RecordSets = @()
# Iterate over each zone
foreach ($zone in $Zones) {
$zone.Name
# List record sets for the current zone and append to the array
$RecordSets += az network private-dns record-set a list -g "rg-test-westeurope" -z $zone.Name --query '[].{Zone:$zone.Name, IPv4: aRecords[0].ipv4Address, Name: name}' --output json | ConvertFrom-Json
}
but this part doesnt work for me: Zone:$zone.Name
How can I integrate $zone.Name in my query to have such result
<code># Convert the array of record sets into a table
$RecordSets | Format-Table -Property Zone, IPv4, Name
</code>
<code># Convert the array of record sets into a table
$RecordSets | Format-Table -Property Zone, IPv4, Name
</code>
# Convert the array of record sets into a table
$RecordSets | Format-Table -Property Zone, IPv4, Name