manifests/collectors/Databases/SQLMI.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Databases/SQLMI.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.sql/managedInstances'
    )

    AdditionalFilter = $null

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
                $sub1 = $SUB | Where-Object { $_.id -eq $1.subscriptionId }
                $data = $1.PROPERTIES
                $Retired = $Retirements | Where-Object { $_.id -eq $1.id }
                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
                    }
                $Tags = if(!!($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'}
 
                $pvteps = if(!($1.privateEndpointConnections)) {[pscustomobject]@{id = 'NONE'}} else {$1.privateEndpointConnections | Select-Object @{Name="id";Expression={$_.id.split("/")[8]}}}
'@


    AdditionalRowLoops = @(
        @{
            Variable = 'pvtep'
            Source = '$pvteps'
        }
    )

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'Resource Group'
            Expression = '$1.RESOURCEGROUP'
        }
        @{
            Name = 'Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'Retiring Feature'
            Expression = '$RetiringFeature'
        }
        @{
            Name = 'Retiring Date'
            Expression = '$RetiringDate'
        }
        @{
            Name = 'SkuName'
            Expression = '$1.sku.Name'
        }
        @{
            Name = 'SkuCapacity'
            Expression = '$1.sku.capacity'
        }
        @{
            Name = 'SkuTier'
            Expression = '$1.sku.tier'
        }
        @{
            Name = 'Admin Login'
            Expression = '$data.adminitrators.login'
        }
        @{
            Name = 'AzureADOnlyAuthentication'
            Expression = '$data.adminitrators.azureADOnlyAuthentication'
        }
        @{
            Name = 'Private Endpoint'
            Expression = '$pvtep.id'
        }
        @{
            Name = 'FQDN'
            Expression = '$data.fullyQualifiedDomainName'
        }
        @{
            Name = 'Public Network Access'
            Expression = '$data.publicDataEndpointEnabled'
        }
        @{
            Name = 'licenseType'
            Expression = '$data.licenseType'
        }
        @{
            Name = 'managedInstanceCreateMode'
            Expression = '$data.managedInstanceCreateMode'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Zone Redundant'
            Expression = '$data.zoneRedundant'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'SQL MI'
        TableNamePrefix = 'SQLMITable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'Location'
            'Retiring Feature'
            'Retiring Date'
            'SkuName'
            'SkuCapacity'
            'SkuTier'
            'Admin Login'
            'ActiveDirectoryOnlyAuthentication'
            'Private Endpoint'
            'FQDN'
            'Public Network Access'
            'licenseType'
            'managedInstanceCreateMode'
            'Zone Redundant'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = 'Resource U'
        NumberFormat = '0'
        ConditionalText = @(
            'New-ConditionalText FALSE -Range L:L'
            'New-ConditionalText FAUX -Range L:L'
            'New-ConditionalText NONE -Range L:L'
            'New-ConditionalText Enabled -Range N:N'
            'New-ConditionalText VRAI -Range N:N'
            'New-ConditionalText -Range E2:E100 -ConditionalType ContainsText'
        )
    }

    SourceCollector = 'Modules/Public/InventoryModules/Databases/SQLMI.ps1'
}