last sync: 2021-Sep-24 16:09:49 UTC

Azure Policy definition

Virtual machines should be connected to an approved virtual network

Name Virtual machines should be connected to an approved virtual network
Azure Portal
Id d416745a-506c-48b6-8ab1-83cb814bcaa3
Version 1.0.0
details on versioning
Category Network
Microsoft docs
Description This policy audits any virtual machine connected to a virtual network that is not approved.
Mode Indexed
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Default: Audit
Allowed: (Audit, Deny, Disabled)
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2019-10-11 00:02:54 add d416745a-506c-48b6-8ab1-83cb814bcaa3
Used in Initiatives
Initiative DisplayName Initiative Id Initiative Category State
[Deprecated]: Azure Security Benchmark v1 42a694ed-f65e-42b2-aa9e-8052e9740a92 Regulatory Compliance Deprecated
HITRUST/HIPAA a169a624-5599-4385-a696-c8d643089fab Regulatory Compliance GA
JSON
{
  "displayName": "Virtual machines should be connected to an approved virtual network",
  "policyType": "BuiltIn",
  "mode": "Indexed",
  "description": "This policy audits any virtual machine connected to a virtual network that is not approved.",
  "metadata": {
    "version": "1.0.0",
    "category": "Network"
  },
  "parameters": {
    "effect": {
      "type": "String",
      "metadata": {
        "displayName": "Effect",
        "description": "The effect determines what happens when the policy rule is evaluated to match"
      },
      "allowedValues": [
        "Audit",
        "Deny",
        "Disabled"
      ],
      "defaultValue": "Audit"
    },
    "virtualNetworkId": {
      "type": "String",
      "metadata": {
        "displayName": "Virtual network Id",
        "description": "Resource Id of the virtual network. Example: /subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Network/virtualNetworks/Name"
      }
    }
  },
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Network/networkInterfaces"
        },
        {
          "not": {
            "field": "Microsoft.Network/networkInterfaces/ipconfigurations[*].subnet.id",
            "like": "[concat(parameters('virtualNetworkId'),'/*')]"
          }
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]"
    }
  }
}