Skip to content

Commit 18b04e0

Browse files
Merge pull request #319 from microsoft/3.6.5
3.6.5
2 parents 93d981f + c2db345 commit 18b04e0

17 files changed

+136
-47
lines changed

AzureResourceInventory.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'AzureResourceInventory.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '3.6.4'
15+
ModuleVersion = '3.6.5'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -33,7 +33,7 @@ Copyright = '(c) Claudio Merola. All rights reserved.'
3333
Description = 'Azure Resource Inventory - Its a Powerful tool to create EXCEL inventory from Azure Resources with low effort'
3434

3535
# Minimum version of the PowerShell engine required by this module
36-
# PowerShellVersion = ''
36+
PowerShellVersion = '7.0'
3737

3838
# Name of the PowerShell host required by this module
3939
# PowerShellHostName = ''

Modules/Private/0.MainFunctions/Start-ARIProcessOrchestration.ps1

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,29 @@ function Start-ARIProcessOrchestration {
4848

4949
<############################################################## RESOURCES PROCESSING #############################################################>
5050

51-
$JobNames = (Get-Job | Where-Object {$_.name -like 'ResourceJob_*'}).Name
52-
5351
if(![string]::IsNullOrEmpty($JobNames))
5452
{
55-
Wait-ARIJob -JobNames $JobNames -JobType 'Resource' -LoopTime 5
56-
57-
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Finished Waiting for Resource Jobs.')
58-
59-
Build-ARICacheFiles -DefaultPath $DefaultPath -ReportCache $ReportCache -JobNames $JobNames
53+
if ($Automation.IsPresent)
54+
{
55+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Waiting for Resource Jobs to Complete in Automation Mode')
56+
Get-Job | Where-Object {$_.name -like 'ResourceJob_*'} | Wait-Job
57+
}
58+
else
59+
{
60+
$JobNames = (Get-Job | Where-Object {$_.name -like 'ResourceJob_*'}).Name
61+
Wait-ARIJob -JobNames $JobNames -JobType 'Resource' -LoopTime 5
62+
}
63+
64+
if ($Automation.IsPresent)
65+
{
66+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Processing Resources in Automation Mode')
67+
}
68+
else
69+
{
70+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Finished Waiting for Resource Jobs.')
71+
}
72+
73+
Build-ARICacheFiles -DefaultPath $DefaultPath -JobNames $JobNames
6074
}
6175

6276
Write-Progress -activity 'Azure Inventory' -Status "60% Complete." -PercentComplete 60 -CurrentOperation "Completed Data Processing Phase.."

Modules/Private/1.ExtractionFunctions/Start-ARIGraphExtraction.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/Start-ARI
1212
This powershell Module is part of Azure Resource Inventory (ARI)
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.5
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
@@ -81,7 +81,7 @@ Function Start-ARIGraphExtraction {
8181
}
8282
}
8383

84-
$ExcludedTypes = "| where type !in ('microsoft.logic/workflows')"
84+
$ExcludedTypes = "| where type !in ('microsoft.logic/workflows','microsoft.portal/dashboards','microsoft.resources/templatespecs/versions','microsoft.resources/templatespecs')"
8585

8686
$GraphQuery = "resources $RGQueryExtension $TagQueryExtension $MGQueryExtension $ExcludedTypes | project id,name,type,tenantId,kind,location,resourceGroup,subscriptionId,managedBy,sku,plan,properties,identity,zones,extendedLocation$($GraphQueryTags) | order by id asc"
8787

Modules/Private/2.ProcessingFunctions/Build-ARICacheFiles.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Authors: Claudio Merola
1818
#>
1919

2020
function Build-ARICacheFiles {
21-
Param($DefaultPath, $ReportCache, $JobNames)
21+
Param($DefaultPath, $JobNames)
2222

2323
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Checking Cache Folder.')
2424

Modules/Private/2.ProcessingFunctions/Invoke-ARIAdvisoryJob.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-AR
1212
This PowerShell Module is part of Azure Resource Inventory (ARI).
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.5
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
#>
@@ -22,7 +22,7 @@ function Invoke-ARIAdvisoryJob {
2222

2323
if ($Automation.IsPresent)
2424
{
25-
Write-Output ('Starting Advisory Job')
25+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Advisory Job')
2626
Start-ThreadJob -Name 'Advisory' -ScriptBlock {
2727

2828
import-module $($args[1])

Modules/Private/2.ProcessingFunctions/Invoke-ARIPolicyJob.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-AR
1212
This PowerShell Module is part of Azure Resource Inventory (ARI).
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.5
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
#>
@@ -22,7 +22,7 @@ function Invoke-ARIPolicyJob {
2222

2323
if ($Automation.IsPresent)
2424
{
25-
Write-Output ('Starting Policy Job')
25+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Policy Job')
2626
Start-ThreadJob -Name 'Policy' -ScriptBlock {
2727

2828
import-module $($args[4])

Modules/Private/2.ProcessingFunctions/Invoke-ARISecurityCenterJob.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-AR
1212
This PowerShell Module is part of Azure Resource Inventory (ARI).
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.5
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
#>
@@ -22,7 +22,7 @@ function Invoke-ARISecurityCenterJob {
2222

2323
if ($Automation.IsPresent)
2424
{
25-
Write-Output ('Starting SecurityCenter Job')
25+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting SecurityCenter Job')
2626
Start-ThreadJob -Name 'Security' -ScriptBlock {
2727

2828
import-module $($args[2])

Modules/Private/2.ProcessingFunctions/Invoke-ARISubJob.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Invoke-AR
1212
This PowerShell Module is part of Azure Resource Inventory (ARI).
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.5
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
#>
@@ -22,7 +22,7 @@ function Invoke-ARISubJob {
2222

2323
if ($Automation.IsPresent)
2424
{
25-
Write-Output ('Starting Subscription Job')
25+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Starting Subscription Job')
2626
Start-ThreadJob -Name 'Subscriptions' -ScriptBlock {
2727

2828
import-module $($args[2])

Modules/Private/2.ProcessingFunctions/Start-ARIAutProcessJob.ps1

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Start-ARI
1212
This PowerShell Module is part of Azure Resource Inventory (ARI).
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.5
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
#>
@@ -24,13 +24,15 @@ function Start-ARIAutProcessJob {
2424
$InventoryModulesPath = Join-Path $ParentPath 'Public' 'InventoryModules'
2525
$Modules = Get-ChildItem -Path $InventoryModulesPath -Directory
2626
$NewResources = ($Resources | ConvertTo-Json -Depth 40 -Compress)
27-
$SmaResources = @{} # Initialize the hashtable to store results
27+
$JobLoop = 1
28+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+"Starting ARI Automation Processing Jobs...")
2829

2930
Foreach ($ModuleFolder in $Modules)
3031
{
3132
$ModulePath = Join-Path $ModuleFolder.FullName '*.ps1'
3233
$ModuleName = $ModuleFolder.Name
3334
$ModuleFiles = Get-ChildItem -Path $ModulePath
35+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+"Starting Job: $ModuleName")
3436

3537
Start-ThreadJob -Name ('ResourceJob_'+$ModuleName) -ScriptBlock {
3638

@@ -40,6 +42,7 @@ function Start-ARIAutProcessJob {
4042
$Resources = $($args[4]) | ConvertFrom-Json
4143
$Retirements = $($args[5])
4244
$Unsupported = $($args[10])
45+
$SmaResources = @{} # Initialize the hashtable to store results
4346

4447
Foreach ($Module in $ModuleFiles)
4548
{
@@ -58,6 +61,22 @@ function Start-ARIAutProcessJob {
5861

5962
$SmaResources
6063

61-
} -ArgumentList $ModuleFiles, $PSScriptRoot, $Subscriptions, $InTag, $NewResources, $Retirements, 'Processing', $null, $null, $null, $Unsupported -ThrottleLimit 8 | Out-Null
64+
} -ArgumentList $ModuleFiles, $PSScriptRoot, $Subscriptions, $InTag, $NewResources, $Retirements, 'Processing', $null, $null, $null, $Unsupported | Out-Null
65+
66+
if($JobLoop -eq 4)
67+
{
68+
Write-Output ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Waiting Batch Jobs')
69+
70+
Get-Job | Where-Object {$_.name -like 'ResourceJob_*'} | Wait-Job
71+
72+
$JobNames = (Get-Job | Where-Object {$_.name -like 'ResourceJob_*'}).Name
73+
74+
Start-Sleep -Seconds 5
75+
76+
Build-ARICacheFiles -DefaultPath $DefaultPath -JobNames $JobNames
77+
78+
$JobLoop = 0
79+
}
80+
$JobLoop ++
6281
}
6382
}

Modules/Private/2.ProcessingFunctions/Start-ARIProcessJob.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/2.ProcessingFunctions/Start-ARI
1212
This PowerShell Module is part of Azure Resource Inventory (ARI).
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.5
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
#>
@@ -150,7 +150,7 @@ function Start-ARIProcessJob {
150150

151151
$JobNames = (Get-Job | Where-Object {$_.name -like 'ResourceJob_*'}).Name
152152

153-
Build-ARICacheFiles -DefaultPath $DefaultPath -ReportCache $ReportCache -JobNames $JobNames
153+
Build-ARICacheFiles -DefaultPath $DefaultPath -JobNames $JobNames
154154

155155
$JobLoop = 0
156156
}

0 commit comments

Comments
 (0)