Skip to content

Instantly share code, notes, and snippets.

@deenar
Last active July 19, 2022 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deenar/a819cd0827eed0dc228419aced16cee3 to your computer and use it in GitHub Desktop.
Save deenar/a819cd0827eed0dc228419aced16cee3 to your computer and use it in GitHub Desktop.
ARM
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"rgLocation": {
"type": "string",
"defaultValue": "northeurope",
"metadata": {
"description": "Azure region to deploy the budget automation resources in. Budgets and spends include spending on resources across all regions"
}
},
"SWCMgrEmail": {
"type": "String",
"metadata": {
"description": "SWC owner email, alerts on exceeding first budget threshold are sent to the SWC owner"
}
},
"CloudLeadsEmail": {
"type": "String",
"defaultValue": "dl-cdio-gf-risk-cloud-leads@ubs.com",
"metadata": {
"description": "Cloud leads email, alerts on exceeding second budget threshold are sent to the tower cloud leads"
}
},
"ProgMgrEmail": {
"type": "String",
"metadata": {
"description": "Programme manager email, alerts on exceeding second budget threshold are sent to the programme manager"
}
},
"StartDate": {
"type": "String",
"defaultValue": "2022-07-01",
"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."
}
},
"EndDate": {
"type": "String",
"defaultValue": "2022-12-31",
"metadata": {
"description": "The end date for the budget in YYYY-MM-DD format."
}
},
"BudgetAmount": {
"type": "int",
"defaultValue": 1000,
"metadata": {
"description": "Monthly forecast spend for subscription"
}
}
},
"variables": {},
"resources": [
{
"type": "microsoft.insights/actionGroups",
"apiVersion": "2022-06-01",
"name": "EmailSWCMgr",
"location": "Global",
"properties": {
"groupShortName": "EmailSWCMgr",
"enabled": true,
"emailReceivers": [
{
"name": "EmalSWCManager_-EmailAction-",
"emailAddress": "[parameters('SWCMgrEmail')]",
"useCommonAlertSchema": true
}
],
"smsReceivers": [],
"webhookReceivers": [],
"eventHubReceivers": [],
"itsmReceivers": [],
"azureAppPushReceivers": [],
"automationRunbookReceivers": [],
"voiceReceivers": [],
"logicAppReceivers": [],
"azureFunctionReceivers": [],
"armRoleReceivers": []
}
},
{
"type": "microsoft.insights/actionGroups",
"apiVersion": "2022-06-01",
"name": "EmailCldLead",
"location": "Global",
"properties": {
"groupShortName": "EmailCldLead",
"enabled": true,
"emailReceivers": [
{
"name": "EmalSWCManager_-EmailAction-",
"emailAddress": "[parameters('SWCMgrEmail')]",
"useCommonAlertSchema": true
},
{
"name": "EmailCloudLeads_-EmailAction-",
"emailAddress": "[parameters('CloudLeadsEmail')]",
"useCommonAlertSchema": true
},
{
"name": "EmailProgMgr_-EmailAction-",
"emailAddress": "[parameters('ProgMgrEmail')]",
"useCommonAlertSchema": true
}
],
"smsReceivers": [],
"webhookReceivers": [],
"eventHubReceivers": [],
"itsmReceivers": [],
"azureAppPushReceivers": [],
"automationRunbookReceivers": [],
"voiceReceivers": [],
"logicAppReceivers": [],
"azureFunctionReceivers": [],
"armRoleReceivers": []
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-06-01",
"name": "nestedDeployment",
"location": "[parameters('rgLocation')]",
"subscriptionId": "[subscription().subscriptionId]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {},
"resources": [
{
"type": "Microsoft.Consumption/budgets",
"apiVersion": "2021-10-01",
"name": "CDIO-GF-RISK-BUDGET",
"properties": {
"timePeriod": {
"startDate": "[parameters('StartDate')]",
"endDate": "[parameters('EndDate')]"
},
"timeGrain": "Monthly",
"amount": "[parameters('BudgetAmount')]",
"category": "Cost",
"notifications": {
"NotificationForExceededBudget1": {
"enabled": true,
"operator": "GreaterThan",
"threshold": "[90]",
"contactGroups": "[array(resourceId('Microsoft.Insights/ActionGroups', 'EmailSWCMgr'))]"
},
"NotificationForExceededBudget2": {
"enabled": true,
"operator": "GreaterThan",
"threshold": "[110]",
"contactGroups": "[array(resourceId('Microsoft.Insights/ActionGroups', 'EmailCldLead'))]"
}
}
}
}
],
"outputs": {}
}
}
}
],
"outputs": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment