Skip to content

Commit

Permalink
logging: parametrize workspace sku and resource specific tags (#239)
Browse files Browse the repository at this point in the history
* logging: parametrize workspace sku and resource specific tags

* logging: updated based on feedback

* logging: update parameters files

* logging: Do not include parAutomationAccountTags and parLogAnalyticsWorkspaceTags to parameters file

Co-authored-by: Jack Tracey <[email protected]>
  • Loading branch information
olljanat and jtracey93 authored May 24, 2022
1 parent f14f4d0 commit 140cb36
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
3 changes: 3 additions & 0 deletions infra-as-code/bicep/modules/logging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ The module requires the following required input parameters.
| ------------------------------------------ | --------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| parLogAnalyticsWorkspaceName | string | Log Analytics Workspace name | Mandatory input, default: `alz-log-analytics` | `alz-log-analytics` |
| parLogAnalyticsWorkspaceLocation | string | Region name | Mandatory input, default: `resourceGroup().location` | `eastus` |
| parLogAnalyticsWorkspaceSkuName | string | Log Analytics Workspace sku name | Mandatory input, default `PerGB2018` | `PerGB2018` |
| parLogAnalyticsWorkspaceLogRetentionInDays | int | Number of days of log retention for Log Analytics Workspace | Mandatory input between 30-730, default: `365` | `365` |
| parLogAnalyticsWorkspaceSolutions | Array of string | Solutions that will be added to the Log Analytics Workspace | 1 or more of `AgentHealthAssessment`, `AntiMalware`, `AzureActivity`, `ChangeTracking`, `Security`, `SecurityInsights`, `ServiceMap`, `SQLAssessment`, `Updates`, `VMInsights`, default: *all solutions* | Empty: `[]`<br />1 Solution: `["SecurityInsights"]`<br />Many Solutions: `["SecurityInsights","VMInsights"]` |
| parAutomationAccountName | string | Automation account name | Mandatory input, name must be unique in the subscription, default: `alz-automation-account` | `alz-automation-account` |
| parAutomationAccountLocation | string | Region name | Mandatory input, default: `resourceGroup().location` | `eastus` |
| parTags | object | Empty object `{}` | Array of Tags to be applied to all resources in the logging module | `{"key": "value"}` |
| parAutomationAccountTags | object | Empty object `{}` | Array of Tags to be applied to Automation Account in the logging module | `{"key": "value"}` |
| parLogAnalyticsWorkspaceTags | object | Empty object `{}` | Array of Tags to be applied to Log Analytics Workspace in the logging module | `{"key": "value"}` |
| parTelemetryOptOut | bool | Set Parameter to true to Opt-out of deployment telemetry | Mandatory input, default: `false` | `false` |

## Outputs
Expand Down
25 changes: 22 additions & 3 deletions infra-as-code/bicep/modules/logging/logging.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ param parLogAnalyticsWorkspaceName string = 'alz-log-analytics'
@description('Log Analytics region name - Ensure the regions selected is a supported mapping as per: https://docs.microsoft.com/azure/automation/how-to/region-mappings - DEFAULT VALUE: resourceGroup().location')
param parLogAnalyticsWorkspaceLocation string = resourceGroup().location

@allowed([
'CapacityReservation'
'Free'
'LACluster'
'PerGB2018'
'PerNode'
'Premium'
'Standalone'
'Standard'
])
@description('Log Analytics Workspace sku name. - DEFAULT VALUE: PerGB2018')
param parLogAnalyticsWorkspaceSkuName string = 'PerGB2018'

@minValue(30)
@maxValue(730)
@description('Number of days of log retention for Log Analytics Workspace. - DEFAULT VALUE: 365')
Expand Down Expand Up @@ -45,6 +58,12 @@ param parAutomationAccountLocation string = resourceGroup().location
@description('Tags you would like to be applied to all resources in this module')
param parTags object = {}

@description('Tags you would like to be applied to Automation Account. - DEFAULT VALUE: parTags value')
param parAutomationAccountTags object = parTags

@description('Tags you would like to be applied to Log Analytics Workspace. - DEFAULT VALUE: parTags value')
param parLogAnalyticsWorkspaceTags object = parTags

@description('Set Parameter to true to Opt-out of deployment telemetry')
param parTelemetryOptOut bool = false

Expand All @@ -54,7 +73,7 @@ var varCuaid = 'f8087c67-cc41-46b2-994d-66e4b661860d'
resource resAutomationAccount 'Microsoft.Automation/automationAccounts@2019-06-01' = {
name: parAutomationAccountName
location: parAutomationAccountLocation
tags: parTags
tags: parAutomationAccountTags
properties: {
sku: {
name: 'Basic'
Expand All @@ -65,10 +84,10 @@ resource resAutomationAccount 'Microsoft.Automation/automationAccounts@2019-06-0
resource resLogAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2020-08-01' = {
name: parLogAnalyticsWorkspaceName
location: parLogAnalyticsWorkspaceLocation
tags: parTags
tags: parLogAnalyticsWorkspaceTags
properties: {
sku: {
name: 'PerNode'
name: parLogAnalyticsWorkspaceSkuName
}
retentionInDays: parLogAnalyticsWorkspaceLogRetentionInDays
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"parLogAnalyticsWorkspaceLocation": {
"value": "eastus"
},
"parLogAnalyticsWorkspaceSkuName": {
"value": "PerGB2018"
},
"parLogAnalyticsWorkspaceLogRetentionInDays": {
"value": 365
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"parLogAnalyticsWorkspaceLocation": {
"value": "chinaeast2"
},
"parLogAnalyticsWorkspaceSkuName": {
"value": "PerGB2018"
},
"parLogAnalyticsWorkspaceLogRetentionInDays": {
"value": 365
},
Expand Down

0 comments on commit 140cb36

Please sign in to comment.