manifests/collectors/Networking/vNETPeering.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Networking/vNETPeering.ps1 (AB#5660).
# Field expressions are copied verbatim from the original collector and evaluate in an
# equivalent scope -- see docs/design/decisions/declarative-collectors.md.
# Review before trusting; regenerate rather than hand-patch if the source collector changes.
#
@{
    ResourceTypes = @(
        'microsoft.network/virtualnetworks'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = '@($_.PROPERTIES.virtualNetworkPeerings).Count -gt 0'

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
                $sub1 = $SUB | Where-Object { $_.Id -eq $1.subscriptionId }
                $data = $1.PROPERTIES
                $Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'}
'@


    AdditionalRowLoops = @(
        @{
            Variable = '2'
            Source = '$data.addressSpace.addressPrefixes'
            Preamble = ''
        }
        @{
            Variable = '4'
            Source = '$data.virtualNetworkPeerings'
            Preamble = ''
        }
        @{
            Variable = '5'
            Source = '$4.properties.remoteAddressSpace.addressPrefixes'
            Preamble = ''
        }
    )

    TagLoop = @{
        Variable = 'Tag'
        Source = '$Tags'
        Preamble = ''
    }

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'Resource Group'
            Expression = '$1.RESOURCEGROUP'
        }
        @{
            Name = 'VNET Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'Zone'
            Expression = '$1.ZONES'
        }
        @{
            Name = 'Address Space'
            Expression = '$2'
        }
        @{
            Name = 'Peering Name'
            Expression = '$4.name'
        }
        @{
            Name = 'Peering VNet'
            Expression = '$4.properties.remoteVirtualNetwork.id.split(''/'')[8]'
        }
        @{
            Name = 'Peering State'
            Expression = '$4.properties.peeringState'
        }
        @{
            Name = 'Peering Use Remote Gateways'
            Expression = '$4.properties.useRemoteGateways'
        }
        @{
            Name = 'Peering Allow Gateway Transit'
            Expression = '$4.properties.allowGatewayTransit'
        }
        @{
            Name = 'Peering Allow Forwarded Traffic'
            Expression = '$4.properties.allowForwardedTraffic'
        }
        @{
            Name = 'Peering Do Not Verify Remote Gateways'
            Expression = '$4.properties.doNotVerifyRemoteGateways'
        }
        @{
            Name = 'Peering Allow Virtual Network Access'
            Expression = '$4.properties.allowVirtualNetworkAccess'
        }
        @{
            Name = 'Peering Address Space'
            Expression = '$5'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'Peering'
        TableNamePrefix = 'PeeringsTable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Location'
            'Zone'
            'Peering Name'
            'VNET Name'
            'Address Space'
            'Peering VNet'
            'Peering Address Space'
            'Peering State'
            'Peering Use Remote Gateways'
            'Peering Allow Gateway Transit'
            'Peering Allow Forwarded Traffic'
            'Peering Do Not Verify Remote Gateways'
            'Peering Allow Virtual NetworkAccess'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = 'Resource U'
        NumberFormat = '0'
        ConditionalText = @(
            'New-ConditionalText disconnected -Range J:J'
        )
    }

    SourceCollector = 'Modules/Public/InventoryModules/Networking/vNETPeering.ps1'
}