Gallery › Security Center › Azure built-in policies
Configure VMSS created with Shared Image Gallery images to install the Guest Attestation extension
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 2.2.0
Configure VMSS created with Shared Image Gallery images 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_InstallGAExtOnSigVMSS_DINE.json · 170 lines
{
"properties": {
"displayName": "Configure VMSS created with Shared Image Gallery images to install the Guest Attestation extension",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Configure VMSS created with Shared Image Gallery images 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": "2.2.0"
},
"version": "2.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/virtualMachineScaleSets"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.securityProfile.securityType",
"equals": "TrustedLaunch"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.securityProfile.uefiSettings",
"exists": "true"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.securityProfile.uefiSettings.vTpmEnabled",
"equals": "true"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.securityProfile.uefiSettings.secureBootEnabled",
"equals": "true"
},
{
"field": "Microsoft.Compute/imageid",
"exists": "true"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
"evaluationDelay": "AfterProvisioningSuccess",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/publisher",
"in": [
"Microsoft.Azure.Security.LinuxAttestation",
"Microsoft.Azure.Security.WindowsAttestation"
]
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/type",
"equals": "GuestAttestation"
}
]
},
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
"/providers/microsoft.authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"
],
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
},
"imageId": {
"value": "[field('Microsoft.Compute/imageid')]"
},
"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"
},
"imageId": {
"type": "string"
},
"attestationEndpoint": {
"type": "string"
}
},
"variables": {
"extensionName": "GuestAttestation",
"extensionPublisherPrefix": "Microsoft.Azure.Security.",
"extensionPublisherSuffix": "Attestation",
"extensionVersion": "1.0",
"maaTenantName": "GuestAttestation",
"ascReportingEndpoint": ""
},
"resources": [
{
"type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
"apiVersion": "2018-10-01",
"name": "[concat(parameters('vmName'), '/', variables('extensionName'))]",
"location": "[parameters('location')]",
"properties": {
"publisher": "[concat(variables('extensionPublisherPrefix'), reference(split(parameters('imageId'), '/versions')[0], '2021-07-01').osType, variables('extensionPublisherSuffix'))]",
"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": [
"2.2.0",
"2.1.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/009259b0-12e8-42c9-94e7-7af86aa58d13",
"name": "009259b0-12e8-42c9-94e7-7af86aa58d13"
}Bylaw009259b0-12e8-42c9-94e7-7af86aa58d13.bylaw.ps1 · 53 lines
# Converted from ASC_InstallGAExtOnSigVMSS_DINE.json by ConvertTo-Bylaw.
Policy '009259b0-12e8-42c9-94e7-7af86aa58d13' {
Properties @{
DisplayName = 'Configure VMSS created with Shared Image Gallery images to install the Guest Attestation extension'
Description = 'Configure VMSS created with Shared Image Gallery images 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 = '2.2.0'
PolicyVersion = '2.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/virtualMachineScaleSets' {
When {
Field virtualMachineProfile.securityProfile.securityType | Must -Be 'TrustedLaunch'
Field virtualMachineProfile.securityProfile.uefiSettings | Must -Exist
Field virtualMachineProfile.securityProfile.uefiSettings.vTpmEnabled | Must -Be 'true'
Field virtualMachineProfile.securityProfile.uefiSettings.secureBootEnabled | Must -Be 'true'
}
Require 'imageid does not exist' {
Field 'Microsoft.Compute/imageid' | Must -Not -Exist
}
}
DeployIfNotExists 'Microsoft.Compute/virtualMachineScaleSets/extensions' -Role 'Reader', 'Virtual Machine Contributor' -EvaluationDelay AfterProvisioningSuccess -Effect (Param Effect) {
Require 'publisher is one of 2 values and type is GuestAttestation' {
Field publisher | Must -BeIn @('Microsoft.Azure.Security.LinuxAttestation', 'Microsoft.Azure.Security.WindowsAttestation')
Field 'Microsoft.Compute/virtualMachineScaleSets/extensions/type' | Must -Be 'GuestAttestation'
}
Deployment -TemplateFile './templates/009259b0-12e8-42c9-94e7-7af86aa58d13.json' -Parameters ([ordered]@{
vmName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
imageId = (Arm '[field(''Microsoft.Compute/imageid'')]')
attestationEndpoint = (Param AttestationEndpoint)
})
}
}Its deployment templates are written beside it:
templates/009259b0-12e8-42c9-94e7-7af86aa58d13.json
Source: built-in-policies/policyDefinitions/Security Center/ASC_InstallGAExtOnSigVMSS_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw