From 0f2b98a9d6d1bd0e49ee72e5f39bce6af28ef0ea Mon Sep 17 00:00:00 2001 From: merola Date: Tue, 2 Jun 2026 09:25:23 -0300 Subject: [PATCH] Bugfix on automation documentation Bugfix on Storage Account module Bugfix on Get-ARIAPIResources function --- AzureResourceInventory.psd1 | 2 +- .../Get-ARIAPIResources.ps1 | 16 ++++++++-------- .../InventoryModules/Storage/StorageAccounts.ps1 | 5 +++-- docs/advanced/automation.md | 3 ++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/AzureResourceInventory.psd1 b/AzureResourceInventory.psd1 index db56ba73..dc5b90a9 100644 --- a/AzureResourceInventory.psd1 +++ b/AzureResourceInventory.psd1 @@ -12,7 +12,7 @@ RootModule = 'AzureResourceInventory.psm1' # Version number of this module. -ModuleVersion = '3.6.12' +ModuleVersion = '3.6.13' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/Modules/Private/1.ExtractionFunctions/Get-ARIAPIResources.ps1 b/Modules/Private/1.ExtractionFunctions/Get-ARIAPIResources.ps1 index 9d81c6db..467ab0c5 100644 --- a/Modules/Private/1.ExtractionFunctions/Get-ARIAPIResources.ps1 +++ b/Modules/Private/1.ExtractionFunctions/Get-ARIAPIResources.ps1 @@ -12,7 +12,7 @@ https://github.com/microsoft/ARI/Modules/Private/1.ExtractionFunctions/Get-ARIAP This PowerShell Module is part of Azure Resource Inventory (ARI). .NOTES -Version: 3.6.0 +Version: 3.6.13 First Release Date: 15th Oct, 2024 Authors: Claudio Merola #> @@ -75,7 +75,7 @@ function Get-ARIAPIResources { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting ResourceHealth Events') $url = ('https://' + $AzURL + '/subscriptions/' + $Sub + '/providers/Microsoft.ResourceHealth/events?api-version=2022-10-01&queryStartTime=' + $ResourceHealthHistoryDate) try { - $ResourceHealth = Invoke-RestMethod -Uri $url -Headers $header -Method GET + $ResourceHealth = Invoke-RestMethod -Uri $url -Headers $header -Method GET -Debug:$false } catch { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Error: ' + $_.Exception.Message) @@ -88,7 +88,7 @@ function Get-ARIAPIResources { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting Managed Identities') $url = ('https://' + $AzURL + '/subscriptions/' + $Sub + '/providers/Microsoft.ManagedIdentity/userAssignedIdentities?api-version=2023-01-31') try { - $Identities = Invoke-RestMethod -Uri $url -Headers $header -Method GET + $Identities = Invoke-RestMethod -Uri $url -Headers $header -Method GET -Debug:$false } catch { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Error: ' + $_.Exception.Message) @@ -100,7 +100,7 @@ function Get-ARIAPIResources { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting Advisor Score') $url = ('https://' + $AzURL + '/subscriptions/' + $Sub + '/providers/Microsoft.Advisor/advisorScore?api-version=2023-01-01') try { - $ADVScore = Invoke-RestMethod -Uri $url -Headers $header -Method GET + $ADVScore = Invoke-RestMethod -Uri $url -Headers $header -Method GET -Debug:$false } catch { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Error: ' + $_.Exception.Message) @@ -112,7 +112,7 @@ function Get-ARIAPIResources { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Getting VM Reservation Recommendation') $url = ('https://' + $AzURL + '/subscriptions/' + $Sub + '/providers/Microsoft.Consumption/reservationRecommendations?api-version=2023-05-01') try { - $ReservationRecon = Invoke-RestMethod -Uri $url -Headers $header -Method GET + $ReservationRecon = Invoke-RestMethod -Uri $url -Headers $header -Method GET -Debug:$false } catch { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Error: ' + $_.Exception.Message) @@ -126,13 +126,13 @@ function Get-ARIAPIResources { #Policies try { $url = ('https://'+ $AzURL +'/subscriptions/'+$sub+'/providers/Microsoft.PolicyInsights/policyStates/latest/summarize?api-version=2019-10-01') - $PolicyAssign = (Invoke-RestMethod -Uri $url -Headers $header -Method POST).value + $PolicyAssign = (Invoke-RestMethod -Uri $url -Headers $header -Method POST -Debug:$false).value Start-Sleep -Milliseconds 200 $url = ('https://'+ $AzURL +'/subscriptions/'+$sub+'/providers/Microsoft.Authorization/policySetDefinitions?api-version=2023-04-01') - $PolicySetDef = (Invoke-RestMethod -Uri $url -Headers $header -Method GET).value + $PolicySetDef = (Invoke-RestMethod -Uri $url -Headers $header -Method GET -Debug:$false).value Start-Sleep -Milliseconds 200 $url = ('https://'+ $AzURL +'/subscriptions/'+$sub+'/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01') - $PolicyDef = (Invoke-RestMethod -Uri $url -Headers $header -Method GET).value + $PolicyDef = (Invoke-RestMethod -Uri $url -Headers $header -Method GET -Debug:$false).value } catch { Write-Debug ((get-date -Format 'yyyy-MM-dd_HH_mm_ss')+' - '+'Error: ' + $_.Exception.Message) diff --git a/Modules/Public/InventoryModules/Storage/StorageAccounts.ps1 b/Modules/Public/InventoryModules/Storage/StorageAccounts.ps1 index 9f17a4d2..41529bff 100644 --- a/Modules/Public/InventoryModules/Storage/StorageAccounts.ps1 +++ b/Modules/Public/InventoryModules/Storage/StorageAccounts.ps1 @@ -13,7 +13,7 @@ https://github.com/microsoft/ARI/Modules/Public/InventoryModules/Storage/Storage This powershell Module is part of Azure Resource Inventory (ARI) .NOTES -Version: 3.6.0 +Version: 3.6.13 First Release Date: 19th November, 2020 Authors: Claudio Merola and Renato Gregio @@ -81,6 +81,7 @@ If ($Task -eq 'Processing') { $InfrastructureEncryption = if($data.encryption.requireInfrastructureEncryption -eq "True"){$true}else{$false} $StorageUsedCapacity = $StorageDetails.properties | Where-Object { $_.id -eq $1.id } | Select-Object -ExpandProperty CapacityGB + $StorageUsedCapacity = if ($StorageUsedCapacity) {[math]::Round($StorageUsedCapacity,2)}else{$null} if ($data.azureFilesIdentityBasedAuthentication.directoryServiceOptions -eq 'None') { @@ -151,7 +152,7 @@ If ($Task -eq 'Processing') { 'SKU' = $1.sku.name; 'Tier' = $1.sku.tier; 'Storage Account Kind' = $1.kind; - 'Used Capacity (GB)' = [math]::Round($StorageUsedCapacity,2); + 'Used Capacity (GB)' = $StorageUsedCapacity; 'Secure Transfer Required' = $data.supportsHttpsTrafficOnly; 'Allow Blob Anonymous Access' = $BlobAccess; 'Minimum TLS Version' = $TLSv; diff --git a/docs/advanced/automation.md b/docs/advanced/automation.md index 23ba8f70..d1f5ce64 100644 --- a/docs/advanced/automation.md +++ b/docs/advanced/automation.md @@ -76,7 +76,8 @@ In the "Packages" pane of your Runtime Environment, import the following modules 4. Az.Accounts 5. Az.Storage 6. Az.Compute -7. Az.CostManagement (only if using the `-IncludeCosts` parameter) +7. Az.Monitor +8. Az.CostManagement (only if using the `-IncludeCosts` parameter) ### Step 6: Create a PowerShell Runbook