Gallery › Trusted Launch › Azure built-in policies
Disks and OS image should support TrustedLaunch
Converted Policy Audit Disabled Mode Indexed Version 1.0.0
TrustedLaunch improves security of a Virtual Machine which requires OS Disk & OS Image to support it (Gen 2). To learn more about TrustedLaunch, visit https://aka.ms/trustedlaunch
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDisks_and_OS_Should_Support_TrustedLaunch.json · 65 lines
{
"properties": {
"displayName": "Disks and OS image should support TrustedLaunch",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "TrustedLaunch improves security of a Virtual Machine which requires OS Disk & OS Image to support it (Gen 2). To learn more about TrustedLaunch, visit https://aka.ms/trustedlaunch",
"metadata": {
"version": "1.0.0",
"category": "Trusted Launch"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/disks"
},
{
"allOf": [
{
"field": "Microsoft.Compute/disks/osType",
"exists": "true"
},
{
"anyOf": [
{
"field": "Microsoft.Compute/disks/hyperVGeneration",
"exists": "false"
},
{
"field": "Microsoft.Compute/disks/hyperVGeneration",
"equals": "V1"
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b03bb370-5249-4ea4-9fce-2552e87e45fa",
"name": "b03bb370-5249-4ea4-9fce-2552e87e45fa"
}Bylawb03bb370-5249-4ea4-9fce-2552e87e45fa.bylaw.ps1 · 36 lines
# Converted from Disks_and_OS_Should_Support_TrustedLaunch.json by ConvertTo-Bylaw.
Policy 'b03bb370-5249-4ea4-9fce-2552e87e45fa' {
Properties @{
DisplayName = 'Disks and OS image should support TrustedLaunch'
Description = 'TrustedLaunch improves security of a Virtual Machine which requires OS Disk & OS Image to support it (Gen 2). To learn more about TrustedLaunch, visit https://aka.ms/trustedlaunch'
Version = '1.0.0'
Category = 'Trusted Launch'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Compute/disks' {
When {
Field osType | Must -Exist
}
Require 'hyperVGeneration exists' {
Field hyperVGeneration | Must -Exist
}
Require 'hyperVGeneration is not V1' {
Field hyperVGeneration | Must -Not -Be 'V1' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Trusted Launch/Disks_and_OS_Should_Support_TrustedLaunch.json in Azure/azure-policy, under the MIT licence.
Bylaw