Gallery › Security Center › Azure Community Policy
Deploy Security Center Standard to Workspaces
Converted Policy AuditIfNotExists DeployIfNotExists Disabled Mode All Version 1.0.0
This Policy will Deploy the OMS Solution that enables Security Center Standard on a workspace if the solution does not exist.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 86 lines
{
"name": "eea09cce-11b4-48ea-af42-815e817f50f2",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Deploy Security Center Standard to Workspaces",
"description": "This Policy will Deploy the OMS Solution that enables Security Center Standard on a workspace if the solution does not exist.",
"metadata": {
"version": "1.0.0",
"category": "Security Center"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "DeployIfNotExists, AuditIfNotExists or Disabled the execution of the Policy"
},
"allowedValues": [
"DeployIfNotExists",
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists"
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.OperationalInsights/workspaces"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.OperationsManagement/solutions",
"name": "[concat('Security(', field('name'),')')]",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"
],
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"azureMonitorWorkspaceName": {
"type": "string"
},
"location": {
"type": "string"
}
},
"resources": [
{
"name": "[concat('Security', '(', parameters('azureMonitorWorkspaceName'), ')')]",
"type": "Microsoft.OperationsManagement/solutions",
"apiVersion": "2015-11-01-preview",
"location": "[parameters('location')]",
"plan": {
"name": "[concat('Security', '(', parameters('azureMonitorWorkspaceName'), ')')]",
"publisher": "Microsoft",
"promotionCode": "",
"product": "OMSGallery/Security"
},
"properties": {
"workspaceResourceId": "[concat(resourceGroup().id,'/providers/microsoft.operationalinsights/workspaces/', parameters('azureMonitorWorkspaceName'))]"
}
}
]
},
"parameters": {
"azureMonitorWorkspaceName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
}
}
}
}
}
}
}
}
}Bylaweea09cce-11b4-48ea-af42-815e817f50f2.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'eea09cce-11b4-48ea-af42-815e817f50f2' {
Properties @{
DisplayName = 'Deploy Security Center Standard to Workspaces'
Description = 'This Policy will Deploy the OMS Solution that enables Security Center Standard on a workspace if the solution does not exist.'
Version = '1.0.0'
Category = 'Security Center'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'AuditIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'DeployIfNotExists, AuditIfNotExists or Disabled the execution of the Policy'
}
Resource 'Microsoft.OperationalInsights/workspaces'
DeployIfNotExists 'Microsoft.OperationsManagement/solutions' -Role 'Owner' -Name (Arm '[concat(''Security('', field(''name''),'')'')]') -Effect (Param Effect) {
Deployment -TemplateFile './templates/eea09cce-11b4-48ea-af42-815e817f50f2.json' -Parameters ([ordered]@{
azureMonitorWorkspaceName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
})
}
}Its deployment templates are written beside it:
templates/eea09cce-11b4-48ea-af42-815e817f50f2.json
Source: policyDefinitions/Security Center/deploy-security-center-standard-to-workspaces/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw