Gallery › Uncategorised › Azure Community Policy
Billing Tags Policy Initiative
Converted Initiative
Specify cost Center tag and product name tag
ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicyset.json · 66 lines
{
"properties": {
"displayName": "Billing Tags Policy Initiative",
"description": "Specify cost Center tag and product name tag",
"parameters": {
"costCenterValue": {
"type": "String",
"metadata": {
"displayName": "required value for Cost Center tag"
}
},
"productNameValue": {
"type": "String",
"metadata": {
"displayName": "required value for product Name tag"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
"parameters": {
"tagName": {
"value": "costCenter"
},
"tagValue": {
"value": "[parameters('costCenterValue')]"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498",
"parameters": {
"tagName": {
"value": "costCenter"
},
"tagValue": {
"value": "[parameters('costCenterValue')]"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
"parameters": {
"tagName": {
"value": "productName"
},
"tagValue": {
"value": "[parameters('productNameValue')]"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498",
"parameters": {
"tagName": {
"value": "productName"
},
"tagValue": {
"value": "[parameters('productNameValue')]"
}
}
}
]
}
}Bylawazurepolicyset.bylaw.ps1 · 53 lines
# Converted from azurepolicyset.json by ConvertTo-Bylaw.
Initiative 'azurepolicyset' {
Properties @{
DisplayName = 'Billing Tags Policy Initiative'
Description = 'Specify cost Center tag and product name tag'
}
Parameter CostCenterValue @{
Type = 'String'
DisplayName = 'required value for Cost Center tag'
}
Parameter ProductNameValue @{
Type = 'String'
DisplayName = 'required value for product Name tag'
}
PolicyDefinition @{
Id = '1e30110a-5ceb-460c-a204-c1c3969c6d62'
ReferenceId = '1e30110a-5ceb-460c-a204-c1c3969c6d62'
Parameters = [ordered]@{
tagName = 'costCenter'
tagValue = (Param CostCenterValue)
}
}
PolicyDefinition @{
Id = '2a0e14a6-b0a6-4fab-991a-187a4f81c498'
ReferenceId = '2a0e14a6-b0a6-4fab-991a-187a4f81c498'
Parameters = [ordered]@{
tagName = 'costCenter'
tagValue = (Param CostCenterValue)
}
}
PolicyDefinition @{
Id = '1e30110a-5ceb-460c-a204-c1c3969c6d62'
ReferenceId = '1e30110a-5ceb-460c-a204-c1c3969c6d62-2'
Parameters = [ordered]@{
tagName = 'productName'
tagValue = (Param ProductNameValue)
}
}
PolicyDefinition @{
Id = '2a0e14a6-b0a6-4fab-991a-187a4f81c498'
ReferenceId = '2a0e14a6-b0a6-4fab-991a-187a4f81c498-2'
Parameters = [ordered]@{
tagName = 'productName'
tagValue = (Param ProductNameValue)
}
}
}Members (4)
- Require a tag and its value on resources
- Append a tag and its value to resources
- Require a tag and its value on resources
- Append a tag and its value to resources
Source: policySetDefinitions/multiple-billing-tags/azurepolicyset.json in Azure/Community-Policy, under the MIT licence.
Bylaw