manifests/collectors/Containers/ContainerRegistries.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Containers/ContainerRegistries.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.containerregistry/registries' ) ResourceTypeMatching = 'Grouped' AdditionalFilter = $null FilterPreamble = '' RowLoopVariable = '1' Preamble = @' $ResUCount = 1 # An EMPTY $sub1 -- subscription outside the requested scope -- is not $null, so # `.Name` on it throws; and `creationDate` is absent on older registry API # versions, where [datetime]$null then yielded a bogus 0001-01-01 (AB#5671). $sub1 = $SUB | Where-Object { $_.id -eq $1.subscriptionId } # The else arm is $null, NOT '': with StrictMode off $sub1.Name on an unmatched ($null) # $sub1 evaluated to $null, and the ~110 collectors that still read $sub1.Name directly # emit $null here. '' was a silent behaviour change -- the declarative equivalence proof # caught it on 11 collectors, and it would have been invisible on the rest (AB#5659). $SubscriptionName = if ($sub1) { @($sub1)[0].Name } else { $null } $data = $1.PROPERTIES $timecreated = Get-AZSCSafeProperty -InputObject $data -Path 'creationDate' $timecreated = if ($timecreated) { ([datetime]$timecreated).ToString("yyyy-MM-dd HH:mm") } else { '' } $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 } # An untagged resource's row OMITS `tags`; the historic '0' sentinel only made this # loop run once for that case, and `'0'.Name` throws under StrictMode. An empty tag # object does the same job and emits the identical row. $RowTags = Get-AZSCSafeProperty -InputObject $1 -Path 'tags' $TagProps = if ($null -ne $RowTags) { $RowTags.psobject.properties } else { $null } $Tags = if(![string]::IsNullOrEmpty($TagProps)){$TagProps}else{[pscustomobject]@{ Name = $null; Value = $null }} '@ AdditionalRowLoops = @() TagLoop = @{ Variable = 'Tag' Source = '$Tags' Preamble = '' } Fields = @( @{ Name = 'ID' Expression = '$1.id' } @{ Name = 'Subscription' Expression = '$SubscriptionName' } @{ Name = 'Resource Group' Expression = '$1.RESOURCEGROUP' } @{ Name = 'Name' Expression = '$1.NAME' } @{ Name = 'Location' Expression = '$1.LOCATION' } @{ Name = 'SKU' Expression = '(Get-AZSCSafeProperty -InputObject $1 -Path ''sku.name'')' } @{ Name = 'Retiring Feature' Expression = '$RetiringFeature' } @{ Name = 'Retiring Date' Expression = '$RetiringDate' } @{ Name = 'Anonymous Pull Enabled' Expression = '(Get-AZSCSafeProperty -InputObject $data -Path ''anonymouspullenabled'')' } @{ Name = 'Encryption' Expression = '(Get-AZSCSafeProperty -InputObject $data -Path ''encryption.status'')' } @{ Name = 'Public Network Access' Expression = '(Get-AZSCSafeProperty -InputObject $data -Path ''publicnetworkaccess'')' } @{ Name = 'Zone Redundancy' Expression = '(Get-AZSCSafeProperty -InputObject $data -Path ''zoneredundancy'')' } @{ Name = 'Private Link' Expression = 'if(Get-AZSCSafeProperty -InputObject $data -Path ''privateendpointconnections''){''True''}else{''False''}' } @{ Name = 'Soft Delete Policy' Expression = '(Get-AZSCSafeProperty -InputObject $data -Path ''policies.softdeletepolicy.status'')' } @{ Name = 'Trust Policy' Expression = '(Get-AZSCSafeProperty -InputObject $data -Path ''policies.trustpolicy.status'')' } @{ Name = 'Created Time' Expression = '$timecreated' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Total' Expression = '$null' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'Registries' TableNamePrefix = 'ContsTable_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'SKU' 'Retiring Feature' 'Retiring Date' 'Anonymous Pull Enabled' 'Encryption' 'Public Network Access' 'Zone Redundancy' 'Private Link' 'Soft Delete Policy' 'Trust Policy' 'Created Time' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText True -Range H:H' 'New-ConditionalText disabled -Range I:I' 'New-ConditionalText enabled -Range J:J' 'New-ConditionalText disabled -Range K:K' 'New-ConditionalText False -Range L:L' 'New-ConditionalText disabled -Range M:M' 'New-ConditionalText disabled -Range N:N' 'New-ConditionalText -Range F2:F100 -ConditionalType ContainsText' ) } SourceCollector = 'Modules/Public/InventoryModules/Containers/ContainerRegistries.ps1' } |