Gallery › Compute › Azure built-in policies
Virtual machines should be migrated to new Azure Resource Manager resources
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Use new Azure Resource Manager for your virtual machines to provide security enhancements such as: stronger access control (RBAC), better auditing, Azure Resource Manager based deployment and governance, access to managed identities, access to key vault for secrets, Azure AD-based authentication and support for tags and resource groups for easier security management
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONClassicCompute_Audit.json · 53 lines
{
"properties": {
"displayName": "Virtual machines should be migrated to new Azure Resource Manager resources",
"policyType": "BuiltIn",
"mode": "All",
"description": "Use new Azure Resource Manager for your virtual machines to provide security enhancements such as: stronger access control (RBAC), better auditing, Azure Resource Manager based deployment and governance, access to managed identities, access to key vault for secrets, Azure AD-based authentication and support for tags and resource groups for easier security management",
"metadata": {
"version": "1.0.0",
"category": "Compute"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"in": [
"Microsoft.ClassicCompute/virtualMachines",
"Microsoft.Compute/virtualMachines"
]
},
{
"value": "[field('type')]",
"equals": "Microsoft.ClassicCompute/virtualMachines"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/1d84d5fb-01f6-4d12-ba4f-4a26081d403d",
"name": "1d84d5fb-01f6-4d12-ba4f-4a26081d403d"
}Bylaw1d84d5fb-01f6-4d12-ba4f-4a26081d403d.bylaw.ps1 · 33 lines
# Converted from ClassicCompute_Audit.json by ConvertTo-Bylaw.
Policy '1d84d5fb-01f6-4d12-ba4f-4a26081d403d' {
Properties @{
DisplayName = 'Virtual machines should be migrated to new Azure Resource Manager resources'
Description = 'Use new Azure Resource Manager for your virtual machines to provide security enhancements such as: stronger access control (RBAC), better auditing, Azure Resource Manager based deployment and governance, access to managed identities, access to key vault for secrets, Azure AD-based authentication and support for tags and resource groups for easier security management'
Version = '1.0.0'
Category = 'Compute'
PolicyVersion = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match'
}
Resource * {
When {
Field type | Must -BeIn @('Microsoft.ClassicCompute/virtualMachines', 'Microsoft.Compute/virtualMachines')
}
Require 'type is as required' {
Arm '[field(''type'')]' | Must -Not -Be 'Microsoft.ClassicCompute/virtualMachines'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Compute/ClassicCompute_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw