Gallery › Automanage › Azure built-in policies
[Preview]: Boot Diagnostics should be enabled on virtual machines
Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview
Azure virtual machines should have boot diagniostics enabled.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONBootDiagnostics_Audit.json · 50 lines
{
"properties": {
"policyType": "BuiltIn",
"mode": "Indexed",
"displayName": "[Preview]: Boot Diagnostics should be enabled on virtual machines",
"description": "Azure virtual machines should have boot diagniostics enabled.",
"metadata": {
"version": "1.0.0-preview",
"category": "Automanage",
"preview": true
},
"version": "1.0.0-preview",
"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/virtualMachines"
},
{
"field": "Microsoft.Compute/virtualMachines/diagnosticsProfile.bootDiagnostics.enabled",
"notEquals": "true"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/fb97d6e1-5c98-4743-a439-23e0977bad9e",
"name": "fb97d6e1-5c98-4743-a439-23e0977bad9e"
}Bylawfb97d6e1-5c98-4743-a439-23e0977bad9e.bylaw.ps1 · 29 lines
# Converted from BootDiagnostics_Audit.json by ConvertTo-Bylaw.
Policy 'fb97d6e1-5c98-4743-a439-23e0977bad9e' {
Properties @{
DisplayName = '[Preview]: Boot Diagnostics should be enabled on virtual machines'
Description = 'Azure virtual machines should have boot diagniostics enabled.'
Version = '1.0.0-preview'
Category = 'Automanage'
Preview = $true
PolicyVersion = '1.0.0-preview'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Compute/virtualMachines' {
Require 'diagnosticsProfile.bootDiagnostics.enabled is true' {
Field diagnosticsProfile.bootDiagnostics.enabled | Must -Be 'true'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Automanage/BootDiagnostics_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw