manifests/collectors/Web/APPServices.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Web/APPServices.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.web/sites'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
                $sub1 = $SUB | Where-Object { $_.id -eq $1.subscriptionId }
                $data = $1.PROPERTIES
                $Retired = Foreach ($Retirement in $Retirements)
                    {
                        if ($Retirement.id -eq $1.id) { $Retirement }
                    }
                if ($Retired)
                    {
                        $RetiredFeature = foreach ($Retire in $Retired)
                            {
                                $RetiredServiceID = $Unsupported | Where-Object {$_.Id -eq $Retired.ServiceID}
                                $tmp0 = [pscustomobject]@{
                                        'RetiredFeature' = $RetiredServiceID.RetiringFeature
                                        'RetiredDate' = $RetiredServiceID.RetirementDate
                                    }
                                $tmp0
                            }
                        $RetiringFeature = if (@($RetiredFeature.RetiredFeature).count -gt 1) { $RetiredFeature.RetiredFeature | ForEach-Object { $_ + ' ,' } }else { $RetiredFeature.RetiredFeature}
                        $RetiringFeature = [string]$RetiringFeature
                        $RetiringFeature = if ($RetiringFeature -like '* ,*') { $RetiringFeature -replace ".$" }else { $RetiringFeature }
 
                        $RetiringDate = if (@($RetiredFeature.RetiredDate).count -gt 1) { $RetiredFeature.RetiredDate | ForEach-Object { $_ + ' ,' } }else { $RetiredFeature.RetiredDate}
                        $RetiringDate = [string]$RetiringDate
                        $RetiringDate = if ($RetiringDate -like '* ,*') { $RetiringDate -replace ".$" }else { $RetiringDate }
                    }
                else
                    {
                        $RetiringFeature = $null
                        $RetiringDate = $null
                    }
                if([string]::IsNullOrEmpty($data.siteConfig.ftpsState)){$FTPS = $false}else{$FTPS = $data.siteConfig.ftpsState}
                if([string]::IsNullOrEmpty($data.Properties.SiteConfig.acrUseManagedIdentityCreds)){$MGMID = $false}else{$MGMID = $true}
                $VNET = if(![string]::IsNullOrEmpty($data.virtualNetworkSubnetId)){(Get-AZSCIdSegment -Id $data.virtualNetworkSubnetId -Index 8)}else{$null}
                $SUBNET = if(![string]::IsNullOrEmpty($data.virtualNetworkSubnetId)){(Get-AZSCIdSegment -Id $data.virtualNetworkSubnetId -Index 10)}else{$null}
                $Stack = if(![string]::IsNullOrEmpty($data.SiteConfig.linuxFxVersion)){$data.SiteConfig.linuxFxVersion}else{$data.SiteConfig.windowsFxVersion}
                $Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'}
'@


    AdditionalRowLoops = @(
        @{
            Variable = '2'
            Source = '$data.hostNameSslStates'
            # AB#6845: `hostNameSslStates` supplies three columns; the app service's plan, state,
            # runtime, HTTPS-only setting and tags all come from the row itself. An app whose
            # payload omits it -- a slot, or an app still provisioning -- was dropped from the
            # worksheet entirely.
            EmitNullWhenEmpty = $true
            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 = 'Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'SKU'
            Expression = '$data.sku'
        }
        @{
            Name = 'Retiring Feature'
            Expression = '$RetiringFeature'
        }
        @{
            Name = 'Retiring Date'
            Expression = '$RetiringDate'
        }
        @{
            Name = 'App Type'
            Expression = '$1.KIND'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'zoneRedundant'
            Expression = '$data.zoneRedundant'
        }
        @{
            Name = 'maximumNumberOfZones'
            Expression = '$data.maximumNumberOfZones'
        }
        @{
            Name = 'currentNumberOfZonesUtilized'
            Expression = '$data.currentNumberOfZonesUtilized'
        }
        @{
            Name = 'Enabled'
            Expression = '$data.enabled'
        }
        @{
            Name = 'State'
            Expression = '$data.state'
        }
        @{
            Name = 'Client Cert Enabled'
            Expression = '$data.clientCertEnabled'
        }
        @{
            Name = 'Client Cert Mode'
            Expression = '$data.clientCertMode'
        }
        @{
            Name = 'Content Availability State'
            Expression = '$data.contentAvailabilityState'
        }
        @{
            Name = 'Runtime Availability State'
            Expression = '$data.runtimeAvailabilityState'
        }
        @{
            Name = 'HTTPS Only'
            Expression = '$data.httpsOnly'
        }
        @{
            Name = 'FTPS Only'
            Expression = '$FTPS'
        }
        @{
            Name = 'Possible Inbound IP Addresses'
            Expression = '$data.possibleInboundIpAddresses'
        }
        @{
            Name = 'Repository Site Name'
            Expression = '$data.repositorySiteName'
        }
        @{
            Name = 'Managed Identity'
            Expression = '$MGMID'
        }
        @{
            Name = 'Availability State'
            Expression = '$data.availabilityState'
        }
        @{
            Name = 'HostNames'
            Expression = '$2.Name'
        }
        @{
            Name = 'HostName Type'
            Expression = '$2.hostType'
        }
        @{
            Name = 'Stack'
            Expression = '$Stack'
        }
        @{
            Name = 'Virtual Network'
            Expression = '$VNET'
        }
        @{
            Name = 'Subnet'
            Expression = '$SUBNET'
        }
        @{
            Name = 'SSL State'
            Expression = '$2.sslState'
        }
        @{
            Name = 'Default Hostname'
            Expression = '$data.defaultHostName'
        }
        @{
            Name = 'Container Size'
            Expression = '$data.containerSize'
        }
        @{
            Name = 'Admin Enabled'
            Expression = '$data.adminEnabled'
        }
        @{
            Name = 'FTPs Host Name'
            Expression = '$data.ftpsHostName'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'App Services'
        TableNamePrefix = 'AppSvcsTable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'SKU'
            'Retiring Feature'
            'Retiring Date'
            'App Type'
            'Location'
            'zoneRedundant'
            'maximumNumberOfZones'
            'currentNumberOfZonesUtilized'
            'Enabled'
            'State'
            'Client Cert Enabled'
            'Client Cert Mode'
            'Content Availability State'
            'Runtime Availability State'
            'HTTPS Only'
            'FTPS Only'
            'Possible Inbound IP Addresses'
            'Repository Site Name'
            'Managed Identity'
            'Availability State'
            'HostNames'
            'HostName Type'
            'Stack'
            'Virtual Network'
            'Subnet'
            'SSL State'
            'Default Hostname'
            'Container Size'
            'Admin Enabled'
            'FTPs Host Name'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = 'Resource U'
        NumberFormat = '0'
        ConditionalText = @(
            'New-ConditionalText FALSE -Range N:N'
            'New-ConditionalText FALSE -Range R:R'
            'New-ConditionalText FALSE -Range S:S'
            'New-ConditionalText FALSE -Range V:V'
            'New-ConditionalText - -Range M:M -ConditionalType ContainsText'
            'New-ConditionalText -Range E2:E100 -ConditionalType ContainsText'
        )
    }

    SourceCollector = 'Modules/Public/InventoryModules/Web/APPServices.ps1'
}