Skip to content

Commit

Permalink
Merge pull request #86 from Azure/feat/update-analyzer-report
Browse files Browse the repository at this point in the history
Feat/update analyzer report
  • Loading branch information
kpoineal authored Feb 4, 2025
2 parents 6736d5f + 49aa1f9 commit de83649
Show file tree
Hide file tree
Showing 9 changed files with 2,440 additions and 3,278 deletions.
2,187 changes: 1,125 additions & 1,062 deletions src/modules/wara/analyzer/2_wara_data_analyzer.ps1

Large diffs are not rendered by default.

Binary file not shown.
15 changes: 4 additions & 11 deletions src/modules/wara/analyzer/analyzer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Well-Architected Reliability Assessment Script
.DESCRIPTION
The function `Start-WARAAnalyzer` will process the JSON file created by the `Start-WARACollector` function and will create the core WARA Action Plan Excel file.
.PARAMETER Debugging
Switch to enable debugging mode.
.PARAMETER Help
Switch to display help information.
Expand All @@ -18,7 +15,7 @@ Specifies the git repository URL that contains APRL contents if you want to use
Path to the JSON file created by the "1_wara_collector" script.
.EXAMPLE
Start-WARAAnalyzer -JSONFile 'C:\Temp\WARA_File_2024-04-01_10_01.json' -Debugging
Start-WARAAnalyzer -JSONFile 'C:\Temp\WARA_File_2024-04-01_10_01.json' -Debug
.LINK
https://github.com/Azure/Azure-Proactive-Resiliency-Library-v2
Expand All @@ -27,15 +24,11 @@ function Start-WARAAnalyzer {
[CmdletBinding()]
param
(
[switch]$Debugging,
[switch]$Help,
[string]$CustomRecommendationsYAMLPath,

[ValidatePattern('^https:\/\/.+$')]
[string]$RepoUrl = 'https://github.com/Azure/Azure-Proactive-Resiliency-Library-v2',

[string] $RecommendationsUrl = 'https://azure.github.io/WARA-Build/objects/recommendations.json',
[Parameter(mandatory = $true)]
[string] $JSONFile
[string] $JSONFile,
[string] $ExpertAnalysisFile
)


Expand Down
14 changes: 10 additions & 4 deletions src/modules/wara/collector/collector.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function Get-WAFTaggedResourceGroup {
| order by ['id']"

$result = Invoke-WAFQuery -Query $tagquery -SubscriptionIds $SubscriptionIds

$return += $result
}

Expand Down Expand Up @@ -181,17 +181,23 @@ function Invoke-WAFQueryLoop {

$Types = Get-WAFResourceType -SubscriptionIds $SubscriptionIds

$Types += $AddedTypes

$QueryObject = Get-WAFQueryByResourceType -ObjectList $RecommendationObject -FilterList $Types.type -KeyColumn 'recommendationResourceType'

# Add additional types to query based on specialized workloads (This works even if it's empty.)
$QueryObject += $AddedTypes.Foreach({
$type = $_
$RecommendationObject.where({$_.tags -contains $type})
}) | Sort-Object -Property "APRLGuid" | Get-Unique -AsString

$return = $QueryObject.Where({ $_.automationAvailable -eq $true -and $_.recommendationMetadataState -eq "Active" -and [string]::IsNullOrEmpty($_.recommendationTypeId) }) | ForEach-Object {
Write-Progress -Activity 'Running Queries' -Status "Running Query for $($_.recommendationResourceType) - $($_.aprlGuid)" -PercentComplete (($QueryObject.IndexOf($_) / $QueryObject.Count) * 100) -Id $ProgressId
try {
(Invoke-WAFQuery -Query $_.query -SubscriptionIds $subscriptionIds -ErrorAction Stop)
}
catch {
Write-Host "Error running query for - $($_.recommendationResourceType) - $($_.aprlGuid)"
$errorInfo = "Error running query for - $($_.recommendationResourceType) - $($_.aprlGuid)"
Write-Error $errorInfo
return $errorInfo
}
}
Write-Progress -Activity 'Running Queries' -Status 'Completed' -Completed -Id $ProgressId
Expand Down
Loading

0 comments on commit de83649

Please sign in to comment.