Gallery › HDInsight › Azure built-in policies
Azure HDInsight clusters should be injected into a virtual network
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Injecting Azure HDInsight clusters in a virtual network unlocks advanced HDInsight networking and security features and provides you with control over your network security configuration.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONVNETInjection_Audit.json · 64 lines
{
"properties": {
"displayName": "Azure HDInsight clusters should be injected into a virtual network",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Injecting Azure HDInsight clusters in a virtual network unlocks advanced HDInsight networking and security features and provides you with control over your network security configuration.",
"metadata": {
"version": "1.0.0",
"category": "HDInsight"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HDInsight/clusters"
},
{
"count": {
"field": "Microsoft.HDInsight/clusters/computeProfile.roles[*]",
"where": {
"anyOf": [
{
"field": "Microsoft.HDInsight/clusters/computeProfile.roles[*].virtualNetworkProfile.id",
"exists": false
},
{
"field": "Microsoft.HDInsight/clusters/computeProfile.roles[*].virtualNetworkProfile.subnet",
"exists": false
}
]
}
},
"greater": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b0ab5b05-1c98-40f7-bb9e-dc568e41b501",
"name": "b0ab5b05-1c98-40f7-bb9e-dc568e41b501"
}Bylawb0ab5b05-1c98-40f7-bb9e-dc568e41b501.bylaw.ps1 · 31 lines
# Converted from VNETInjection_Audit.json by ConvertTo-Bylaw.
Policy 'b0ab5b05-1c98-40f7-bb9e-dc568e41b501' {
Properties @{
DisplayName = 'Azure HDInsight clusters should be injected into a virtual network'
Description = 'Injecting Azure HDInsight clusters in a virtual network unlocks advanced HDInsight networking and security features and provides you with control over your network security configuration.'
Version = '1.0.0'
Category = 'HDInsight'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.HDInsight/clusters' {
Require 'computeProfile.roles, virtualNetworkProfile.id and virtualNetworkProfile.subnet are as required' {
Each 'computeProfile.roles[*]' {
Field virtualNetworkProfile.id | Must -Exist
Field virtualNetworkProfile.subnet | Must -Exist
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/HDInsight/VNETInjection_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw