generated from Gordonby/PSRule.Brownfield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWellArchitectedEval.ps1
28 lines (20 loc) · 955 Bytes
/
WellArchitectedEval.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#Fill these out
$sub="" #Subscription Name
$rg="" #Resource Group to analyse
$tenantId="" #Azure AD tenantId
#Only change these if you really care
$templatePath=".wellarchitected-output/templates/"
$resultsPath=".wellarchitected-output/results/"
# Install PSRule.Rules.Azure from the PowerShell Gallery
Install-Module -Name 'PSRule.Rules.Azure' -Scope CurrentUser -Force;
#Connect to Azure
Connect-AzAccount -Subscription $sub -UseDeviceAuthentication -Tenant $tenantId
# Export data from the resource group
Export-AzRuleData -ResourceGroupName $rg -OutputPath $templatePath;
# Check against Azure Rules
$resultsFile = Join-Path $resultsPath -childpath "$(New-Guid).txt"
$PSRuleResults = Invoke-PSRule -InputPath $templatePath -Module 'PSRule.Rules.Azure' -As Summary;
$PSRuleResults | Out-File $resultsFile
Write-Output $PSRuleResults
#Run a more detailed analysis
Invoke-PSRule -InputPath $templatePath -Module 'PSRule.Rules.Azure' -As Detail;