Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
refactor based on PR 1763 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseloudon committed Mar 11, 2021
1 parent 21f7bc8 commit f40fc72
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 451 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// DEPLOYMENT SCOPE
targetScope = 'resourceGroup'

// PARAMETERS
param actionGroupName string = 'AzureSpringCleanAG'
param actionGroupEnabled bool = true
param actionGroupShortName string = 'azspgcln'
param actionGroupEmailName string = 'jloudon'
param actionGroupEmail string = 'jesse.loudon@lab3.com.au'
param actionGroupAlertSchema bool = true

// VARIABLES
param actionGroupName string
param actionGroupEnabled bool
param actionGroupShortName string
param actionGroupEmailName string
param actionGroupEmail string
param actionGroupAlertSchema bool

// OUTPUTS
output actionGroupId string = actionGroup.id
Expand All @@ -19,7 +16,7 @@ output actionGroupName string = actionGroup.name
resource actionGroup 'microsoft.insights/actionGroups@2019-06-01' = {
location: 'global'
name: actionGroupName
properties:{
properties: {
enabled: actionGroupEnabled
groupShortName: actionGroupShortName
emailReceivers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@
"contentVersion": "1.0.0.0",
"parameters": {
"actionGroupName": {
"type": "string",
"defaultValue": "AzureSpringCleanAG"
"type": "string"
},
"actionGroupEnabled": {
"type": "bool",
"defaultValue": true
"type": "bool"
},
"actionGroupShortName": {
"type": "string",
"defaultValue": "azspgcln"
"type": "string"
},
"actionGroupEmailName": {
"type": "string",
"defaultValue": "jloudon"
"type": "string"
},
"actionGroupEmail": {
"type": "string",
"defaultValue": "jesse.loudon@lab3.com.au"
"type": "string"
},
"actionGroupAlertSchema": {
"type": "bool",
"defaultValue": true
"type": "bool"
}
},
"functions": [],
Expand Down Expand Up @@ -61,7 +55,7 @@
"_generator": {
"name": "bicep",
"version": "0.3.1.62928",
"templateHash": "2965522816963686339"
"templateHash": "4471586566873631585"
}
}
}
101 changes: 53 additions & 48 deletions deployifnotexists-policy-with-initiative-and-assignment/main.bicep
Original file line number Diff line number Diff line change
@@ -1,74 +1,79 @@
// DEPLOYMENT SCOPE
targetScope = 'subscription'

// PARAMETERS
param resourceGroupName string = 'BicepExampleRG'
param location string = 'australiaeast'
param resourceGrouplocation string = 'australiaeast'
param actionGroupName string = 'BicepExampleAG'

// VARIABLES

// OUTPUTS
param actionGroupEnabled bool = true
param actionGroupShortName string = 'bicepag'
param actionGroupEmailName string = 'jloudon'
param actionGroupEmail string = 'jesse.loudon@lab3.com.au'
param actionGroupAlertSchema bool = true
param metricAlertResourceNamespace string = 'Microsoft.Network/loadBalancers'
param metricAlertName string = 'DipAvailability'
param metricAlertDimension1 string = 'ProtocolType'
param metricAlertDimension2 string = 'FrontendIPAddress'
param metricAlertDimension3 string = 'BackendIPAddress'
param metricAlertDescription string = 'Average Load Balancer health probe status per time duration'
param metricAlertSeverity string = '2'
param metricAlertEnabled string = 'true'
param metricAlertEvaluationFrequency string = 'PT15M'
param metricAlertWindowSize string = 'PT1H'
param metricAlertSensitivity string = 'Medium'
param metricAlertOperator string = 'LessThan'
param metricAlertTimeAggregation string = 'Average'
param metricAlertCriterionType string = 'DynamicThresholdCriterion'
param metricAlertAutoMitigate string = 'true'
param assignmentEnforcementMode string = 'Default'

// RESOURCES
module rg './resourceGroup.bicep' = {
scope: subscription()
name: 'resourceGroup'
params: {
resourceGroupName: resourceGroupName
location: location
}
resource rg 'Microsoft.Resources/resourceGroups@2020-06-01' = {
name: resourceGroupName
location: resourceGrouplocation
}

module ag './actionGroup.bicep' = {
scope: resourceGroup(resourceGroupName)
scope: rg
name: 'actionGroup'
params: {
actionGroupName: actionGroupName
actionGroupEnabled: true
actionGroupShortName: 'azspgcln'
actionGroupEmailName: 'jloudon'
actionGroupEmail: 'jesse.loudon@lab3.com.au'
actionGroupAlertSchema: true
actionGroupName: actionGroupName
actionGroupEnabled: actionGroupEnabled
actionGroupShortName: actionGroupShortName
actionGroupEmailName: actionGroupEmailName
actionGroupEmail: actionGroupEmail
actionGroupAlertSchema: actionGroupAlertSchema
}
dependsOn:[
rg
]
}

module policy './policyDefinition.bicep' = {
scope: subscription()
name: 'policy'
params: {
actionGroupName: ag.outputs.actionGroupName
actionGroupRG: resourceGroupName
actionGroupId: ag.outputs.actionGroupId
metricAlertResourceNamespace: 'Microsoft.Network/loadBalancers'
metricAlertName: 'DipAvailability'
metricAlertDimension1: 'ProtocolType'
metricAlertDimension2: 'FrontendIPAddress'
metricAlertDimension3: 'BackendIPAddress'
metricAlertDescription: 'Average Load Balancer health probe status per time duration'
metricAlertSeverity: '2'
metricAlertEnabled: 'true'
metricAlertEvaluationFrequency: 'PT15M'
metricAlertWindowSize: 'PT1H'
metricAlertSensitivity: 'Medium'
metricAlertOperator: 'LessThan'
metricAlertTimeAggregation: 'Average'
metricAlertCriterionType: 'DynamicThresholdCriterion'
metricAlertAutoMitigate: 'true'
actionGroupName: ag.outputs.actionGroupName
actionGroupRG: resourceGroupName
actionGroupId: ag.outputs.actionGroupId
metricAlertResourceNamespace: metricAlertResourceNamespace
metricAlertName: metricAlertName
metricAlertDimension1: metricAlertDimension1
metricAlertDimension2: metricAlertDimension2
metricAlertDimension3: metricAlertDimension3
metricAlertDescription: metricAlertDescription
metricAlertSeverity: metricAlertSeverity
metricAlertEnabled: metricAlertEnabled
metricAlertEvaluationFrequency: metricAlertEvaluationFrequency
metricAlertWindowSize: metricAlertWindowSize
metricAlertSensitivity: metricAlertSensitivity
metricAlertOperator: metricAlertOperator
metricAlertTimeAggregation: metricAlertTimeAggregation
metricAlertCriterionType: metricAlertCriterionType
metricAlertAutoMitigate: metricAlertAutoMitigate
}
}

module assignment './policyAssignment.bicep' = {
scope: subscription()
name: 'assignment'
params: {
location: location
bicepExampleInitiativeId: policy.outputs.bicepExampleInitiativeId
bicepExampleInitiativeId: policy.outputs.bicepExampleInitiativeId
assignmentIdentityLocation: resourceGrouplocation
assignmentEnforcementMode: assignmentEnforcementMode
}
dependsOn: [
policy
]
}
Loading

0 comments on commit f40fc72

Please sign in to comment.