Skip to content

Commit 60485fa

Browse files
committed
Update Azure resources
1 parent 6aaa373 commit 60485fa

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

collectors/azure/containers/Get-MonkeyAzContainer.ps1

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function Get-MonkeyAzContainer {
7979
#Get container groups
8080
$container_groups = $O365Object.all_resources | Where-Object { $_.type -eq 'Microsoft.ContainerInstance/containerGroups' }
8181
if (-not $container_groups) { continue }
82-
$all_containers = @();
82+
$all_containers = $null
8383
}
8484
process {
8585
$msg = @{
@@ -90,35 +90,34 @@ function Get-MonkeyAzContainer {
9090
Tags = @('AzureContainerInfo');
9191
}
9292
Write-Information @msg
93-
#Get all containers registries
94-
if ($container_groups) {
95-
foreach ($container in $container_groups) {
96-
#Set query
97-
$p = @{
98-
Id = $container.Id;
99-
APIVersion = $cntAPI.api_version;
100-
Verbose = $O365Object.Verbose;
101-
Debug = $O365Object.Debug;
102-
InformationAction = $O365Object.InformationAction;
103-
}
104-
$my_container = Get-MonkeyAzObjectById @p
105-
if ($my_container) {
106-
#Add container registries to array
107-
$all_containers += $my_container
108-
}
93+
If ($container_groups.Count -gt 0) {
94+
$new_arg = @{
95+
APIVersion = $cntAPI.api_version;
10996
}
97+
$p = @{
98+
ScriptBlock = { Get-MonkeyAzContainerInfo -InputObject $_ };
99+
Arguments = $new_arg;
100+
Runspacepool = $O365Object.monkey_runspacePool;
101+
ReuseRunspacePool = $true;
102+
Debug = $O365Object.VerboseOptions.Debug;
103+
Verbose = $O365Object.VerboseOptions.Verbose;
104+
MaxQueue = $O365Object.nestedRunspaces.MaxQueue;
105+
BatchSleep = $O365Object.nestedRunspaces.BatchSleep;
106+
BatchSize = $O365Object.nestedRunspaces.BatchSize;
107+
}
108+
$all_containers = $container_groups | Invoke-MonkeyJob @p
110109
}
111110
}
112-
end {
113-
if ($all_containers) {
111+
End {
112+
If ($all_containers) {
114113
$all_containers.PSObject.TypeNames.Insert(0,'Monkey365.Azure.Containers')
115114
[pscustomobject]$obj = @{
116115
Data = $all_containers;
117116
Metadata = $monkey_metadata;
118117
}
119118
$returnData.az_containers = $obj
120119
}
121-
else {
120+
Else {
122121
$msg = @{
123122
MessageData = ($message.MonkeyEmptyResponseMessage -f "Azure Containers",$O365Object.TenantID);
124123
callStack = (Get-PSCallStack | Select-Object -First 1);

0 commit comments

Comments
 (0)