manifests/collectors/Monitor/MonitorWorkbooks.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Monitor/MonitorWorkbooks.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.insights/workbooks'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    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' }
 
            $sourceId = if ($data.sourceId) { $data.sourceId } else { 'N/A' }
            $linkedRes = if ($sourceId -ne 'N/A' -and $sourceId -ne 'azure monitor') { ($sourceId -split '/')[-1] } else { $sourceId }
'@


    AdditionalRowLoops = @()

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

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'Resource Group'
            Expression = '$1.RESOURCEGROUP'
        }
        @{
            Name = 'Workbook Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'Display Name'
            Expression = 'if ($data.displayName) { $data.displayName } else { $1.NAME }'
        }
        @{
            Name = 'Category'
            Expression = 'if ($data.category) { $data.category } else { ''N/A'' }'
        }
        @{
            Name = 'Kind'
            Expression = 'if ($1.KIND) { $1.KIND } else { ''N/A'' }'
        }
        @{
            Name = 'Source Resource'
            Expression = '$linkedRes'
        }
        @{
            Name = 'Source ID'
            Expression = '$sourceId'
        }
        @{
            Name = 'Version'
            Expression = 'if ($data.version) { $data.version } else { ''N/A'' }'
        }
        @{
            Name = 'Time Modified'
            Expression = 'if ($data.timeModified) { ([datetime]$data.timeModified).ToString("yyyy-MM-dd") } else { ''N/A'' }'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'Monitor Workbooks'
        TableNamePrefix = 'MonWorkbooksTable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Workbook Name'
            'Location'
            'Display Name'
            'Category'
            'Kind'
            'Source Resource'
            'Version'
            'Time Modified'
            'Resource U'
        )
        TagColumns = @()
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Monitor/MonitorWorkbooks.ps1'
}