manifests/collectors/Integration/APIM.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Integration/APIM.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.apimanagement/service' ) ResourceTypeMatching = 'Grouped' AdditionalFilter = $null FilterPreamble = '' RowLoopVariable = '1' Preamble = @' $ResUCount = 1 $sub1 = $SUB | Where-Object { $_.id -eq $1.subscriptionId } $data = $1.PROPERTIES $Retired = Foreach ($Retirement in $Retirements) { if ($Retirement.id -eq $1.id) { $Retirement } } 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 } # AB#6839: the original guarded only on virtualNetworkType -eq 'None'. An APIM # instance that is not VNet-injected omits `virtualNetworkType` ENTIRELY rather # than reporting 'None', so this took the else branch and called .split() on $null # -- "You cannot call a method on a null-valued expression" -- and the whole APIM # worksheet was lost. Guarding on the value actually being read is the fix; the # 'None' test is kept so behaviour is unchanged for instances that do report it. # Hand-patched, not regenerated: the source collector this was lifted from was # retired in v3.0.0, so there is nothing left to regenerate from. if ($data.virtualNetworkType -eq 'None' -or [string]::IsNullOrEmpty($data.virtualNetworkConfiguration.subnetResourceId)) { $NetType = '' } else { $NetType = [string](Get-AZSCIdSegment -Id $data.virtualNetworkConfiguration.subnetResourceId -Index 8) } $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 = 'SKU' Expression = '$1.sku.name' } @{ Name = 'Sku Capacity' Expression = '$1.sku.capacity' } @{ Name = 'Retiring Feature' Expression = '$RetiringFeature' } @{ Name = 'Retiring Date' Expression = '$RetiringDate' } @{ Name = 'Gateway URL' Expression = '$data.gatewayUrl' } @{ Name = 'Virtual Network Type' Expression = '$data.virtualNetworkType' } @{ Name = 'Virtual Network' Expression = '$NetType' } @{ Name = 'Http2' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2"' } @{ Name = 'Backend SSL 3.0' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30"' } @{ Name = 'Backend TLS 1.0' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10"' } @{ Name = 'Backend TLS 1.1' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11"' } @{ Name = 'Triple DES' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168"' } @{ Name = 'Client SSL 3.0' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30"' } @{ Name = 'Client TLS 1.0' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10"' } @{ Name = 'Client TLS 1.1' Expression = '$data.customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11"' } @{ Name = 'Public IP' Expression = '[string]$data.publicIPAddresses' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'APIM' TableNamePrefix = 'APIMTable_' Columns = @( 'Subscription' 'Resource Group' 'Name' 'Location' 'SKU' 'Sku Capacity' 'Retiring Feature' 'Retiring Date' 'Gateway URL' 'Virtual Network Type' 'Virtual Network' 'Http2' 'Backend SSL 3.0' 'Backend TLS 1.0' 'Backend TLS 1.1' 'Triple DES' 'Client SSL 3.0' 'Client TLS 1.0' 'Client TLS 1.1' 'Public IP' 'Resource U' ) TagColumns = @( 'Tag Name' 'Tag Value' ) TagColumnsBefore = 'Resource U' NumberFormat = '0' ConditionalText = @( 'New-ConditionalText -Range G2:G100 -ConditionalType ContainsText' ) } SourceCollector = 'Modules/Public/InventoryModules/Integration/APIM.ps1' } |