manifests/collectors/AI/OpenAIAccounts.psd1

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

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = '$_.KIND -eq ''OpenAI'''

    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' }
 
            # Private endpoints
            $peCount = if ($data.privateEndpointConnections) { @($data.privateEndpointConnections).Count } else { 0 }
'@


    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 = 'Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'SKU'
            Expression = 'if ($1.SKU.name) { $1.SKU.name } else { ''N/A'' }'
        }
        @{
            Name = 'Endpoint'
            Expression = 'if ($data.endpoint) { $data.endpoint } else { ''N/A'' }'
        }
        @{
            Name = 'Custom Subdomain'
            Expression = 'if ($data.customSubDomainName) { $data.customSubDomainName } else { ''N/A'' }'
        }
        @{
            Name = 'Public Network Access'
            Expression = 'if ($data.publicNetworkAccess) { $data.publicNetworkAccess } else { ''N/A'' }'
        }
        @{
            Name = 'Private Endpoints'
            Expression = '$peCount'
        }
        @{
            Name = 'Network ACL Default'
            Expression = 'if ($data.networkAcls.defaultAction) { $data.networkAcls.defaultAction } else { ''N/A'' }'
        }
        @{
            Name = 'Disable Local Auth'
            Expression = 'if ($data.disableLocalAuth -eq $true) { ''Yes'' } else { ''No'' }'
        }
        @{
            Name = 'Provisioning State'
            Expression = 'if ($data.provisioningState) { $data.provisioningState } else { ''N/A'' }'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'OpenAI Accounts'
        TableNamePrefix = 'OpenAIAccountsTable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'Location'
            'SKU'
            'Endpoint'
            'Custom Subdomain'
            'Public Network Access'
            'Private Endpoints'
            'Network ACL Default'
            'Disable Local Auth'
            'Provisioning State'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @(
            'New-ConditionalText -ConditionalType ContainsText ''Succeeded'' -ConditionalTextColor ([System.Drawing.Color]::FromArgb(0,176,80)) -BackgroundColor ([System.Drawing.Color]::White)'
            'New-ConditionalText -ConditionalType ContainsText ''Failed'' -ConditionalTextColor ([System.Drawing.Color]::White) -BackgroundColor ([System.Drawing.Color]::Red)'
        )
    }

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