Gallery › General › Azure built-in policies
Exclude Usage Costs Resources
Converted Policy Audit Deny Disabled Mode All Version 1.2.0
This policy enables you to exclude Usage Costs Resources. Usage costs include things like metered storage and Azure resources which are billed based on usage.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONExcludeUsageCosts_Deny.json · 66 lines
{
"properties": {
"displayName": "Exclude Usage Costs Resources",
"policyType": "BuiltIn",
"mode": "All",
"description": "This policy enables you to exclude Usage Costs Resources. Usage costs include things like metered storage and Azure resources which are billed based on usage.",
"metadata": {
"version": "1.2.0",
"category": "General"
},
"version": "1.2.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"not": {
"anyOf": [
{
"field": "type",
"like": "Microsoft.SaaSHub/*"
},
{
"field": "type",
"in": [
"Microsoft.CloudPartnerProgram/memberships",
"Microsoft.Resources/subscriptions/resourcegroups",
"Microsoft.Resources/tags",
"Microsoft.Authorization/policyAssignments",
"Microsoft.Authorization/policyDefinitions",
"Microsoft.Authorization/policySetDefinitions",
"Microsoft.Authorization/denyAssignments",
"Microsoft.Authorization/roleAssignments",
"Microsoft.Authorization/roleDefinitions",
"Microsoft.AzureActiveDirectory/entraTenants",
"Microsoft.AzureActiveDirectory/directories"
]
}
]
}
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.2.0",
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/16fabb5c-7379-4433-8009-042066fa3a16",
"name": "16fabb5c-7379-4433-8009-042066fa3a16"
}Bylaw16fabb5c-7379-4433-8009-042066fa3a16.bylaw.ps1 · 31 lines
# Converted from ExcludeUsageCosts_Deny.json by ConvertTo-Bylaw.
Policy '16fabb5c-7379-4433-8009-042066fa3a16' {
Properties @{
DisplayName = 'Exclude Usage Costs Resources'
Description = 'This policy enables you to exclude Usage Costs Resources. Usage costs include things like metered storage and Azure resources which are billed based on usage.'
Version = '1.2.0'
Category = 'General'
PolicyVersion = '1.2.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource * {
Require 'type is as required' {
AnyOf {
Field type | Must -BeLike 'Microsoft.SaaSHub/*'
Field type | Must -BeIn @('Microsoft.CloudPartnerProgram/memberships', 'Microsoft.Resources/subscriptions/resourcegroups', 'Microsoft.Resources/tags', 'Microsoft.Authorization/policyAssignments', 'Microsoft.Authorization/policyDefinitions', 'Microsoft.Authorization/policySetDefinitions', 'Microsoft.Authorization/denyAssignments', 'Microsoft.Authorization/roleAssignments', 'Microsoft.Authorization/roleDefinitions', 'Microsoft.AzureActiveDirectory/entraTenants', 'Microsoft.AzureActiveDirectory/directories')
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/General/ExcludeUsageCosts_Deny.json in Azure/azure-policy, under the MIT licence.
Bylaw