{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "companyname": { "type": "string", "defaultValue": "myBudget", "metadata": { "description": "Default name for everything." } }, "amount": { "type": "string", "defaultValue": "1000", "metadata": { "description": "The total amount of cost or usage to track with the budget" } }, "budgetCategory": { "type": "string", "defaultValue": "Cost", "allowedValues": [ "Cost", "Usage" ], "metadata": { "description": "The category of the budget, whether the budget tracks cost or usage." } }, "timeGrain": { "type": "string", "defaultValue": "Monthly", "allowedValues": [ "Monthly", "Quarterly", "Annually" ], "metadata": { "description": "The time covered by a budget. Tracking of the amount will be reset based on the time grain." } }, "myDate": { "type": "string", "defaultValue": "[utcNow('yyyy-MM-dd')]", "metadata": { "description": "Check output in output section. " } }, "startDate": { "type": "string", "defaultValue": "[utcNow('yyyy-MM-dd')]", "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 period. Please consider impact when redeploying templates on using dates that are regenerated. " } }, "endDate": { "type": "string", "defaultValue": "", "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." } }, "operator": { "type": "string", "defaultValue": "GreaterThan", "allowedValues": [ "EqualTo", "GreaterThan", "GreaterThanOrEqualTo" ], "metadata": { "description": "The comparison operator." } }, "threshold": { "type": "string", "defaultValue": "90", "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." } }, "contactEmails": { "type": "array", "metadata": { "description": "The list of email addresses to send the budget notification to when the threshold is exceeded." } }, "contactRoles": { "type": "array", "defaultValue": [ "Owner", "Contributor", "Reader" ], "metadata": { "description": "The list of contact roles to send the budget notification to when the threshold is exceeded." } }, "contactGroups": { "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." } } }, "variables": { "budgetName": "[concat('budget-', parameters('companyname'))]" }, "resources": [ { "type": "Microsoft.Consumption/budgets", "name": "[variables('budgetName')]", "apiVersion": "2019-10-01", "properties": { "category": "[parameters('budgetCategory')]", "amount": "[parameters('amount')]", "timeGrain": "[parameters('timeGrain')]", "timePeriod": { "startDate": "[parameters('startDate')]", "endDate": "[parameters('endDate')]" }, "notifications": { "First-Notification": { "enabled": true, "operator": "[parameters('operator')]", "threshold": "[parameters('threshold')]", "contactEmails": "[parameters('contactEmails')]", "contactRoles": "[parameters('contactRoles')]", "contactGroups": "[parameters('contactGroups')]" } } } } ], "outputs": { "date": { "type": "string", "value": "[parameters('myDate')]" } } }