Skip to content

Commit e04815d

Browse files
Merge pull request #390 from microsoft/3.6.12
3.6.12
2 parents 5082c0a + 2c35345 commit e04815d

13 files changed

Lines changed: 175 additions & 918 deletions

File tree

AzureResourceInventory.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Claudio Merola
55
#
6-
# Updated on: 10/06/2025
6+
# Updated on: 05/15/2026
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
RootModule = 'AzureResourceInventory.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '3.6.11'
15+
ModuleVersion = '3.6.12'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -51,7 +51,7 @@ PowerShellVersion = '7.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @('ImportExcel','Az.Accounts','Az.ResourceGraph','Az.Storage','Az.Compute')
54+
RequiredModules = @('ImportExcel','Az.Accounts','Az.ResourceGraph','Az.Storage','Az.Compute','Az.Monitor','Az.CostManagement')
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
# RequiredAssemblies = @()

Modules/Private/0.MainFunctions/Connect-ARILoginSession.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Connect-LoginSe
1212
This powershell Module is part of Azure Resource Inventory (ARI)
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.12
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
@@ -129,8 +129,10 @@ function Connect-ARILoginSession {
129129
if ($AZConfig.value -eq 'On')
130130
{
131131
Update-AzConfig -LoginExperienceV2 Off | Out-Null
132+
Update-AzConfig -EnableLoginByWam 0 | Out-Null
132133
Connect-AzAccount -Tenant $TenantID -Environment $AzureEnvironment | Out-Null
133134
Update-AzConfig -LoginExperienceV2 On | Out-Null
135+
Update-AzConfig -EnableLoginByWam 1 | Out-Null
134136
}
135137
else
136138
{

Modules/Private/0.MainFunctions/Get-ARIUnsupportedData.ps1

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,51 @@ https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Get-ARIUnsuppor
1212
This PowerShell Module is part of Azure Resource Inventory (ARI)
1313
1414
.NOTES
15-
Version: 3.6.0
15+
Version: 3.6.12
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
1919
#>
2020
function Get-ARIUnsupportedData {
21-
22-
$SupportedDataPath = (get-item $PSScriptRoot).parent
23-
$SupportFile = Join-Path $SupportedDataPath '3.ReportingFunctions' 'StyleFunctions' 'Support.json'
24-
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Validating file: '+$SupportFile)
25-
26-
$Unsupported = Get-Content -Path $SupportFile | ConvertFrom-Json
27-
28-
return $Unsupported
21+
try
22+
{
23+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Acquiring Token to retrieve list of retirements from Azure Advisor.')
24+
$Token = Get-AzAccessToken -AsSecureString -InformationAction SilentlyContinue -WarningAction SilentlyContinue -Debug:$false
25+
26+
$TokenData = $Token.Token | ConvertFrom-SecureString -AsPlainText
27+
28+
$header = @{
29+
'Authorization' = 'Bearer ' + $TokenData
30+
}
31+
}
32+
catch
33+
{
34+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Error: ' + $_.Exception.Message)
35+
return
36+
}
37+
$AdvisorMetadataUrl = "https://management.azure.com/providers/Microsoft.Advisor/metadata?api-version=2025-01-01&%24filter=recommendationCategory%20eq%20'HighAvailability'%20and%20recommendationSubCategory%20eq%20'ServiceUpgradeAndRetirement'%20and%20retirementDate%20ge%20'2024-01-01'&%24expand=ibiza"
38+
39+
try
40+
{
41+
$AdvisorMetadata = Invoke-RestMethod -Uri $AdvisorMetadataUrl -Headers $header -Method Get -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -InformationAction SilentlyContinue -Debug:$false
42+
}
43+
catch
44+
{
45+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Error: ' + $_.Exception.Message)
46+
return
47+
}
48+
49+
$AdvisorRetirementData = foreach ($advisor in $AdvisorMetadata.value[0].properties.supportedValues)
50+
{
51+
$obj = [PSCustomObject] @{
52+
"id" = $advisor.id
53+
"ServiceName" = $advisor.resourceMetadata.singular
54+
"RetiringFeature" = $advisor.sourceProperties.serviceRetirement.retirementFeatureName
55+
"RetirementDate" = $advisor.sourceProperties.serviceRetirement.retirementDate
56+
"Link" = $advisor.learnMoreLink
57+
}
58+
$obj
59+
}
60+
61+
return $AdvisorRetirementData
2962
}

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/0.MainFunctions/Start-ARIExtrac
1212
This PowerShell Module is part of Azure Resource Inventory (ARI)
1313
1414
.NOTES
15-
Version: 3.6.11
15+
Version: 3.6.12
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
@@ -77,6 +77,15 @@ function Start-ARIExtractionOrchestration {
7777

7878
Remove-Variable -Name VMSkuDetails -ErrorAction SilentlyContinue
7979

80+
Write-Host 'Gathering Storage Account Extra Details: ' -NoNewline
81+
Write-Host 'Used Capacity' -ForegroundColor Cyan
82+
83+
$StorageDetails = Get-AriStorageSpace -Subscriptions $Subscriptions -Resources $Resources
84+
85+
$Resources += $StorageDetails
86+
87+
Remove-Variable -Name StorageDetails -ErrorAction SilentlyContinue
88+
8089
}
8190

8291
$ReturnData = [PSCustomObject]@{

Modules/Private/1.ExtractionFunctions/Invoke-ARIInventoryLoop.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/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.12
1616
First Release Date: 15th Oct, 2024
1717
Authors: Claudio Merola
1818
#>
@@ -38,23 +38,23 @@ function Invoke-ARIInventoryLoop {
3838
}
3939
catch
4040
{
41-
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting First 200 ' + $LoopName)
42-
$QueryResult = Search-AzGraph -Query $GraphQuery -first 200 -Subscription $Sub -Debug:$false
41+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting First 100 ' + $LoopName)
42+
$QueryResult = Search-AzGraph -Query $GraphQuery -first 100 -Subscription $Sub -Debug:$false
4343
}
4444
$LocalResults += $QueryResult
4545
while ($QueryResult.SkipToken) {
4646
$ReportCounterVar = [string]$ReportCounter
4747
try
4848
{
4949
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting Next 1000 ' + $LoopName + '. Loop Number: ' + $ReportCounterVar)
50-
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete $ReportCounter
50+
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete ([Math]::Min($ReportCounter, 100))
5151
$QueryResult = Search-AzGraph -Query $GraphQuery -SkipToken $QueryResult.SkipToken -Subscription $Sub -first 1000 -Debug:$false
5252
}
5353
catch
5454
{
55-
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting Next 200 ' + $LoopName + '. Loop Number: ' + $ReportCounterVar)
56-
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete $ReportCounter
57-
$QueryResult = Search-AzGraph -Query $GraphQuery -SkipToken $QueryResult.SkipToken -Subscription $Sub -first 200 -Debug:$false
55+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting Next 100 ' + $LoopName + '. Loop Number: ' + $ReportCounterVar)
56+
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete ([Math]::Min($ReportCounter, 100))
57+
$QueryResult = Search-AzGraph -Query $GraphQuery -SkipToken $QueryResult.SkipToken -Subscription $Sub -first 100 -Debug:$false
5858
}
5959
$LocalResults += $QueryResult
6060
}
@@ -73,8 +73,8 @@ function Invoke-ARIInventoryLoop {
7373
}
7474
catch
7575
{
76-
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting First 200 ' + $LoopName)
77-
$QueryResult = Search-AzGraph -Query $GraphQuery -first 200 -Subscription $FSubscri -Debug:$false
76+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting First 100 ' + $LoopName)
77+
$QueryResult = Search-AzGraph -Query $GraphQuery -first 100 -Subscription $FSubscri -Debug:$false
7878
}
7979

8080
$LocalResults += $QueryResult
@@ -83,14 +83,14 @@ function Invoke-ARIInventoryLoop {
8383
try
8484
{
8585
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting Next 1000 ' + $LoopName + '. Loop Number: ' + $ReportCounterVar)
86-
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete $ReportCounter
86+
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete ([Math]::Min($ReportCounter, 100))
8787
$QueryResult = Search-AzGraph -Query $GraphQuery -SkipToken $QueryResult.SkipToken -Subscription $FSubscri -first 1000 -Debug:$false
8888
}
8989
catch
9090
{
91-
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting Next 200 ' + $LoopName + '. Loop Number: ' + $ReportCounterVar)
92-
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete $ReportCounter
93-
$QueryResult = Search-AzGraph -Query $GraphQuery -SkipToken $QueryResult.SkipToken -Subscription $FSubscri -first 200 -Debug:$false
91+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Extracting Next 100 ' + $LoopName + '. Loop Number: ' + $ReportCounterVar)
92+
Write-Progress -Id 1 -activity ('Extracting: ' + $LoopName) -Status "$ReportCounter% Complete." -PercentComplete ([Math]::Min($ReportCounter, 100))
93+
$QueryResult = Search-AzGraph -Query $GraphQuery -SkipToken $QueryResult.SkipToken -Subscription $FSubscri -first 100 -Debug:$false
9494
}
9595
$LocalResults += $QueryResult
9696
$ReportCounter ++
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<#
2+
.Synopsis
3+
Module responsible for retrieving Azure Storage Space details.
4+
5+
.DESCRIPTION
6+
This module retrieves Azure Storage Space details for specific subscriptions and locations.
7+
8+
.Link
9+
https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/ResourceDetails/Get-ARIStorageSpace.ps1
10+
11+
.COMPONENT
12+
This PowerShell Module is part of Azure Resource Inventory (ARI).
13+
14+
.NOTES
15+
Version: 3.6.12
16+
First Release Date: 15th Oct, 2024
17+
Authors: Claudio Merola
18+
#>
19+
20+
function Get-AriStorageSpace {
21+
Param ($Subscriptions, $Resources)
22+
23+
Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting Storage Space Details')
24+
25+
$StorageAccounts = ($Resources | Where-Object {$_.Type -in 'microsoft.storage/storageaccounts'})
26+
27+
$Data = foreach ($Storage in $StorageAccounts)
28+
{
29+
try{
30+
$Capacity = Get-AzMetric -ResourceId $Storage.id -MetricName "UsedCapacity" -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -InformationAction SilentlyContinue -Debug:$false
31+
32+
$object = [PSCustomObject] @{
33+
id = $Storage.id
34+
CapacityGB = (($Capacity.Data.Average[0] / 1024) /1024) /1024
35+
}
36+
}
37+
catch{
38+
$object = [PSCustomObject] @{
39+
id = $Storage.id
40+
CapacityGB = 'Unavailable'
41+
}
42+
}
43+
44+
$object
45+
}
46+
47+
Clear-Variable -Name StorageAccounts
48+
49+
$StorageData = [PSCustomObject]@{
50+
'type' = 'ARI/STORAGE/CAPACITY'
51+
'properties' = $Data
52+
}
53+
54+
return $StorageData
55+
}

Modules/Private/3.ReportingFunctions/Build-ARIQuotaReport.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ function Build-ARIQuotaReport {
4343
$ExcelVar = $tmp
4444

4545
$TableName = ('QuotaTable_'+$ExcelVar[0].Total)
46-
[PSCustomObject]$ExcelVar |
47-
ForEach-Object { $_ } |
46+
$ExcelVar |
47+
ForEach-Object { [PSCustomObject]$_ } |
4848
Select-Object -Unique 'Subscription',
4949
'Region',
5050
'Current Usage',

Modules/Private/3.ReportingFunctions/Build-ARISecCenterReport.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function Build-ARISecCenterReport {
2222
$condtxtsec = $(New-ConditionalText High -Range G:G
2323
New-ConditionalText High -Range L:L)
2424

25-
[PSCustomObject]$Sec |
26-
ForEach-Object { $_ } |
25+
$Sec |
26+
ForEach-Object { [PSCustomObject]$_ } |
2727
Select-Object 'Subscription',
2828
'Resource Group',
2929
'Resource Type',

0 commit comments

Comments
 (0)