manifests/collectors/Security/DefenderPricing.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Security/DefenderPricing.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 = @( 'AZSC/Subscription/SecurityPolicySweep' ) ResourceTypeMatching = 'Grouped' AdditionalFilter = $null FilterPreamble = '' RowLoopVariable = '1' RowSource = @{ Expression = @' foreach ($sweep in @($Resources | Where-Object { $_.TYPE -eq 'AZSC/Subscription/SecurityPolicySweep' })) { foreach ($pricing in @($sweep.PROPERTIES.DefenderPricing)) { $pricing | Add-Member -NotePropertyName 'SubscriptionId' -NotePropertyValue $sweep.subscriptionId -Force $pricing | Add-Member -NotePropertyName 'SubscriptionName' -NotePropertyValue $sweep.subscriptionName -Force -PassThru } } '@ } Preamble = @' $ResUCount = 1 $sub1 = $SUB | Where-Object { (Get-AZSCSafeProperty -InputObject $_ -Path 'Id') -eq (Get-AZSCSafeProperty -InputObject $1 -Path 'SubscriptionId') } | Select-Object -First 1 $data = $1 # Parse plan details $planName = (Get-AZSCSafeProperty -InputObject $data -Path 'Name') $pricingTier = Get-AZSCSafeProperty -InputObject $data -Path 'PricingTier' $isEnabled = if ($pricingTier -eq 'Standard') { 'Yes' } else { 'No' } # Get extensions if applicable $extensions = @() if (Get-AZSCSafeProperty -InputObject $data -Path 'Extensions') { foreach ($ext in @(Get-AZSCSafeProperty -InputObject $data -Path 'Extensions' -Enumerate)) { $extName = (Get-AZSCSafeProperty -InputObject $ext -Path 'Name') $extEnabled = if ((Get-AZSCSafeProperty -InputObject $ext -Path 'IsEnabled') -eq 'True') { 'Enabled' } else { 'Disabled' } $extensions += "$extName ($extEnabled)" } } $extensionsStr = if ($extensions.Count -gt 0) { $extensions -join '; ' } else { 'None' } # Get deprecated status $isDeprecated = if ((Get-AZSCSafeProperty -InputObject $data -Path 'Deprecated') -eq $true) { 'Yes' } else { 'No' } # Get replaced by information $replacedByValue = Get-AZSCSafeProperty -InputObject $data -Path 'ReplacedBy' $replacedBy = if ($replacedByValue) { ($replacedByValue -join ', ') } else { 'N/A' } $freeTrialRemainingDays = 0.0 $freeTrialRemainingTime = Get-AZSCSafeProperty -InputObject $data -Path 'FreeTrialRemainingTime' if ($freeTrialRemainingTime -is [System.TimeSpan]) { $freeTrialRemainingDays = [math]::Round($freeTrialRemainingTime.TotalDays, 0) } # Friendly plan names $planFriendly = switch ($planName) { 'VirtualMachines' { 'Servers' } 'SqlServers' { 'SQL Servers on Machines' } 'AppServices' { 'App Service' } 'StorageAccounts' { 'Storage' } 'SqlServerVirtualMachines' { 'SQL Servers on VMs' } 'KubernetesService' { 'Containers (AKS)' } 'ContainerRegistry' { 'Container Registries' } 'KeyVaults' { 'Key Vault' } 'Dns' { 'DNS' } 'Arm' { 'Resource Manager' } 'OpenSourceRelationalDatabases' { 'Open-Source Databases' } 'CosmosDbs' { 'Azure Cosmos DB' } 'Containers' { 'Containers (Advanced)' } 'CloudPosture' { 'Cloud Security Posture Management (CSPM)' } default { $planName } } '@ AdditionalRowLoops = @() TagLoop = $null Fields = @( @{ Name = 'ID' Expression = 'Get-AZSCSafeProperty -InputObject $1 -Path ''Id''' } @{ Name = 'Subscription' Expression = 'Get-AZSCSafeProperty -InputObject $1 -Path ''SubscriptionName''' } @{ Name = 'Plan Name' Expression = '$planFriendly' } @{ Name = 'Plan ID' Expression = '$planName' } @{ Name = 'Pricing Tier' Expression = '$pricingTier' } @{ Name = 'Enabled' Expression = '$isEnabled' } @{ Name = 'Extensions' Expression = '$extensionsStr' } @{ Name = 'Deprecated' Expression = '$isDeprecated' } @{ Name = 'Replaced By' Expression = '$replacedBy' } @{ Name = 'Free Trial Remaining Days' Expression = '$freeTrialRemainingDays' } @{ Name = 'Portal Link' Expression = '"https://portal.azure.com/#blade/Microsoft_Azure_Security/SecurityMenuBlade/pricingTier"' } @{ Name = 'Resource U' Expression = '$ResUCount' } ) Export = @{ WorksheetName = 'Defender Pricing' TableNamePrefix = 'DefenderPricingTable_' Columns = @( 'Subscription' 'Plan Name' 'Plan ID' 'Pricing Tier' 'Enabled' 'Extensions' 'Deprecated' 'Replaced By' 'Free Trial Remaining Days' 'Portal Link' 'Resource U' ) TagColumns = @() TagColumnsBefore = $null NumberFormat = '0' ConditionalText = @( 'New-ConditionalText -Text ''Yes'' -BackgroundColor ''#C6EFCE'' -ConditionalTextColor ''#006100''' 'New-ConditionalText -Text ''No'' -BackgroundColor ''#FFC7CE'' -ConditionalTextColor ''#9C0006''' ) } SourceCollector = 'Modules/Public/InventoryModules/Security/DefenderPricing.ps1' } |