Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #168 from janfaurskovgithub/fixsvchalthnotification
Browse files Browse the repository at this point in the history
Fix Service Health notification
  • Loading branch information
jfaurskov authored Jun 2, 2023
2 parents af85b74 + 78301dd commit e8a6b2a
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ targetScope = 'managementGroup'
param policyLocation string = 'centralus'
param parResourceGroupName string = 'AlzMonitoring-rg'
param parResourceGroupLocation string = 'centralus'
param parActionGroupEmail string = 'action@mail.com'
param deploymentRoleDefinitionIds array = [
'/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c'
]
param parResourceGroupTags object = {
environment: 'test'
_deployed_by_alz_monitor: true
_deployed_by_alz_monitor: true
}

param parAlertState string = 'true'
Expand All @@ -23,7 +24,7 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
description: 'DINE policy to Deploy Service Health Advisory Alert'
location: policyLocation
metadata: {
version: '1.0.1'
version: '1.1.0'
Category: 'ServiceHealth'
source: 'https://github.com/Azure/ALZ-Monitor/'
_deployed_by_alz_monitor: 'True'
Expand Down Expand Up @@ -65,6 +66,14 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
}
defaultValue: parResourceGroupLocation
}
ALZMonitorActionGroupEmail: {
type: 'String'
metadata: {
displayName: 'Action Group Email'
description: 'Email address to send alerts to'
}
defaultValue: parActionGroupEmail
}
MonitorDisable: {
type: 'String'
metadata: {
Expand Down Expand Up @@ -155,6 +164,9 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupLocation: {
type: 'string'
}
ALZMonitorActionGroupEmail: {
type: 'string'
}
policyLocation: {
type: 'string'
defaultValue: policyLocation
Expand All @@ -163,8 +175,7 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
type: 'string'
}
}
variables: {
}
variables: {}
resources: [
{
type: 'Microsoft.Resources/resourceGroups'
Expand Down Expand Up @@ -193,18 +204,31 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupName: {
type: 'string'
}
ALZMonitorActionGroupEmail: {
type: 'string'
}
}
variables: {}
resources: [
{
type: 'microsoft.insights/activityLogAlerts'
apiVersion: '2020-10-01'
location: 'global'
dependsOn: [
'''[concat(subscription().Id, '/resourceGroups/', parameters('alertResourceGroupName'), '/providers/Microsoft.Insights/actionGroups/AlzActionGrp')]'''
]
tags: {
_deployed_by_alz_monitor: true
}
name: 'ServiceHealthAdvisoryEvent'
properties: {
actions: {
actionGroups: [
{
actionGroupId: '''[concat(subscription().Id, '/resourceGroups/', parameters('alertResourceGroupName'), '/providers/Microsoft.Insights/actionGroups/AlzActionGrp')]'''
}
]
}
description: 'Service Health Advisory Alert'
enabled: '[parameters(\'enabled\')]'
scopes: [
Expand All @@ -229,6 +253,26 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
}
}
}
{
type: 'Microsoft.Insights/actionGroups'
apiVersion: '2022-04-01'
name: 'AlzActionGrp'
location: 'global'
tags: {
_deployed_by_alz_monitor: true
}
properties: {
groupShortName: 'AlzActionGrp'
enabled: true
emailReceivers: [
{
name: 'AlzMail'
emailAddress: '[parameters(\'ALZMonitorActionGroupEmail\')]'
useCommonAlertSchema: true
}
]
}
}
]
}
parameters: {
Expand All @@ -238,7 +282,10 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupName: {
value: '[parameters(\'alertResourceGroupName\')]'
}
}
ALZMonitorActionGroupEmail: {
value: '[parameters(\'ALZMonitorActionGroupEmail\')]'
}
}
}
}
]
Expand All @@ -253,6 +300,9 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupTags: {
value: '[parameters(\'alertResourceGroupTags\')]'
}
ALZMonitorActionGroupEmail: {
value: '[parameters(\'ALZMonitorActionGroupEmail\')]'
}
alertResourceGroupLocation: {
value: '[parameters(\'alertResourceGroupLocation\')]'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ targetScope = 'managementGroup'
param policyLocation string = 'centralus'
param parResourceGroupName string = 'AlzMonitoring-rg'
param parResourceGroupLocation string = 'centralus'
param parActionGroupEmail string = 'action@mail.com'
param deploymentRoleDefinitionIds array = [
'/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c'
]
param parResourceGroupTags object = {
environment: 'test'
_deployed_by_alz_monitor: true
_deployed_by_alz_monitor: true
}

param parAlertState string = 'true'
Expand All @@ -23,7 +24,7 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
description: 'DINE policy to Deploy Service Health Incident Alert'
location: policyLocation
metadata: {
version: '1.0.1'
version: '1.1.0'
Category: 'ServiceHealth'
source: 'https://github.com/Azure/ALZ-Monitor/'
_deployed_by_alz_monitor: 'True'
Expand Down Expand Up @@ -65,14 +66,21 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
}
defaultValue: parResourceGroupLocation
}

ALZMonitorActionGroupEmail: {
type: 'String'
metadata: {
displayName: 'Action Group Email'
description: 'Email address to send alerts to'
}
defaultValue: parActionGroupEmail
}
MonitorDisable: {
type: 'String'
metadata: {
displayName: 'Effect'
description: 'Tag name to disable monitoring Subscription level alerts. Set to true if monitoring should be disabled'
}

defaultValue: parMonitorDisable
}
}
Expand Down Expand Up @@ -157,6 +165,9 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupLocation: {
type: 'string'
}
ALZMonitorActionGroupEmail: {
type: 'string'
}
policyLocation: {
type: 'string'
defaultValue: policyLocation
Expand Down Expand Up @@ -194,6 +205,9 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupName: {
type: 'string'
}
ALZMonitorActionGroupEmail: {
type: 'string'
}
}
variables: {}
resources: [
Expand All @@ -202,10 +216,20 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
apiVersion: '2020-10-01'
name: 'ServieHealthIncident'
location: 'global'
dependsOn: [
'''[concat(subscription().Id, '/resourceGroups/', parameters('alertResourceGroupName'), '/providers/Microsoft.Insights/actionGroups/AlzActionGrp')]'''
]
tags: {
_deployed_by_alz_monitor: true
}
properties: {
actions: {
actionGroups: [
{
actionGroupId: '''[concat(subscription().Id, '/resourceGroups/', parameters('alertResourceGroupName'), '/providers/Microsoft.Insights/actionGroups/AlzActionGrp')]'''
}
]
}
description: 'ServiceHealthIncidentAlert'
enabled: '[parameters(\'enabled\')]'
scopes: [
Expand All @@ -231,6 +255,26 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
}
}
}
{
type: 'Microsoft.Insights/actionGroups'
apiVersion: '2022-04-01'
name: 'AlzActionGrp'
location: 'global'
tags: {
_deployed_by_alz_monitor: true
}
properties: {
groupShortName: 'AlzActionGrp'
enabled: true
emailReceivers: [
{
name: 'AlzMail'
emailAddress: '[parameters(\'ALZMonitorActionGroupEmail\')]'
useCommonAlertSchema: true
}
]
}
}
]
}
parameters: {
Expand All @@ -240,6 +284,9 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupName: {
value: '[parameters(\'alertResourceGroupName\')]'
}
ALZMonitorActionGroupEmail: {
value: '[parameters(\'ALZMonitorActionGroupEmail\')]'
}
}
}
}
Expand All @@ -258,6 +305,9 @@ module ServiceHealthIncidentAlert '../../arm/Microsoft.Authorization/policyDefin
alertResourceGroupLocation: {
value: '[parameters(\'alertResourceGroupLocation\')]'
}
ALZMonitorActionGroupEmail: {
value: '[parameters(\'ALZMonitorActionGroupEmail\')]'
}
}
}
}
Expand Down
Loading

0 comments on commit e8a6b2a

Please sign in to comment.