Last active
April 10, 2021 08:33
-
-
Save fRanK45jPm/ef5dc3c4a6e9965b3086e0eb0cab25c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"budgetName": { | |
"defaultValue": "Allowed Budget 2021", | |
"type": "String", | |
"metadata": { | |
"description": "Name of the Budget. It should be unique within a resource group." | |
} | |
}, | |
"amount": { | |
"defaultValue": "25", | |
"type": "String", | |
"metadata": { | |
"description": "The total amount of cost or usage to track with the budget" | |
} | |
}, | |
"timeGrain": { | |
"defaultValue": "Annually", | |
"allowedValues": [ | |
"Monthly", | |
"Quarterly", | |
"Annually" | |
], | |
"type": "String", | |
"metadata": { | |
"description": "The time covered by a budget. Tracking of the amount will be reset based on the time grain." | |
} | |
}, | |
"startDate": { | |
"defaultValue": "2021-01-01", | |
"type": "String", | |
"metadata": { | |
"description": "The start date must be first of the month in YYYY-MM-DD format. Future start date should not be more than three months. Past start date should be selected within the timegrain preiod." | |
} | |
}, | |
"endDate": { | |
"defaultValue": "2021-12-31", | |
"type": "String", | |
"metadata": { | |
"description": "The end date for the budget in YYYY-MM-DD format. If not provided, we default this to 10 years from the start date." | |
} | |
}, | |
"firstThreshold": { | |
"defaultValue": "90", | |
"type": "String", | |
"metadata": { | |
"description": "Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0 and 1000." | |
} | |
}, | |
"secondThreshold": { | |
"defaultValue": "111", | |
"type": "String", | |
"metadata": { | |
"description": "Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0 and 1000." | |
} | |
}, | |
"contactRoles": { | |
"defaultValue": [ | |
"Owner", | |
"Contributor" | |
], | |
"type": "Array", | |
"metadata": { | |
"description": "The list of contact roles to send the budget notification to when the threshold is exceeded." | |
} | |
}, | |
"contactEmails": { | |
"defaultValue": [ | |
"johnm@cloudswyft.com" | |
], | |
"type": "Array", | |
"metadata": { | |
"description": "The list of email addresses to send the budget notification to when the threshold is exceeded." | |
} | |
}, | |
"contactGroups": { | |
"defaultValue": [], | |
"type": "Array", | |
"metadata": { | |
"description": "The list of action groups to send the budget notification to when the threshold is exceeded. It accepts array of strings." | |
} | |
}, | |
"resourceGroupFilterValues": { | |
"defaultValue": [], | |
"type": "Array", | |
"metadata": { | |
"description": "The set of values for the first filter" | |
} | |
}, | |
"meterCategoryFilterValues": { | |
"defaultValue": [], | |
"type": "Array", | |
"metadata": { | |
"description": "The set of values for the second filter" | |
} | |
} | |
}, | |
"variables": {}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Consumption/budgets", | |
"apiVersion": "2019-10-01", | |
"name": "[parameters('budgetName')]", | |
"properties": { | |
"timePeriod": { | |
"startDate": "[parameters('startDate')]", | |
"endDate": "[parameters('endDate')]" | |
}, | |
"timeGrain": "[parameters('timeGrain')]", | |
"amount": "[parameters('amount')]", | |
"category": "Cost", | |
"notifications": { | |
"NotificationForExceededBudget1": { | |
"enabled": true, | |
"operator": "GreaterThan", | |
"threshold": "25", | |
"contactEmails": "[parameters('contactEmails')]", | |
"contactRoles": "[parameters('contactRoles')]", | |
"contactGroups": "[parameters('contactGroups')]" | |
}, | |
"NotificationForExceededBudget2": { | |
"enabled": true, | |
"operator": "GreaterThan", | |
"threshold": "50", | |
"contactEmails": "[parameters('contactEmails')]", | |
"contactRoles": "[parameters('contactRoles')]", | |
"contactGroups": "[parameters('contactGroups')]" | |
}, | |
"NotificationForExceededBudget3": { | |
"enabled": true, | |
"operator": "GreaterThan", | |
"threshold": "75", | |
"contactEmails": "[parameters('contactEmails')]", | |
"contactRoles": "[parameters('contactRoles')]", | |
"contactGroups": "[parameters('contactGroups')]" | |
}, | |
"NotificationForExceededBudget4": { | |
"enabled": true, | |
"operator": "GreaterThan", | |
"threshold": "90", | |
"contactEmails": "[parameters('contactEmails')]", | |
"contactRoles": "[parameters('contactRoles')]", | |
"contactGroups": "[parameters('contactGroups')]" | |
}, | |
"NotificationForExceededBudget5": { | |
"enabled": true, | |
"operator": "GreaterThan", | |
"threshold": "101", | |
"contactEmails": "[parameters('contactEmails')]", | |
"contactRoles": "[parameters('contactRoles')]", | |
"contactGroups": "[parameters('contactGroups')]" | |
}, | |
"NotificationForExceededBudget6": { | |
"enabled": true, | |
"operator": "GreaterThan", | |
"threshold": "102", | |
"contactEmails": "[parameters('contactEmails')]", | |
"contactRoles": "[parameters('contactRoles')]", | |
"contactGroups": "[parameters('contactGroups')]" | |
}, | |
"NotificationForExceededBudget7": { | |
"enabled": true, | |
"operator": "GreaterThan", | |
"threshold": "103", | |
"contactEmails": "[parameters('contactEmails')]", | |
"contactRoles": "[parameters('contactRoles')]", | |
"contactGroups": "[parameters('contactGroups')]" | |
} | |
}, | |
"filter": { | |
"and": [ | |
{ | |
"dimensions": { | |
"name": "ResourceGroupName", | |
"operator": "In", | |
"values": "[parameters('resourceGroupFilterValues')]" | |
} | |
}, | |
{ | |
"dimensions": { | |
"name": "MeterCategory", | |
"operator": "In", | |
"values": "[parameters('meterCategoryFilterValues')]" | |
} | |
} | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment