Skip to content

feat: add Azure.VM.SecureBoot and Azure.VMSS.SecureBoot rules (AZR-000538 and AZR-000539)#3731

Open
coder999999999 wants to merge 4 commits intoAzure:mainfrom
coder999999999:claude/vm-secure-boot-pr-ready-fuEC7
Open

feat: add Azure.VM.SecureBoot and Azure.VMSS.SecureBoot rules (AZR-000538 and AZR-000539)#3731
coder999999999 wants to merge 4 commits intoAzure:mainfrom
coder999999999:claude/vm-secure-boot-pr-ready-fuEC7

Conversation

@coder999999999
Copy link
Copy Markdown

Summary

Closes #3728, closes #3730

Adds two new security rules to check that VMs and VMSS use Trusted Launch (or Confidential VM) with Secure Boot enabled.

New Rules

Rule Ref Resource Type Description
Azure.VM.SecureBoot AZR-000535 Microsoft.Compute/virtualMachines VMs should use Trusted Launch with Secure Boot enabled
Azure.VMSS.SecureBoot AZR-000536 Microsoft.Compute/virtualMachineScaleSets VMSS should use Trusted Launch with Secure Boot enabled

Both rules accept TrustedLaunch or ConfidentialVM as valid security types and verify secureBootEnabled is true.

Changes

  • Rules: Azure.VM.Rule.ps1, Azure.VMSS.Rule.ps1 — new rule definitions
  • Localization: PSRule-rules.psd1 — 4 new error message strings
  • Documentation: Azure.VM.SecureBoot.md, Azure.VMSS.SecureBoot.md — includes ARM template and Bicep examples
  • Changelog: changelog.md — entries for both rules
  • Tests: Isolated test file Azure.VM.SecureBoot.Tests.ps1 with dedicated test data Resources.VM.SecureBoot.json — does not modify existing test files or counts

Test Coverage

Test Case Type Expected Outcome
vm-secureBoot-pass VM (TrustedLaunch) Pass
vm-secureBoot-confidential VM (ConfidentialVM) Pass
vm-secureBoot-fail-none VM (no securityProfile) Fail
vm-secureBoot-fail-disabled VM (secureBootEnabled=false) Fail
vmss-secureBoot-pass VMSS (TrustedLaunch) Pass
vmss-secureBoot-confidential VMSS (ConfidentialVM) Pass
vmss-secureBoot-fail-none VMSS (no securityProfile) Fail
vmss-secureBoot-fail-disabled VMSS (secureBootEnabled=false) Fail

References

coder999999999 and others added 2 commits March 25, 2026 23:48
…3728, Azure#3730)

Add rules to check that VMs and VMSS use Trusted Launch with Secure Boot
enabled (or ConfidentialVM security type).

- Azure.VM.SecureBoot (AZR-000535)
- Azure.VMSS.SecureBoot (AZR-000536)

Includes:
- Rule definitions for VM and VMSS
- Localized error messages
- Documentation with ARM and Bicep examples
- Isolated test data and Pester tests
…secure boot rules

- Add changelog entries for Azure.VM.SecureBoot (AZR-000535) and Azure.VMSS.SecureBoot (AZR-000536)
- Add missing Id field to all test data entries in Resources.VM.SecureBoot.json
- Add vmss-secureBoot-confidential test case with ConfidentialVM security type
- Update Pester test assertions to account for new VMSS pass case

https://claude.ai/code/session_01MBAfB8do1VZiMY1HsJaWZG
@coder999999999 coder999999999 requested a review from a team as a code owner March 26, 2026 04:31
Copilot AI review requested due to automatic review settings March 26, 2026 04:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new PSRule security rules to validate that Azure VMs and VMSS use Trusted Launch (or Confidential VM) with Secure Boot enabled, along with documentation, localization, changelog, and dedicated tests/resources.

Changes:

  • Added Azure.VM.SecureBoot and Azure.VMSS.SecureBoot rules to validate securityType and secureBootEnabled.
  • Added localized reason strings and new rule documentation pages with ARM/Bicep examples.
  • Added isolated Pester tests and JSON resource fixtures for pass/fail coverage.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tests/PSRule.Rules.Azure.Tests/Resources.VM.SecureBoot.json Adds VM/VMSS resource fixtures covering pass/fail Secure Boot scenarios
tests/PSRule.Rules.Azure.Tests/Azure.VM.SecureBoot.Tests.ps1 Adds Pester coverage for both new rules using the new fixture file
src/PSRule.Rules.Azure/rules/Azure.VMSS.Rule.ps1 Introduces Azure.VMSS.SecureBoot rule assertions and localized reasons
src/PSRule.Rules.Azure/rules/Azure.VM.Rule.ps1 Introduces Azure.VM.SecureBoot rule assertions and localized reasons
src/PSRule.Rules.Azure/en/PSRule-rules.psd1 Adds localized reason strings for the new rule failures
docs/en/rules/Azure.VMSS.SecureBoot.md Documents the VMSS rule intent and deployment examples
docs/en/rules/Azure.VM.SecureBoot.md Documents the VM rule intent and deployment examples
docs/changelog.md Records the new rules in the Unreleased changelog

- Docs: SYNOPSIS and RECOMMENDATION now mention both TrustedLaunch and
  ConfidentialVM to match actual rule behavior
- Docs: grammar fix for TPM description
- Localization: error messages now include literal property values
  ('TrustedLaunch' or 'ConfidentialVM') for clearer remediation
- Tests: replaced Should -BeIn with Should -Contain per name to
  correctly validate arrays of TargetName results
Copy link
Copy Markdown
Collaborator

@BernieWhite BernieWhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @coder999999999. Your suggested rules look great.

There is a few minor changes required, please see comments below.

$here = (Resolve-Path $PSScriptRoot).Path;
}

Describe 'Azure.VM.SecureBoot' -Tag 'VM', 'SecureBoot' {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to move these tests into Azure.VM.Tests.ps1 and Azure.VMSS.Tests.ps1. It negatively impacts performance of the unit tests if we're running Invoke-PSRule too many times. We're actively trying to improve this.

- Bumped rule IDs: AZR-000538 (VM), AZR-000539 (VMSS)
- Updated ruleSet to 2026_06
- Replaced SYNOPSIS and DESCRIPTION with BernieWhite's
  suggested text covering threat model and verification
@BernieWhite BernieWhite changed the title feat: add Azure.VM.SecureBoot and Azure.VMSS.SecureBoot rules feat: add Azure.VM.SecureBoot and Azure.VMSS.SecureBoot rules (AZR-000538 and AZR-000539) Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RULE] VMSS should use secure boot [RULE] VMs should use Secure Boot

4 participants