Gallery › Security Center › Azure Community Policy
Deploy Azure Security Center Pricing Tier
Converted Policy AuditIfNotExists DeployIfNotExists Disabled Mode All Version 1.0.0
This will configure the ASC tier for each service on a per subscription basis. The available options are Free or Standard.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 684 lines
{
"name": "337abb15-b4b8-490a-92b9-0e4aa72e99b4",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Deploy Azure Security Center Pricing Tier",
"description": "This will configure the ASC tier for each service on a per subscription basis. The available options are Free or Standard.",
"metadata": {
"version": "1.0.0",
"category": "Security Center"
},
"mode": "All",
"parameters": {
"virtualMachinesTier": {
"type": "String",
"metadata": {
"displayName": "virtualMachinesTier",
"description": "Specifiy whether you want to enable Standard tier for Virtual Machine resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"appServicesTier": {
"type": "String",
"metadata": {
"displayName": "appServicesTier",
"description": "Specify whether you want to enable Standard tier for Azure App Service resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"sqlServersTier": {
"type": "String",
"metadata": {
"displayName": "sqlServersTier",
"description": "Specify whether you want to enable Standard tier for PaaS SQL Service resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"sqlServerVirtualMachinesTier": {
"type": "String",
"metadata": {
"displayName": "sqlServerVirtualMachinesTier",
"description": "Specify whether you want to enable Standard tier for SQL Server on VM resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"storageAccountsTier": {
"type": "String",
"metadata": {
"displayName": "storageAccountsTier",
"description": "Specify whether you want to enable Standard tier for Storage Account resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"kubernetesServiceTier": {
"type": "String",
"metadata": {
"displayName": "kubernetesServiceTier",
"description": "Specify whether you want to enable Standard tier for Kubernetes service resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"containerRegistryTier": {
"type": "String",
"metadata": {
"displayName": "containerRegistryTier",
"description": "Specify whether you want to enable Standard tier for Container Registry resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"keyVaultsTier": {
"type": "String",
"metadata": {
"displayName": "keyVaultsTier",
"description": "Specify whether you want to enable Standard tier for Key Vault resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"apiTier": {
"type": "String",
"metadata": {
"displayName": "apiTier",
"description": "Specify whether you want to enable Standard tier for api resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"armTier": {
"type": "String",
"metadata": {
"displayName": "armTier",
"description": "Specify whether you want to enable Standard tier for arm resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"dnsTier": {
"type": "String",
"metadata": {
"displayName": "dnsTier",
"description": "Specify whether you want to enable Standard tier for dns resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"cosmosDbsTier": {
"type": "String",
"metadata": {
"displayName": "cosmosDbsTier",
"description": "Specify whether you want to enable Standard tier for cosmosDb resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"openSourceRelationalDatabasesTier": {
"type": "String",
"metadata": {
"displayName": "openSourceRelationalDatabasesTier",
"description": "Specify whether you want to enable Standard tier for openSourceRelationalDatabase resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"cloudPostureTier": {
"type": "String",
"metadata": {
"displayName": "cloudPostureTier",
"description": "Specify whether you want to enable Standard tier for cloudPosture resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"containersTier": {
"type": "String",
"metadata": {
"displayName": "containersTier",
"description": "Specify whether you want to enable Standard tier for containers resource type"
},
"allowedValues": [
"Standard",
"Free"
],
"defaultValue": "Standard"
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "DeployIfNotExists, AuditIfNotExists or Disabled the execution of the Policy"
},
"allowedValues": [
"DeployIfNotExists",
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists"
}
},
"policyRule": {
"if": {
"anyOf": [
{
"field": "type",
"equals": "Microsoft.Security/pricings"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Security/pricings",
"deploymentScope": "Subscription",
"existenceScope": "Subscription",
"name": "[field('name')]",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"
],
"existenceCondition": {
"anyOf": [
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('appServicesTier')]"
},
{
"field": "name",
"equals": "AppServices"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('containerRegistryTier')]"
},
{
"field": "name",
"equals": "ContainerRegistry"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('keyVaultsTier')]"
},
{
"field": "name",
"equals": "KeyVaults"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('kubernetesServiceTier')]"
},
{
"field": "name",
"equals": "KubernetesService"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('sqlServersTier')]"
},
{
"field": "name",
"equals": "SqlServers"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('sqlServerVirtualMachinesTier')]"
},
{
"field": "name",
"equals": "SqlServerVirtualMachines"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('storageAccountsTier')]"
},
{
"field": "name",
"equals": "StorageAccounts"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('virtualMachinesTier')]"
},
{
"field": "name",
"equals": "VirtualMachines"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('apiTier')]"
},
{
"field": "name",
"equals": "Api"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('armTier')]"
},
{
"field": "name",
"equals": "Arm"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('dnsTier')]"
},
{
"field": "name",
"equals": "Dns"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('cosmosDbsTier')]"
},
{
"field": "name",
"equals": "CosmosDbs"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('openSourceRelationalDatabasesTier')]"
},
{
"field": "name",
"equals": "OpenSourceRelationalDatabases"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('cloudPostureTier')]"
},
{
"field": "name",
"equals": "CloudPosture"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Security/pricings/pricingTier",
"equals": "[parameters('containersTier')]"
},
{
"field": "name",
"equals": "Containers"
}
]
}
]
},
"deployment": {
"location": "eastus",
"properties": {
"mode": "incremental",
"parameters": {
"virtualMachinesTier": {
"value": "[parameters('virtualMachinesTier')]"
},
"appServicesTier": {
"value": "[parameters('appServicesTier')]"
},
"sqlServersTier": {
"value": "[parameters('sqlServersTier')]"
},
"sqlServerVirtualMachinesTier": {
"value": "[parameters('sqlServerVirtualMachinesTier')]"
},
"storageAccountsTier": {
"value": "[parameters('storageAccountsTier')]"
},
"kubernetesServiceTier": {
"value": "[parameters('kubernetesServiceTier')]"
},
"containerRegistryTier": {
"value": "[parameters('containerRegistryTier')]"
},
"keyVaultsTier": {
"value": "[parameters('keyVaultsTier')]"
},
"apiTier": {
"value": "[parameters('apiTier')]"
},
"armTier": {
"value": "[parameters('armTier')]"
},
"dnsTier": {
"value": "[parameters('dnsTier')]"
},
"cosmosDbsTier": {
"value": "[parameters('cosmosDbsTier')]"
},
"openSourceRelationalDatabasesTier": {
"value": "[parameters('openSourceRelationalDatabasesTier')]"
},
"cloudPostureTier": {
"value": "[parameters('cloudPostureTier')]"
},
"containersTier": {
"value": "[parameters('containersTier')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachinesTier": {
"type": "string"
},
"appServicesTier": {
"type": "string"
},
"sqlServersTier": {
"type": "string"
},
"sqlServerVirtualMachinesTier": {
"type": "string"
},
"storageAccountsTier": {
"type": "string"
},
"kubernetesServiceTier": {
"type": "string"
},
"containerRegistryTier": {
"type": "string"
},
"keyVaultsTier": {
"type": "string"
},
"apiTier": {
"type": "string"
},
"armTier": {
"type": "string"
},
"dnsTier": {
"type": "string"
},
"cosmosDbsTier": {
"type": "string"
},
"openSourceRelationalDatabasesTier": {
"type": "string"
},
"cloudPostureTier": {
"type": "string"
},
"containersTier": {
"type": "string"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "VirtualMachines",
"properties": {
"pricingTier": "[parameters('virtualMachinesTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "AppServices",
"dependsOn": [
"[concat('Microsoft.Security/pricings/VirtualMachines')]"
],
"properties": {
"pricingTier": "[parameters('appServicesTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "SqlServers",
"dependsOn": [
"[concat('Microsoft.Security/pricings/AppServices')]"
],
"properties": {
"pricingTier": "[parameters('sqlServersTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "SqlServerVirtualMachines",
"dependsOn": [
"[concat('Microsoft.Security/pricings/SqlServers')]"
],
"properties": {
"pricingTier": "[parameters('sqlServerVirtualMachinesTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "StorageAccounts",
"dependsOn": [
"[concat('Microsoft.Security/pricings/SqlServerVirtualMachines')]"
],
"properties": {
"pricingTier": "[parameters('storageAccountsTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "KubernetesService",
"dependsOn": [
"[concat('Microsoft.Security/pricings/StorageAccounts')]"
],
"properties": {
"pricingTier": "[parameters('kubernetesServiceTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "ContainerRegistry",
"dependsOn": [
"[concat('Microsoft.Security/pricings/KubernetesService')]"
],
"properties": {
"pricingTier": "[parameters('containerRegistryTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "KeyVaults",
"dependsOn": [
"[concat('Microsoft.Security/pricings/ContainerRegistry')]"
],
"properties": {
"pricingTier": "[parameters('keyVaultsTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "Api",
"dependsOn": [
"[concat('Microsoft.Security/pricings/KeyVaults')]"
],
"properties": {
"pricingTier": "[parameters('apiTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "Arm",
"dependsOn": [
"[concat('Microsoft.Security/pricings/Api')]"
],
"properties": {
"pricingTier": "[parameters('armTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "Dns",
"dependsOn": [
"[concat('Microsoft.Security/pricings/Arm')]"
],
"properties": {
"pricingTier": "[parameters('dnsTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "CosmosDbs",
"dependsOn": [
"[concat('Microsoft.Security/pricings/Dns')]"
],
"properties": {
"pricingTier": "[parameters('cosmosDbsTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "OpenSourceRelationalDatabases",
"dependsOn": [
"[concat('Microsoft.Security/pricings/CosmosDbs')]"
],
"properties": {
"pricingTier": "[parameters('openSourceRelationalDatabasesTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "CloudPosture",
"dependsOn": [
"[concat('Microsoft.Security/pricings/OpenSourceRelationalDatabases')]"
],
"properties": {
"pricingTier": "[parameters('cloudPostureTier')]"
}
},
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2018-06-01",
"name": "Containers",
"dependsOn": [
"[concat('Microsoft.Security/pricings/CloudPosture')]"
],
"properties": {
"pricingTier": "[parameters('containersTier')]"
}
}
],
"outputs": {}
}
}
}
}
}
}
}
}Bylaw337abb15-b4b8-490a-92b9-0e4aa72e99b4.bylaw.ps1 · 204 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '337abb15-b4b8-490a-92b9-0e4aa72e99b4' {
Properties @{
DisplayName = 'Deploy Azure Security Center Pricing Tier'
Description = 'This will configure the ASC tier for each service on a per subscription basis. The available options are Free or Standard.'
Version = '1.0.0'
Category = 'Security Center'
Mode = 'All'
}
Parameter VirtualMachinesTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'virtualMachinesTier'
Description = 'Specifiy whether you want to enable Standard tier for Virtual Machine resource type'
}
Parameter AppServicesTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'appServicesTier'
Description = 'Specify whether you want to enable Standard tier for Azure App Service resource type'
}
Parameter SqlServersTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'sqlServersTier'
Description = 'Specify whether you want to enable Standard tier for PaaS SQL Service resource type'
}
Parameter SqlServerVirtualMachinesTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'sqlServerVirtualMachinesTier'
Description = 'Specify whether you want to enable Standard tier for SQL Server on VM resource type'
}
Parameter StorageAccountsTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'storageAccountsTier'
Description = 'Specify whether you want to enable Standard tier for Storage Account resource type'
}
Parameter KubernetesServiceTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'kubernetesServiceTier'
Description = 'Specify whether you want to enable Standard tier for Kubernetes service resource type'
}
Parameter ContainerRegistryTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'containerRegistryTier'
Description = 'Specify whether you want to enable Standard tier for Container Registry resource type'
}
Parameter KeyVaultsTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'keyVaultsTier'
Description = 'Specify whether you want to enable Standard tier for Key Vault resource type'
}
Parameter ApiTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'apiTier'
Description = 'Specify whether you want to enable Standard tier for api resource type'
}
Parameter ArmTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'armTier'
Description = 'Specify whether you want to enable Standard tier for arm resource type'
}
Parameter DnsTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'dnsTier'
Description = 'Specify whether you want to enable Standard tier for dns resource type'
}
Parameter CosmosDbsTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'cosmosDbsTier'
Description = 'Specify whether you want to enable Standard tier for cosmosDb resource type'
}
Parameter OpenSourceRelationalDatabasesTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'openSourceRelationalDatabasesTier'
Description = 'Specify whether you want to enable Standard tier for openSourceRelationalDatabase resource type'
}
Parameter CloudPostureTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'cloudPostureTier'
Description = 'Specify whether you want to enable Standard tier for cloudPosture resource type'
}
Parameter ContainersTier @{
AllowedValues = @('Standard', 'Free')
Default = 'Standard'
DisplayName = 'containersTier'
Description = 'Specify whether you want to enable Standard tier for containers resource type'
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'AuditIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'DeployIfNotExists, AuditIfNotExists or Disabled the execution of the Policy'
}
Resource * {
Require 'type is not Microsoft.Security/pricings' {
Field type | Must -Not -Be 'Microsoft.Security/pricings' -IfPresent
}
}
DeployIfNotExists 'Microsoft.Security/pricings' -Role 'Owner' -Name (Arm '[field(''name'')]') -ExistenceScope Subscription -Effect (Param Effect) {
Require 'pricingTier and name are as required' {
AnyOf {
AllOf {
Field pricingTier | Must -Be (Param AppServicesTier)
Field name | Must -Be 'AppServices'
}
AllOf {
Field pricingTier | Must -Be (Param ContainerRegistryTier)
Field name | Must -Be 'ContainerRegistry'
}
AllOf {
Field pricingTier | Must -Be (Param KeyVaultsTier)
Field name | Must -Be 'KeyVaults'
}
AllOf {
Field pricingTier | Must -Be (Param KubernetesServiceTier)
Field name | Must -Be 'KubernetesService'
}
AllOf {
Field pricingTier | Must -Be (Param SqlServersTier)
Field name | Must -Be 'SqlServers'
}
AllOf {
Field pricingTier | Must -Be (Param SqlServerVirtualMachinesTier)
Field name | Must -Be 'SqlServerVirtualMachines'
}
AllOf {
Field pricingTier | Must -Be (Param StorageAccountsTier)
Field name | Must -Be 'StorageAccounts'
}
AllOf {
Field pricingTier | Must -Be (Param VirtualMachinesTier)
Field name | Must -Be 'VirtualMachines'
}
AllOf {
Field pricingTier | Must -Be (Param ApiTier)
Field name | Must -Be 'Api'
}
AllOf {
Field pricingTier | Must -Be (Param ArmTier)
Field name | Must -Be 'Arm'
}
AllOf {
Field pricingTier | Must -Be (Param DnsTier)
Field name | Must -Be 'Dns'
}
AllOf {
Field pricingTier | Must -Be (Param CosmosDbsTier)
Field name | Must -Be 'CosmosDbs'
}
AllOf {
Field pricingTier | Must -Be (Param OpenSourceRelationalDatabasesTier)
Field name | Must -Be 'OpenSourceRelationalDatabases'
}
AllOf {
Field pricingTier | Must -Be (Param CloudPostureTier)
Field name | Must -Be 'CloudPosture'
}
AllOf {
Field pricingTier | Must -Be (Param ContainersTier)
Field name | Must -Be 'Containers'
}
}
}
Deployment @{
TemplateFile = './templates/337abb15-b4b8-490a-92b9-0e4aa72e99b4.json'
Scope = 'Subscription'
Location = 'eastus'
Parameters = [ordered]@{
virtualMachinesTier = (Param VirtualMachinesTier)
appServicesTier = (Param AppServicesTier)
sqlServersTier = (Param SqlServersTier)
sqlServerVirtualMachinesTier = (Param SqlServerVirtualMachinesTier)
storageAccountsTier = (Param StorageAccountsTier)
kubernetesServiceTier = (Param KubernetesServiceTier)
containerRegistryTier = (Param ContainerRegistryTier)
keyVaultsTier = (Param KeyVaultsTier)
apiTier = (Param ApiTier)
armTier = (Param ArmTier)
dnsTier = (Param DnsTier)
cosmosDbsTier = (Param CosmosDbsTier)
openSourceRelationalDatabasesTier = (Param OpenSourceRelationalDatabasesTier)
cloudPostureTier = (Param CloudPostureTier)
containersTier = (Param ContainersTier)
}
}
}
}Its deployment templates are written beside it:
templates/337abb15-b4b8-490a-92b9-0e4aa72e99b4.json
Source: policyDefinitions/Security Center/deploy-azure-security-center-pricing-tier/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw