Gallery › Security Center › Azure built-in policies
Configure supported Windows virtual machines to automatically install the Guest Attestation extension
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 5.2.0
Configure supported Windows virtual machines to automatically install the Guest Attestation extension to allow Azure Security Center to proactively attest and monitor the boot integrity. Boot integrity is attested via Remote Attestation.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_InstallWindowsGAExtOnVM_DINE.json · 177 lines
{
"properties": {
"displayName": "Configure supported Windows virtual machines to automatically install the Guest Attestation extension",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Configure supported Windows virtual machines to automatically install the Guest Attestation extension to allow Azure Security Center to proactively attest and monitor the boot integrity. Boot integrity is attested via Remote Attestation.",
"metadata": {
"category": "Security Center",
"version": "5.2.0"
},
"version": "5.2.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "DeployIfNotExists",
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
},
"attestationEndpoint": {
"defaultValue": "",
"type": "string",
"metadata": {
"displayName": "Guest attestation tenant URL",
"description": "The Microsoft Azure Attestation (MAA) custom tenant URL."
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"anyOf": [
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.imageReference.offer",
"like": "windows*"
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
"like": "Windows*"
}
]
},
{
"field": "Microsoft.Compute/virtualMachines/securityProfile.securityType",
"in": [
"TrustedLaunch",
"ConfidentialVM"
]
},
{
"field": "Microsoft.Compute/virtualMachines/securityProfile.uefiSettings",
"exists": "true"
},
{
"field": "Microsoft.Compute/virtualMachines/securityProfile.uefiSettings.vTpmEnabled",
"equals": "true"
},
{
"field": "Microsoft.Compute/virtualMachines/securityProfile.uefiSettings.secureBootEnabled",
"equals": "true"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Compute/virtualMachines/extensions",
"evaluationDelay": "AfterProvisioningSuccess",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Compute/virtualMachines/extensions/publisher",
"equals": "Microsoft.Azure.Security.WindowsAttestation"
},
{
"field": "Microsoft.Compute/virtualMachines/extensions/type",
"equals": "GuestAttestation"
},
{
"field": "Microsoft.Compute/virtualMachines/extensions/provisioningState",
"in": [
"Succeeded",
"Provisioning succeeded"
]
}
]
},
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"
],
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
},
"attestationEndpoint": {
"value": "[parameters('attestationEndpoint')]"
}
},
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"attestationEndpoint": {
"type": "string"
}
},
"variables": {
"extensionName": "GuestAttestation",
"extensionPublisher": "Microsoft.Azure.Security.WindowsAttestation",
"extensionVersion": "1.0",
"maaTenantName": "GuestAttestation",
"ascReportingEndpoint": ""
},
"resources": [
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"apiVersion": "2019-12-01",
"name": "[concat(parameters('vmName'), '/', variables('extensionName'))]",
"location": "[parameters('location')]",
"properties": {
"publisher": "[variables('extensionPublisher')]",
"type": "[variables('extensionName')]",
"typeHandlerVersion": "[variables('extensionVersion')]",
"autoUpgradeMinorVersion": true,
"settings": {
"AttestationConfig": {
"MaaSettings": {
"maaEndpoint": "[parameters('attestationEndpoint')]",
"maaTenantName": "[variables('maaTenantName')]"
},
"AscSettings": {
"ascReportingEndpoint": "[variables('ascReportingEndpoint')]",
"ascReportingFrequency": ""
},
"useCustomToken": "false",
"disableAlerts": "false"
}
}
}
}
]
}
}
}
}
}
},
"versions": [
"5.2.0",
"5.1.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/98ea2fc7-6fc6-4fd1-9d8d-6331154da071",
"name": "98ea2fc7-6fc6-4fd1-9d8d-6331154da071"
}Bylaw98ea2fc7-6fc6-4fd1-9d8d-6331154da071.bylaw.ps1 · 56 lines
# Converted from ASC_InstallWindowsGAExtOnVM_DINE.json by ConvertTo-Bylaw.
Policy '98ea2fc7-6fc6-4fd1-9d8d-6331154da071' {
Properties @{
DisplayName = 'Configure supported Windows virtual machines to automatically install the Guest Attestation extension'
Description = 'Configure supported Windows virtual machines to automatically install the Guest Attestation extension to allow Azure Security Center to proactively attest and monitor the boot integrity. Boot integrity is attested via Remote Attestation.'
Category = 'Security Center'
Version = '5.2.0'
PolicyVersion = '5.2.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter AttestationEndpoint @{
Type = 'string'
Default = ''
DisplayName = 'Guest attestation tenant URL'
Description = 'The Microsoft Azure Attestation (MAA) custom tenant URL.'
}
Resource 'Microsoft.Compute/virtualMachines' {
When {
AnyOf {
Field storageProfile.imageReference.offer | Must -BeLike 'windows*'
Field storageProfile.osDisk.osType | Must -BeLike 'Windows*'
}
Field securityProfile.securityType | Must -BeIn @('TrustedLaunch', 'ConfidentialVM')
Field securityProfile.uefiSettings | Must -Exist
Field securityProfile.uefiSettings.vTpmEnabled | Must -Be 'true'
}
Require 'securityProfile.uefiSettings.secureBootEnabled is not true' {
Field securityProfile.uefiSettings.secureBootEnabled | Must -Not -Be 'true' -IfPresent
}
}
DeployIfNotExists 'Microsoft.Compute/virtualMachines/extensions' -Role 'Virtual Machine Contributor' -EvaluationDelay AfterProvisioningSuccess -Effect (Param Effect) {
Require 'publisher, type and provisioningState are as required' {
Field publisher | Must -Be 'Microsoft.Azure.Security.WindowsAttestation'
Field 'Microsoft.Compute/virtualMachines/extensions/type' | Must -Be 'GuestAttestation'
Field provisioningState | Must -BeIn @('Succeeded', 'Provisioning succeeded')
}
Deployment -TemplateFile './templates/98ea2fc7-6fc6-4fd1-9d8d-6331154da071.json' -Parameters ([ordered]@{
vmName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
attestationEndpoint = (Param AttestationEndpoint)
})
}
}Its deployment templates are written beside it:
templates/98ea2fc7-6fc6-4fd1-9d8d-6331154da071.json
Source: built-in-policies/policyDefinitions/Security Center/ASC_InstallWindowsGAExtOnVM_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw