# Retrieves logical-to-physical availability zone mappings for all accessible subscriptions. # Filters the output for 'westeurope' region and exports results to a CSV file. # Fetch all available subscriptions $azSubscriptions = Get-AzSubscription # Collect availability zone mappings $zoneMappingsReport = foreach ($subscription in $azSubscriptions) { $apiResponse = Invoke-AzRestMethod -Method GET -Path "/subscriptions/$($subscription.Id)/locations?api-version=2022-12-01" $regions = ($apiResponse.Content | ConvertFrom-Json).value | Where-Object { $_.availabilityZoneMappings -ne $null } foreach ($region in $regions) { foreach ($zoneMapping in $region.availabilityZoneMappings) { [PSCustomObject]@{ SubscriptionName = $subscription.Name SubscriptionID = $subscription.Id Region = $region.name LogicalZone = $zoneMapping.logicalZone PhysicalZone = $zoneMapping.physicalZone } } } } # Filter results for 'westeurope' region and export to CSV $zoneMappingsReport | Where-Object { $_.Region -eq "westeurope" } | Export-Csv -Path "export.csv" -NoTypeInformation -Force