Gallery › Security Center › Azure built-in policies
Virtual machines' Guest Configuration extension should be deployed with system-assigned managed identity
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.1
The Guest Configuration extension requires a system assigned managed identity. Azure virtual machines in the scope of this policy will be non-compliant when they have the Guest Configuration extension installed but do not have a system assigned managed identity. Learn more at https://aka.ms/gcpol
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_GCExtOnVmWithNoSAMI.json · 57 lines
{
"properties": {
"displayName": "Virtual machines' Guest Configuration extension should be deployed with system-assigned managed identity",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "The Guest Configuration extension requires a system assigned managed identity. Azure virtual machines in the scope of this policy will be non-compliant when they have the Guest Configuration extension installed but do not have a system assigned managed identity. Learn more at https://aka.ms/gcpol",
"metadata": {
"version": "1.0.1",
"category": "Security Center"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines/extensions"
},
{
"field": "Microsoft.Compute/virtualMachines/extensions/publisher",
"equals": "Microsoft.GuestConfiguration"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Compute/virtualMachines",
"name": "[first(split(field('fullName'), '/'))]",
"existenceCondition": {
"field": "identity.type",
"contains": "SystemAssigned"
}
}
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/d26f7642-7545-4e18-9b75-8c9bbdee3a9a",
"name": "d26f7642-7545-4e18-9b75-8c9bbdee3a9a"
}Bylawd26f7642-7545-4e18-9b75-8c9bbdee3a9a.bylaw.ps1 · 33 lines
# Converted from ASC_GCExtOnVmWithNoSAMI.json by ConvertTo-Bylaw.
Policy 'd26f7642-7545-4e18-9b75-8c9bbdee3a9a' {
Properties @{
DisplayName = 'Virtual machines'' Guest Configuration extension should be deployed with system-assigned managed identity'
Description = 'The Guest Configuration extension requires a system assigned managed identity. Azure virtual machines in the scope of this policy will be non-compliant when they have the Guest Configuration extension installed but do not have a system assigned managed identity. Learn more at https://aka.ms/gcpol'
Version = '1.0.1'
Category = 'Security Center'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Compute/virtualMachines/extensions' {
Require 'publisher is not Microsoft.GuestConfiguration' {
Field publisher | Must -Not -Be 'Microsoft.GuestConfiguration' -IfPresent
}
}
AuditIfNotExists 'Microsoft.Compute/virtualMachines' -Name (Arm '[first(split(field(''fullName''), ''/''))]') -Effect (Param Effect) {
Require 'identity.type contains SystemAssigned' {
Field identity.type | Must -ContainText 'SystemAssigned'
}
}
}Source: built-in-policies/policyDefinitions/Security Center/ASC_GCExtOnVmWithNoSAMI.json in Azure/azure-policy, under the MIT licence.
Bylaw