Gallery › Security Center › Azure built-in policies
Management ports should be closed on your virtual machines
Converted Policy AuditIfNotExists Disabled Mode All Version 3.0.0
Open remote management ports are exposing your VM to a high level of risk from Internet-based attacks. These attacks attempt to brute force credentials to gain admin access to the machine.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_OpenManagementPortsOnVirtualMachines_Audit.json · 55 lines
{
"properties": {
"displayName": "Management ports should be closed on your virtual machines",
"policyType": "BuiltIn",
"mode": "All",
"description": "Open remote management ports are exposing your VM to a high level of risk from Internet-based attacks. These attacks attempt to brute force credentials to gain admin access to the machine.",
"metadata": {
"version": "3.0.0",
"category": "Security Center"
},
"version": "3.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"in": [
"Microsoft.Compute/virtualMachines",
"Microsoft.ClassicCompute/virtualMachines"
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Security/assessments",
"name": "bc303248-3d14-44c2-96a0-55f5c326b5fe",
"existenceCondition": {
"field": "Microsoft.Security/assessments/status.code",
"in": [
"NotApplicable",
"Healthy"
]
}
}
}
},
"versions": [
"3.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/22730e10-96f6-4aac-ad84-9383d35b5917",
"name": "22730e10-96f6-4aac-ad84-9383d35b5917"
}Bylaw22730e10-96f6-4aac-ad84-9383d35b5917.bylaw.ps1 · 33 lines
# Converted from ASC_OpenManagementPortsOnVirtualMachines_Audit.json by ConvertTo-Bylaw.
Policy '22730e10-96f6-4aac-ad84-9383d35b5917' {
Properties @{
DisplayName = 'Management ports should be closed on your virtual machines'
Description = 'Open remote management ports are exposing your VM to a high level of risk from Internet-based attacks. These attacks attempt to brute force credentials to gain admin access to the machine.'
Version = '3.0.0'
Category = 'Security Center'
PolicyVersion = '3.0.0'
Mode = 'All'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource * {
Require 'type is not one of 2 values' {
Field type | Must -Not -BeIn @('Microsoft.Compute/virtualMachines', 'Microsoft.ClassicCompute/virtualMachines') -IfPresent
}
}
AuditIfNotExists 'Microsoft.Security/assessments' -Name 'bc303248-3d14-44c2-96a0-55f5c326b5fe' -Effect (Param Effect) {
Require 'status.code is one of 2 values' {
Field status.code | Must -BeIn @('NotApplicable', 'Healthy')
}
}
}Source: built-in-policies/policyDefinitions/Security Center/ASC_OpenManagementPortsOnVirtualMachines_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw