Gallery › Monitoring › Azure built-in policies
Azure Monitor solution 'Security and Audit' must be deployed
Converted Policy AuditIfNotExists Disabled Mode All Version 1.0.0
This policy ensures that Security and Audit is deployed.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONSecurity_Audit_MustBeDeployed.json · 56 lines
{
"properties": {
"displayName": "Azure Monitor solution 'Security and Audit' must be deployed",
"policyType": "BuiltIn",
"mode": "All",
"description": "This policy ensures that Security and Audit is deployed.",
"metadata": {
"version": "1.0.0",
"category": "Monitoring"
},
"version": "1.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",
"equals": "Microsoft.Resources/subscriptions"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.OperationsManagement/solutions",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.OperationsManagement/solutions/provisioningState",
"equals": "Succeeded"
},
{
"field": "name",
"like": "Security(*)"
}
]
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/3e596b57-105f-48a6-be97-03e9243bad6e",
"name": "3e596b57-105f-48a6-be97-03e9243bad6e"
}Bylaw3e596b57-105f-48a6-be97-03e9243bad6e.bylaw.ps1 · 29 lines
# Converted from Security_Audit_MustBeDeployed.json by ConvertTo-Bylaw.
Policy '3e596b57-105f-48a6-be97-03e9243bad6e' {
Properties @{
DisplayName = 'Azure Monitor solution ''Security and Audit'' must be deployed'
Description = 'This policy ensures that Security and Audit is deployed.'
Version = '1.0.0'
Category = 'Monitoring'
PolicyVersion = '1.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 'Microsoft.Resources/subscriptions'
AuditIfNotExists 'Microsoft.OperationsManagement/solutions' -Effect (Param Effect) {
Require 'provisioningState is Succeeded and name is like Security(*)' {
Field provisioningState | Must -Be 'Succeeded'
Field name | Must -BeLike 'Security(*)'
}
}
}Source: built-in-policies/policyDefinitions/Monitoring/Security_Audit_MustBeDeployed.json in Azure/azure-policy, under the MIT licence.
Bylaw