forked from anwather/iac-psrule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.yaml
25 lines (23 loc) · 1.08 KB
/
pipeline.yaml
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
trigger:
- main
pool:
vmImage: "ubuntu-latest"
steps:
- task: AzurePowerShell@5
inputs:
azureSubscription: "EPAC-DEV-Root Secret" # Update with your service connection name
ScriptType: "InlineScript"
pwsh: true
azurePowerShellVersion: "LatestVersion"
Inline: |
Install-Module Az.ResourceGraph -Force -Verbose
Install-Module PSRule.Rules.Azure -Scope CurrentUser -AllowPrerelease -Force -Verbose
Install-Module EnterprisePolicyAsCode -Scope CurrentUser -Force -Verbose
Export-AzPolicyResources -DefinitionsRootFolder ./ -Mode psrule -OutputFolder ./
Export-AzPolicyAssignmentRuleData -AssignmentFile ./psrule.assignment.json -OutputPath ./.ps-rule/policy-rules.Rule.jsonc -ErrorAction SilentlyContinue
Assert-PSRule -InputPath ./ -Module "PSRule.Rules.Azure" -Format File -OutputFormat NUnit3 -OutputPath results.xml -ErrorAction SilentlyContinue
- task: PublishTestResults@2
inputs:
testResultsFormat: "NUnit"
testResultsFiles: "**/results.xml"
searchFolder: "$(System.DefaultWorkingDirectory)"