Gallery › Guest Configuration › Azure built-in policies
Center for Internet Security (CIS) Benchmarks for Windows Server
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 2.0.1
This policy provides you the ability to customize and deploy CIS Security Benchmarks for audit purposes to your Windows Server across Azure, on-premises and hybrid environments. The contents of the CIS Security Benchmarks are in parity with the benchmarks published at https://cisecurity.org. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Center for Internet Security (CIS) Benchmarks for Windows Server",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy provides you the ability to customize and deploy CIS Security Benchmarks for audit purposes to your Windows Server across Azure, on-premises and hybrid environments. The contents of the CIS Security Benchmarks are in parity with the benchmarks published at https://cisecurity.org. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.",
"metadata": {
"category": "Guest Configuration",
"version": "2.0.1",
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "CISWindowsSecurityBaseline",
"version": "1.*",
"configurationParameter": {
"BaselineSettings": "CISWindowsSecurityBaseline;BaselineSettings"
}
}
},
"version": "2.0.1",
"parameters": {
"IncludeArcMachines": {
"type": "string",
"metadata": {
"displayName": "Include Arc connected servers",
"description": "By selecting this option, you agree to be charged monthly per Arc connected machine.",
"portalReview": "true"
},
"allowedValues": [
"true",
"false"
],
"defaultValue": "false"
},
"ArcKind": {
"type": "String",
"metadata": {
"displayName": "Arc machine cloud provider kind",
"description": "Optional filter applied to every evaluated resource (Azure VM and Arc machine). Only resources whose 'kind' matches this value are evaluated. Use 'None' to disable this filter. Azure VMs do not have a 'kind' value, so setting this to AWS/GCP will exclude them from evaluation."
},
"allowedValues": [
"AWS",
"GCP",
"None"
],
"defaultValue": "None"
},
"tagFilter": {
"type": "Object",
"metadata": {
"displayName": "Inclusion Tags",
"description": "Optional inclusion tags filtering to limit which resources the policy applies to. Add any number of name/value pairs to the 'tags' array. Use AnyTags when any one tag can match, or AllTags when all specified tags must match. Leave 'tags' empty to apply the policy to all matching resources."
},
"defaultValue": {
"mode": "AnyTags",
"tags": []
},
"schema": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"AnyTags",
"AllTags"
]
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
],
"additionalProperties": false
}
}
},
"required": [
"mode",
"tags"
],
"additionalProperties": false
}
},
"BaselineSettings": {
"type": "String",
"metadata": {
"description": "A customized Baseline Security JSON payload, for customizing security rules",
"displayName": "Baseline Settings",
"strongType": "MachineConfiguration/BaselineSettings",
"portalReview": "true"
}
},
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of this policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"in": [
"Microsoft.Compute/virtualMachines",
"Microsoft.HybridCompute/machines"
]
},
{
"anyOf": [
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"anyOf": [
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "MicrosoftWindowsServer"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2008*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2012*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2016*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2019*"
}
]
},
{
"allOf": [
{
"anyOf": [
{
"field": "Microsoft.Compute/virtualMachines/osProfile.windowsConfiguration",
"exists": true
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
"like": "Windows*"
}
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imageSKU",
"exists": false
},
{
"allOf": [
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "SQL2008*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2008*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2012*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2016*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2019*"
}
]
}
]
}
]
}
]
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"value": "[parameters('IncludeArcMachines')]",
"equals": "true"
},
{
"anyOf": [
{
"field": "Microsoft.HybridCompute/machines/osSku",
"like": "Windows Server 2022*"
},
{
"field": "Microsoft.HybridCompute/machines/osSku",
"like": "Windows Server 2025*"
}
]
}
]
}
]
},
{
"anyOf": [
{
"value": "[parameters('ArcKind')]",
"equals": "None"
},
{
"field": "kind",
"equals": "[parameters('ArcKind')]"
}
]
},
{
"anyOf": [
{
"value": "[length(parameters('tagFilter').tags)]",
"equals": 0
},
{
"allOf": [
{
"value": "[parameters('tagFilter').mode]",
"equals": "AnyTags"
},
{
"count": {
"value": "[parameters('tagFilter').tags]",
"name": "tagItem",
"where": {
"value": "[if(contains(string(field('tags')), concat('\"', current('tagItem').name, '\":\"', current('tagItem').value, '\"')), equals(substring(string(field('tags')), add(indexOf(string(field('tags')), concat('\"', current('tagItem').name, '\":\"')), add(length(current('tagItem').name), 4)), length(current('tagItem').value)), current('tagItem').value), false())]",
"equals": true
}
},
"greater": 0
}
]
},
{
"allOf": [
{
"value": "[parameters('tagFilter').mode]",
"equals": "AllTags"
},
{
"count": {
"value": "[parameters('tagFilter').tags]",
"name": "tagItem",
"where": {
"value": "[if(contains(string(field('tags')), concat('\"', current('tagItem').name, '\":\"', current('tagItem').value, '\"')), equals(substring(string(field('tags')), add(indexOf(string(field('tags')), concat('\"', current('tagItem').name, '\":\"')), add(length(current('tagItem').name), 4)), length(current('tagItem').value)), current('tagItem').value), false())]",
"equals": true
}
},
"equals": "[length(parameters('tagFilter').tags)]"
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "CISWindowsSecurityBaseline",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
},
{
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/parameterHash",
"equals": "[base64(concat('CISWindowsSecurityBaseline;BaselineSettings', '=', parameters('BaselineSettings')))]"
}
]
}
}
}
},
"versions": [
"2.0.1",
"2.0.0-PREVIEW",
"1.0.1-PREVIEW",
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/6dcfa239-b481-4de9-a03f-980f24f3b0bb",
"name": "6dcfa239-b481-4de9-a03f-980f24f3b0bb"
}# Converted from CISWindowsBaseline_AINE.json by ConvertTo-Bylaw.
Policy '6dcfa239-b481-4de9-a03f-980f24f3b0bb' {
Properties @{
DisplayName = 'Center for Internet Security (CIS) Benchmarks for Windows Server'
Description = 'This policy provides you the ability to customize and deploy CIS Security Benchmarks for audit purposes to your Windows Server across Azure, on-premises and hybrid environments. The contents of the CIS Security Benchmarks are in parity with the benchmarks published at https://cisecurity.org. Requires that prerequisites are deployed to the policy assignment scope. For details, visit https://aka.ms/gcpol.'
Category = 'Guest Configuration'
Version = '2.0.1'
PolicyVersion = '2.0.1'
Mode = 'Indexed'
Metadata = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'CISWindowsSecurityBaseline'; version = '1.*'; configurationParameter = [ordered]@{ BaselineSettings = 'CISWindowsSecurityBaseline;BaselineSettings' } } }
}
Parameter IncludeArcMachines @{
Type = 'string'
AllowedValues = @('true', 'false')
Default = 'false'
DisplayName = 'Include Arc connected servers'
Description = 'By selecting this option, you agree to be charged monthly per Arc connected machine.'
JsonName = 'IncludeArcMachines'
Metadata = [ordered]@{ portalReview = 'true' }
}
Parameter ArcKind @{
AllowedValues = @('AWS', 'GCP', 'None')
Default = 'None'
DisplayName = 'Arc machine cloud provider kind'
Description = 'Optional filter applied to every evaluated resource (Azure VM and Arc machine). Only resources whose ''kind'' matches this value are evaluated. Use ''None'' to disable this filter. Azure VMs do not have a ''kind'' value, so setting this to AWS/GCP will exclude them from evaluation.'
JsonName = 'ArcKind'
}
Parameter TagFilter @{
Type = 'Object'
Default = [ordered]@{ mode = 'AnyTags'; tags = @() }
DisplayName = 'Inclusion Tags'
Description = 'Optional inclusion tags filtering to limit which resources the policy applies to. Add any number of name/value pairs to the ''tags'' array. Use AnyTags when any one tag can match, or AllTags when all specified tags must match. Leave ''tags'' empty to apply the policy to all matching resources.'
Schema = [ordered]@{
type = 'object'
properties = [ordered]@{
mode = [ordered]@{ type = 'string'; enum = @('AnyTags', 'AllTags') }
tags = [ordered]@{
type = 'array'
items = [ordered]@{
type = 'object'
properties = [ordered]@{
name = [ordered]@{ type = 'string' }
value = [ordered]@{ type = 'string' }
}
required = @('name', 'value')
additionalProperties = $false
}
}
}
required = @('mode', 'tags')
additionalProperties = $false
}
}
Parameter BaselineSettings @{
Type = 'String'
DisplayName = 'Baseline Settings'
Description = 'A customized Baseline Security JSON payload, for customizing security rules'
JsonName = 'BaselineSettings'
Metadata = [ordered]@{ strongType = 'MachineConfiguration/BaselineSettings'; portalReview = 'true' }
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of this policy'
}
Resource * {
When {
Field type | Must -BeIn @('Microsoft.Compute/virtualMachines', 'Microsoft.HybridCompute/machines')
AnyOf {
AllOf {
Field type | Must -Be 'Microsoft.Compute/virtualMachines'
AnyOf {
AllOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Be 'MicrosoftWindowsServer'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2008*'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2012*'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2016*'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2019*'
}
AllOf {
AnyOf {
Field 'Microsoft.Compute/virtualMachines/osProfile.windowsConfiguration' | Must -Exist
Field 'Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType' | Must -BeLike 'Windows*'
}
AnyOf {
Field 'Microsoft.Compute/imageSKU' | Must -Not -Exist
AllOf {
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'SQL2008*'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2008*'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2012*'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2016*'
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '2019*'
}
}
}
}
}
AllOf {
Field type | Must -Be 'Microsoft.HybridCompute/machines'
Param IncludeArcMachines | Must -Be 'true'
AnyOf {
Field 'Microsoft.HybridCompute/machines/osSku' | Must -BeLike 'Windows Server 2022*'
Field 'Microsoft.HybridCompute/machines/osSku' | Must -BeLike 'Windows Server 2025*'
}
}
}
AnyOf {
Param ArcKind | Must -Be 'None'
Field kind | Must -Be (Param ArcKind)
}
}
Require 'Requirement 1' {
Arm '[length(parameters(''tagFilter'').tags)]' | Must -Not -Be 0
}
Require 'tags are as required' {
AnyOf {
Arm '[parameters(''tagFilter'').mode]' | Must -Not -Be 'AnyTags'
Count -Value (Arm '[parameters(''tagFilter'').tags]') -Name tagItem -Where {
Arm '[if(contains(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'', current(''tagItem'').value, ''"'')), equals(substring(string(field(''tags'')), add(indexOf(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'')), add(length(current(''tagItem'').name), 4)), length(current(''tagItem'').value)), current(''tagItem'').value), false())]' | Must -Be $true
} | Must -Be 0
}
}
Require 'tags are as required' {
AnyOf {
Arm '[parameters(''tagFilter'').mode]' | Must -Not -Be 'AllTags'
Count -Value (Arm '[parameters(''tagFilter'').tags]') -Name tagItem -Where {
Arm '[if(contains(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'', current(''tagItem'').value, ''"'')), equals(substring(string(field(''tags'')), add(indexOf(string(field(''tags'')), concat(''"'', current(''tagItem'').name, ''":"'')), add(length(current(''tagItem'').name), 4)), length(current(''tagItem'').value)), current(''tagItem'').value), false())]' | Must -Be $true
} | Must -Not -Be (Arm '[length(parameters(''tagFilter'').tags)]')
}
}
}
AuditIfNotExists 'Microsoft.GuestConfiguration/guestConfigurationAssignments' -Name 'CISWindowsSecurityBaseline' -Effect (Param Effect) {
Require 'complianceStatus and parameterHash are as required' {
Field complianceStatus | Must -Be 'Compliant'
Field parameterHash | Must -Be (Arm '[base64(concat(''CISWindowsSecurityBaseline;BaselineSettings'', ''='', parameters(''BaselineSettings'')))]')
}
}
}Source: built-in-policies/policyDefinitions/Guest Configuration/CISWindowsBaseline_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw