Skip to content

Instantly share code, notes, and snippets.

@iknowjason
Created November 9, 2023 19:26
Show Gist options
  • Save iknowjason/598ad210ca9a49ab1bed82a47b2f35bf to your computer and use it in GitHub Desktop.
Save iknowjason/598ad210ca9a49ab1bed82a47b2f35bf to your computer and use it in GitHub Desktop.
Azure policy block all vm extensions
{
"properties": {
"displayName": "Block all azure vm extensions policy",
"policyType": "Custom",
"mode": "All",
"metadata": {
"version": "2.0.0",
"createdBy": "73175a57-a138-4125-8bf9-8373cff050bf",
"createdOn": "2023-11-09T19:12:54.3579633Z",
"updatedBy": null,
"updatedOn": null
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines/extensions"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
},
"id": "/providers/Microsoft.Management/managementGroups/1a82558d-66e0-48b0-b370-72df4caf1852/providers/Microsoft.Authorization/policyDefinitions/68632339-d04c-467b-8404-30719d9347ee",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "68632339-d04c-467b-8404-30719d9347ee",
"systemData": {
"createdBy": "test@example.com",
"createdByType": "User",
"createdAt": "2023-11-09T19:12:54.3207244Z",
"lastModifiedBy": "test@example.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2023-11-09T19:12:54.3207244Z"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment