From ea00133327f26cae0fc81e36dabb76300dbc7be1 Mon Sep 17 00:00:00 2001 From: Rainer Halanek Date: Fri, 20 Dec 2024 14:38:31 +0100 Subject: [PATCH] move default values --- avm/res/compute/virtual-machine/README.md | 2 +- avm/res/compute/virtual-machine/main.bicep | 23 +++++++++++----------- avm/res/compute/virtual-machine/main.json | 6 +++--- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/avm/res/compute/virtual-machine/README.md b/avm/res/compute/virtual-machine/README.md index 4c8fd9af04..6142237210 100644 --- a/avm/res/compute/virtual-machine/README.md +++ b/avm/res/compute/virtual-machine/README.md @@ -5375,7 +5375,7 @@ The configuration for the [Anti Malware] extension. Must at least contain the [" - Required: No - Type: object -- Default: `[if(equals(parameters('osType'), 'Windows'), createObject('enabled', true(), 'settings', createObject('AntimalwareEnabled', 'true', 'Exclusions', createObject(), 'RealtimeProtectionEnabled', 'true', 'ScheduledScanSettings', createObject('day', '7', 'isEnabled', 'true', 'scanType', 'Quick', 'time', '120'))), createObject('enabled', false()))]` +- Default: `[if(equals(parameters('osType'), 'Windows'), createObject('enabled', true()), createObject('enabled', false()))]` ### Parameter: `extensionAzureDiskEncryptionConfig` diff --git a/avm/res/compute/virtual-machine/main.bicep b/avm/res/compute/virtual-machine/main.bicep index 07bd8a1332..48804eb0c4 100644 --- a/avm/res/compute/virtual-machine/main.bicep +++ b/avm/res/compute/virtual-machine/main.bicep @@ -163,17 +163,6 @@ param extensionAadJoinConfig object = { param extensionAntiMalwareConfig object = osType == 'Windows' ? { enabled: true - settings: { - AntimalwareEnabled: 'true' - Exclusions: {} - RealtimeProtectionEnabled: 'true' - ScheduledScanSettings: { - day: '7' - isEnabled: 'true' - scanType: 'Quick' - time: '120' - } - } } : { enabled: false } @@ -755,7 +744,17 @@ module vm_microsoftAntiMalwareExtension 'extension/main.bicep' = if (extensionAn typeHandlerVersion: extensionAntiMalwareConfig.?typeHandlerVersion ?? '1.3' autoUpgradeMinorVersion: extensionAntiMalwareConfig.?autoUpgradeMinorVersion ?? true enableAutomaticUpgrade: extensionAntiMalwareConfig.?enableAutomaticUpgrade ?? false - settings: extensionAntiMalwareConfig.settings + settings: extensionAntiMalwareConfig.?settings ?? { + AntimalwareEnabled: 'true' + Exclusions: {} + RealtimeProtectionEnabled: 'true' + ScheduledScanSettings: { + day: '7' + isEnabled: 'true' + scanType: 'Quick' + time: '120' + } + } supressFailures: extensionAntiMalwareConfig.?supressFailures ?? false tags: extensionAntiMalwareConfig.?tags ?? tags } diff --git a/avm/res/compute/virtual-machine/main.json b/avm/res/compute/virtual-machine/main.json index 1da9a43a1b..086f446d7b 100644 --- a/avm/res/compute/virtual-machine/main.json +++ b/avm/res/compute/virtual-machine/main.json @@ -6,7 +6,7 @@ "_generator": { "name": "bicep", "version": "0.32.4.45862", - "templateHash": "17689937671944537269" + "templateHash": "18035592397318794838" }, "name": "Virtual Machines", "description": "This module deploys a Virtual Machine with one or multiple NICs and optionally one or multiple public IPs.", @@ -648,7 +648,7 @@ }, "extensionAntiMalwareConfig": { "type": "object", - "defaultValue": "[if(equals(parameters('osType'), 'Windows'), createObject('enabled', true(), 'settings', createObject('AntimalwareEnabled', 'true', 'Exclusions', createObject(), 'RealtimeProtectionEnabled', 'true', 'ScheduledScanSettings', createObject('day', '7', 'isEnabled', 'true', 'scanType', 'Quick', 'time', '120'))), createObject('enabled', false()))]", + "defaultValue": "[if(equals(parameters('osType'), 'Windows'), createObject('enabled', true()), createObject('enabled', false()))]", "metadata": { "description": "Optional. The configuration for the [Anti Malware] extension. Must at least contain the [\"enabled\": true] property to be executed." } @@ -3310,7 +3310,7 @@ "value": "[coalesce(tryGet(parameters('extensionAntiMalwareConfig'), 'enableAutomaticUpgrade'), false())]" }, "settings": { - "value": "[parameters('extensionAntiMalwareConfig').settings]" + "value": "[coalesce(tryGet(parameters('extensionAntiMalwareConfig'), 'settings'), createObject('AntimalwareEnabled', 'true', 'Exclusions', createObject(), 'RealtimeProtectionEnabled', 'true', 'ScheduledScanSettings', createObject('day', '7', 'isEnabled', 'true', 'scanType', 'Quick', 'time', '120')))]" }, "supressFailures": { "value": "[coalesce(tryGet(parameters('extensionAntiMalwareConfig'), 'supressFailures'), false())]"