manifests/collectors/AI/SearchServices.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/AI/SearchServices.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.search/searchservices'
    )

    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
                    }
                $pvt = if(![string]::IsNullOrEmpty($data.privateendpointconnections)){$data.privateendpointconnections}else{'0'}
                $Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'}
'@


    AdditionalRowLoops = @(
        @{
            Variable = 'pv'
            Source = '$pvt'
            Preamble = '$priv = $pv.split(''/'')[8]'
        }
    )

    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 = '$1.sku.name'
        }
        @{
            Name = 'Retiring Feature'
            Expression = '$RetiringFeature'
        }
        @{
            Name = 'Retiring Date'
            Expression = '$RetiringDate'
        }
        @{
            Name = 'Status'
            Expression = '$data.status'
        }
        @{
            Name = 'Status Details'
            Expression = '$data.statusdetails'
        }
        @{
            Name = 'Public Network Access'
            Expression = '$data.publicnetworkaccess'
        }
        @{
            Name = 'Disable Local Authentication'
            Expression = '$data.disablelocalauth'
        }
        @{
            Name = 'Hosting Mode'
            Expression = '$data.hostingmode'
        }
        @{
            Name = 'Semantic Search'
            Expression = '$data.semanticsearch'
        }
        @{
            Name = 'Encryption Compliance Status'
            Expression = '$data.encryptionwithcmk.encryptioncompliancestatu'
        }
        @{
            Name = 'Encryption Enforcement'
            Expression = '$data.encryptionwithcmk.enforcement'
        }
        @{
            Name = 'Replica Count'
            Expression = '$data.replicacount'
        }
        @{
            Name = 'Network Rule Set'
            Expression = '$data.networkruleset.bypass'
        }
        @{
            Name = 'Private Endpoint'
            Expression = '$priv'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'Search Services'
        TableNamePrefix = 'SearchTable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'SKU'
            'Retiring Feature'
            'Retiring Date'
            'Status'
            'Status Details'
            'Public Network Access'
            'Disable Local Authentication'
            'Hosting Mode'
            'Semantic Search'
            'Encryption Compliance Status'
            'Encryption Enforcement'
            'Replica Count'
            'Network Rule Set'
            'Private Endpoint'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = 'Resource U'
        NumberFormat = '0'
        ConditionalText = @(
            'New-ConditionalText -Range E2:E100 -ConditionalType ContainsText'
            'New-ConditionalText stopped -Range I:I'
            'New-ConditionalText enabled -Range K:K'
        )
    }

    SourceCollector = 'Modules/Public/InventoryModules/AI/SearchServices.ps1'
}