Skip to content

Commit fe20f5b

Browse files
refactor: Disable automation account by default (#980)
* Disable automation account by default * Change output * Generate Parameter Markdowns [oZakari/9361d324] --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 9361d32 commit fe20f5b

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

infra-as-code/bicep/modules/logging/generateddocs/logging.bicep.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ parLogAnalyticsWorkspaceSolutions | No | Solutions that will be added to t
2323
parLogAnalyticsWorkspaceSolutionsLock | No | Resource Lock Configuration for Log Analytics Workspace Solutions. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
2424
parUserAssignedManagedIdentityName | No | Name of the User Assigned Managed Identity required for authenticating Azure Monitoring Agent to Azure.
2525
parUserAssignedManagedIdentityLocation | No | User Assigned Managed Identity location.
26+
parAutomationAccountEnabled | No | Switch to enable/disable Automation Account deployment.
2627
parLogAnalyticsWorkspaceLinkAutomationAccount | No | Log Analytics Workspace should be linked with the automation account.
2728
parAutomationAccountName | No | Automation account name.
2829
parAutomationAccountLocation | No | Automation Account region name. - Ensure the regions selected is a supported mapping as per: https://docs.microsoft.com/azure/automation/how-to/region-mappings.
@@ -208,13 +209,21 @@ User Assigned Managed Identity location.
208209

209210
- Default value: `[resourceGroup().location]`
210211

212+
### parAutomationAccountEnabled
213+
214+
![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
215+
216+
Switch to enable/disable Automation Account deployment.
217+
218+
- Default value: `False`
219+
211220
### parLogAnalyticsWorkspaceLinkAutomationAccount
212221

213222
![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
214223

215224
Log Analytics Workspace should be linked with the automation account.
216225

217-
- Default value: `True`
226+
- Default value: `False`
218227

219228
### parAutomationAccountName
220229

@@ -409,8 +418,11 @@ outAutomationAccountId | string |
409418
"parUserAssignedManagedIdentityLocation": {
410419
"value": "[resourceGroup().location]"
411420
},
421+
"parAutomationAccountEnabled": {
422+
"value": false
423+
},
412424
"parLogAnalyticsWorkspaceLinkAutomationAccount": {
413-
"value": true
425+
"value": false
414426
},
415427
"parAutomationAccountName": {
416428
"value": "alz-automation-account"

infra-as-code/bicep/modules/logging/logging.bicep

+8-4
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,15 @@ param parUserAssignedManagedIdentityName string = 'alz-logging-mi'
138138
@sys.description('User Assigned Managed Identity location.')
139139
param parUserAssignedManagedIdentityLocation string = resourceGroup().location
140140

141+
@sys.description('Switch to enable/disable Automation Account deployment.')
142+
param parAutomationAccountEnabled bool = false
143+
141144
@sys.description('Log Analytics Workspace should be linked with the automation account.')
142-
param parLogAnalyticsWorkspaceLinkAutomationAccount bool = true
145+
param parLogAnalyticsWorkspaceLinkAutomationAccount bool = false
143146

144147
@sys.description('Automation account name.')
145148
param parAutomationAccountName string = 'alz-automation-account'
149+
146150
@sys.description('Automation Account region name. - Ensure the regions selected is a supported mapping as per: https://docs.microsoft.com/azure/automation/how-to/region-mappings.')
147151
param parAutomationAccountLocation string = resourceGroup().location
148152

@@ -190,7 +194,7 @@ resource resUserAssignedManagedIdentity 'Microsoft.ManagedIdentity/userAssignedI
190194
tags: parTags
191195
}
192196

193-
resource resAutomationAccount 'Microsoft.Automation/automationAccounts@2023-11-01' = {
197+
resource resAutomationAccount 'Microsoft.Automation/automationAccounts@2024-10-23' = if (parAutomationAccountEnabled) {
194198
name: parAutomationAccountName
195199
location: parAutomationAccountLocation
196200
tags: parAutomationAccountTags
@@ -712,5 +716,5 @@ output outLogAnalyticsWorkspaceId string = resLogAnalyticsWorkspace.id
712716
output outLogAnalyticsCustomerId string = resLogAnalyticsWorkspace.properties.customerId
713717
output outLogAnalyticsSolutions array = parLogAnalyticsWorkspaceSolutions
714718

715-
output outAutomationAccountName string = resAutomationAccount.name
716-
output outAutomationAccountId string = resAutomationAccount.id
719+
output outAutomationAccountName string = parAutomationAccountEnabled ? resAutomationAccount.id : 'AA Deployment Disabled'
720+
output outAutomationAccountId string = parAutomationAccountEnabled ? resAutomationAccount.id : 'AA Deployment Disabled'

infra-as-code/bicep/modules/logging/parameters/logging.parameters.all.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
"parUserAssignedManagedIdentityName": {
3535
"value": "alz-umi-identity"
3636
},
37+
"parAutomationAccountEnabled": {
38+
"value": false
39+
},
3740
"parLogAnalyticsWorkspaceLinkAutomationAccount": {
38-
"value": true
41+
"value": false
3942
},
4043
"parAutomationAccountName": {
4144
"value": "alz-automation-account"

0 commit comments

Comments
 (0)