manifests/collectors/Databases/SQLDB.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Databases/SQLDB.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/servers/databases' ) ResourceTypeMatching = 'Grouped' AdditionalFilter = '$_.name -ne ''master''' FilterPreamble = '' RowLoopVariable = '1' Preamble = @' $ResUCount = 1 $sub1 = $SUB | Where-Object { $_.id -eq $1.subscriptionId } $data = $1.PROPERTIES $DBServer = $1.id.split("/")[8] $PoolId = if(![string]::IsNullOrEmpty($data.elasticPoolId)){$data.elasticPoolId.split('/')[8]}else{$null} if(![string]::IsNullOrEmpty($data.earliestrestoredate)) { $RestorePoint = [string](get-date($data.earliestrestoredate)) } else { $RestorePoint = $null } $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(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}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 = 'Retiring Feature' Expression = '$RetiringFeature' } @{ Name = 'Retiring Date' Expression = '$RetiringDate' } @{ Name = 'Database Server' Expression = '$DBServer' } @{ Name = 'Default Secondary Location' Expression = '$data.defaultSecondaryLocation' } @{ Name = 'Status' Expression = '$data.status' } @{ Name = 'Availability Zone' Expression = '$data.availabilityzone' } @{ Name = 'Earliest Restore Point' Expression = '$RestorePoint' } @{ Name = 'Min DTU Capacity' Expression = '$data.minCapacity' } @{ Name = 'DTU Capacity' Expression = '$data.currentSku.capacity' } @{ Name = 'Service Tier' Expression = '$data.currentSku.tier' } @{ Name = 'Hardware Configuration' Expression = '$data.currentsku.name' } @{ Name = 'Zone Redundant' Expression = '$data.zoneRedundant' } @{ Name = 'Catalog Collation' Expression = '$data.catalogCollation' } @{ Name = 'Read Replica Count' Expression = '$data.readReplicaCount' } @{ Name = 'Data Max Size (GB)' Expression = '(($data.maxSizeBytes / 1024) / 1024) / 1024' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'ElasticPool ID' Expression = '$PoolId' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'SQL DBs' TableNamePrefix = 'SQLDBTable_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'Retiring Feature' 'Retiring Date' 'Database Server' 'Default Secondary Location' 'Status' 'Availability Zone' 'Min DTU Capacity' 'DTU Capacity' 'Service Tier' 'Hardware Configuration' 'Data Max Size (GB)' 'Zone Redundant' 'Catalog Collation' 'Read Replica Count' 'ElasticPool ID' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText -Range E2:E100 -ConditionalType ContainsText' ) } SourceCollector = 'Modules/Public/InventoryModules/Databases/SQLDB.ps1' } |