diff --git a/avm/res/compute/virtual-machine/README.md b/avm/res/compute/virtual-machine/README.md index 154bf9d3ed..ed19ce117d 100644 --- a/avm/res/compute/virtual-machine/README.md +++ b/avm/res/compute/virtual-machine/README.md @@ -4972,10 +4972,10 @@ param location = '' | [`dedicatedHostId`](#parameter-dedicatedhostid) | string | Specifies resource ID about the dedicated host that the virtual machine resides in. | | [`disablePasswordAuthentication`](#parameter-disablepasswordauthentication) | bool | Specifies whether password authentication should be disabled. | | [`enableAutomaticUpdates`](#parameter-enableautomaticupdates) | bool | Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. When patchMode is set to Manual, this parameter must be set to false. For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. | -| [`enableEvictionPolicy`](#parameter-enableevictionpolicy) | bool | Specifies the eviction policy for the low priority virtual machine. Will result in 'Deallocate' eviction policy. | | [`enableHotpatching`](#parameter-enablehotpatching) | bool | Enables customers to patch their Azure VMs without requiring a reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to 'AutomaticByPlatform'. | | [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. | | [`encryptionAtHost`](#parameter-encryptionathost) | bool | This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine. This will enable the encryption for all the disks including Resource/Temp disk at host itself. For security reasons, it is recommended to set encryptionAtHost to True. Restrictions: Cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VMs. | +| [`evictionPolicy`](#parameter-evictionpolicy) | string | Specifies the eviction policy for the low priority virtual machine. | | [`extensionAadJoinConfig`](#parameter-extensionaadjoinconfig) | object | The configuration for the [AAD Join] extension. Must at least contain the ["enabled": true] property to be executed. To enroll in Intune, add the setting mdmId: "0000000a-0000-0000-c000-000000000000". | | [`extensionAntiMalwareConfig`](#parameter-extensionantimalwareconfig) | object | The configuration for the [Anti Malware] extension. Must at least contain the ["enabled": true] property to be executed. | | [`extensionAzureDiskEncryptionConfig`](#parameter-extensionazurediskencryptionconfig) | object | The configuration for the [Azure Disk Encryption] extension. Must at least contain the ["enabled": true] property to be executed. Restrictions: Cannot be enabled on disks that have encryption at host enabled. Managed disks encrypted using Azure Disk Encryption cannot be encrypted using customer-managed keys. | @@ -5073,6 +5073,7 @@ Specifies the OS disk. For security reasons, it is recommended to specify DiskEn | [`caching`](#parameter-osdiskcaching) | string | Specifies the caching requirements. | | [`createOption`](#parameter-osdiskcreateoption) | string | Specifies how the virtual machine should be created. | | [`deleteOption`](#parameter-osdiskdeleteoption) | string | Specifies whether data disk should be deleted or detached upon VM deletion. | +| [`diffDiskSettings`](#parameter-osdiskdiffdisksettings) | object | Specifies the ephemeral Disk Settings for the operating system disk. | | [`diskSizeGB`](#parameter-osdiskdisksizegb) | int | Specifies the size of an empty data disk in gigabytes. | | [`name`](#parameter-osdiskname) | string | The disk name. | @@ -5160,6 +5161,34 @@ Specifies whether data disk should be deleted or detached upon VM deletion. ] ``` +### Parameter: `osDisk.diffDiskSettings` + +Specifies the ephemeral Disk Settings for the operating system disk. + +- Required: No +- Type: object + +**Required parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`placement`](#parameter-osdiskdiffdisksettingsplacement) | string | Specifies the ephemeral disk placement for the operating system disk. | + +### Parameter: `osDisk.diffDiskSettings.placement` + +Specifies the ephemeral disk placement for the operating system disk. + +- Required: Yes +- Type: string +- Allowed: + ```Bicep + [ + 'CacheDisk' + 'NvmeDisk' + 'ResourceDisk' + ] + ``` + ### Parameter: `osDisk.diskSizeGB` Specifies the size of an empty data disk in gigabytes. @@ -5521,14 +5550,6 @@ Indicates whether Automatic Updates is enabled for the Windows virtual machine. - Type: bool - Default: `True` -### Parameter: `enableEvictionPolicy` - -Specifies the eviction policy for the low priority virtual machine. Will result in 'Deallocate' eviction policy. - -- Required: No -- Type: bool -- Default: `False` - ### Parameter: `enableHotpatching` Enables customers to patch their Azure VMs without requiring a reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to 'AutomaticByPlatform'. @@ -5553,6 +5574,21 @@ This property can be used by user in the request to enable or disable the Host E - Type: bool - Default: `True` +### Parameter: `evictionPolicy` + +Specifies the eviction policy for the low priority virtual machine. + +- Required: No +- Type: string +- Default: `'Deallocate'` +- Allowed: + ```Bicep + [ + 'Deallocate' + 'Delete' + ] + ``` + ### Parameter: `extensionAadJoinConfig` The configuration for the [AAD Join] extension. Must at least contain the ["enabled": true] property to be executed. To enroll in Intune, add the setting mdmId: "0000000a-0000-0000-c000-000000000000". @@ -5928,6 +5964,27 @@ The list of SSH public keys used to authenticate with linux based VMs. - Type: array - Default: `[]` +**Required parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`keyData`](#parameter-publickeyskeydata) | string | Specifies the SSH public key data used to authenticate through ssh. | +| [`path`](#parameter-publickeyspath) | string | Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. | + +### Parameter: `publicKeys.keyData` + +Specifies the SSH public key data used to authenticate through ssh. + +- Required: Yes +- Type: string + +### Parameter: `publicKeys.path` + +Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. + +- Required: Yes +- Type: string + ### Parameter: `rebootSetting` Specifies the reboot setting for all AutomaticByPlatform patch installation operations. diff --git a/avm/res/compute/virtual-machine/extension/main.json b/avm/res/compute/virtual-machine/extension/main.json index b2f6ae199d..8fc95f4f81 100644 --- a/avm/res/compute/virtual-machine/extension/main.json +++ b/avm/res/compute/virtual-machine/extension/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." diff --git a/avm/res/compute/virtual-machine/main.bicep b/avm/res/compute/virtual-machine/main.bicep index 1b0c9bfc97..8eabea8885 100644 --- a/avm/res/compute/virtual-machine/main.bicep +++ b/avm/res/compute/virtual-machine/main.bicep @@ -67,8 +67,12 @@ param certificatesToBeInstalled array = [] ]) param priority string = 'Regular' -@description('Optional. Specifies the eviction policy for the low priority virtual machine. Will result in \'Deallocate\' eviction policy.') -param enableEvictionPolicy bool = false +@description('Optional. Specifies the eviction policy for the low priority virtual machine.') +@allowed([ + 'Deallocate' + 'Delete' +]) +param evictionPolicy string = 'Deallocate' @description('Optional. Specifies the maximum price you are willing to pay for a low priority VM/VMSS. This price is in US Dollars.') param maxPriceForLowPriorityVm string = '' @@ -87,7 +91,7 @@ param dedicatedHostId string = '' param licenseType string = '' @description('Optional. The list of SSH public keys used to authenticate with linux based VMs.') -param publicKeys array = [] +param publicKeys publicKeyType[] = [] import { managedIdentityAllType } from 'br/public:avm/utl/types/avm-common-types:0.5.1' @description('Optional. The managed identity definition for this resource. The system-assigned managed identity will automatically be enabled if extensionAadJoinConfig.enabled = "True".') @@ -552,6 +556,12 @@ resource vm 'Microsoft.Compute/virtualMachines@2024-07-01' = { name: osDisk.?name ?? '${name}-disk-os-01' createOption: osDisk.?createOption ?? 'FromImage' deleteOption: osDisk.?deleteOption ?? 'Delete' + diffDiskSettings: empty(osDisk.?diffDiskSettings ?? {}) + ? null + : { + option: 'Local' + placement: osDisk.diffDiskSettings!.placement + } diskSizeGB: osDisk.diskSizeGB caching: osDisk.?caching ?? 'ReadOnly' managedDisk: { @@ -636,7 +646,7 @@ resource vm 'Microsoft.Compute/virtualMachines@2024-07-01' = { } : null priority: priority - evictionPolicy: enableEvictionPolicy ? 'Deallocate' : null + evictionPolicy: 'Regular' != priority ? evictionPolicy : null #disable-next-line BCP036 billingProfile: !empty(priority) && !empty(maxPriceForLowPriorityVm) ? { @@ -1071,6 +1081,12 @@ type osDiskType = { @description('Optional. Specifies the caching requirements.') caching: 'None' | 'ReadOnly' | 'ReadWrite'? + @description('Optional. Specifies the ephemeral Disk Settings for the operating system disk.') + diffDiskSettings: { + @description('Required. Specifies the ephemeral disk placement for the operating system disk.') + placement: ('CacheDisk' | 'NvmeDisk' | 'ResourceDisk') + }? + @description('Required. The managed disk parameters.') managedDisk: { @description('Optional. Specifies the storage account type for the managed disk.') @@ -1134,3 +1150,11 @@ type dataDiskType = { id: string? } } + +type publicKeyType = { + @description('Required. Specifies the SSH public key data used to authenticate through ssh.') + keyData: string + + @description('Required. Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file.') + path: string +} diff --git a/avm/res/compute/virtual-machine/main.json b/avm/res/compute/virtual-machine/main.json index 851b1dbcc0..eef376222a 100644 --- a/avm/res/compute/virtual-machine/main.json +++ b/avm/res/compute/virtual-machine/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "12106852997815543705" + "version": "0.34.44.8038", + "templateHash": "16302132468654070275" }, "name": "Virtual Machines", "description": "This module deploys a Virtual Machine with one or multiple NICs and optionally one or multiple public IPs." @@ -64,6 +64,26 @@ "description": "Optional. Specifies the caching requirements." } }, + "diffDiskSettings": { + "type": "object", + "properties": { + "placement": { + "type": "string", + "allowedValues": [ + "CacheDisk", + "NvmeDisk", + "ResourceDisk" + ], + "metadata": { + "description": "Required. Specifies the ephemeral disk placement for the operating system disk." + } + } + }, + "nullable": true, + "metadata": { + "description": "Optional. Specifies the ephemeral Disk Settings for the operating system disk." + } + }, "managedDisk": { "type": "object", "properties": { @@ -216,6 +236,23 @@ "description": "The type describing a data disk." } }, + "publicKeyType": { + "type": "object", + "properties": { + "keyData": { + "type": "string", + "metadata": { + "description": "Required. Specifies the SSH public key data used to authenticate through ssh." + } + }, + "path": { + "type": "string", + "metadata": { + "description": "Required. Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file." + } + } + } + }, "lockType": { "type": "object", "properties": { @@ -485,11 +522,15 @@ "description": "Optional. Specifies the priority for the virtual machine." } }, - "enableEvictionPolicy": { - "type": "bool", - "defaultValue": false, + "evictionPolicy": { + "type": "string", + "defaultValue": "Deallocate", + "allowedValues": [ + "Deallocate", + "Delete" + ], "metadata": { - "description": "Optional. Specifies the eviction policy for the low priority virtual machine. Will result in 'Deallocate' eviction policy." + "description": "Optional. Specifies the eviction policy for the low priority virtual machine." } }, "maxPriceForLowPriorityVm": { @@ -522,6 +563,9 @@ }, "publicKeys": { "type": "array", + "items": { + "$ref": "#/definitions/publicKeyType" + }, "defaultValue": [], "metadata": { "description": "Optional. The list of SSH public keys used to authenticate with linux based VMs." @@ -1092,6 +1136,7 @@ "name": "[coalesce(tryGet(parameters('osDisk'), 'name'), format('{0}-disk-os-01', parameters('name')))]", "createOption": "[coalesce(tryGet(parameters('osDisk'), 'createOption'), 'FromImage')]", "deleteOption": "[coalesce(tryGet(parameters('osDisk'), 'deleteOption'), 'Delete')]", + "diffDiskSettings": "[if(empty(coalesce(tryGet(parameters('osDisk'), 'diffDiskSettings'), createObject())), null(), createObject('option', 'Local', 'placement', parameters('osDisk').diffDiskSettings.placement))]", "diskSizeGB": "[parameters('osDisk').diskSizeGB]", "caching": "[coalesce(tryGet(parameters('osDisk'), 'caching'), 'ReadOnly')]", "managedDisk": { @@ -1141,7 +1186,7 @@ "proximityPlacementGroup": "[if(not(empty(parameters('proximityPlacementGroupResourceId'))), createObject('id', parameters('proximityPlacementGroupResourceId')), null())]", "virtualMachineScaleSet": "[if(not(empty(parameters('virtualMachineScaleSetResourceId'))), createObject('id', parameters('virtualMachineScaleSetResourceId')), null())]", "priority": "[parameters('priority')]", - "evictionPolicy": "[if(parameters('enableEvictionPolicy'), 'Deallocate', null())]", + "evictionPolicy": "[if(not(equals('Regular', parameters('priority'))), parameters('evictionPolicy'), null())]", "billingProfile": "[if(and(not(empty(parameters('priority'))), not(empty(parameters('maxPriceForLowPriorityVm')))), createObject('maxPrice', json(parameters('maxPriceForLowPriorityVm'))), null())]", "host": "[if(not(empty(parameters('dedicatedHostId'))), createObject('id', parameters('dedicatedHostId')), null())]", "licenseType": "[if(not(empty(parameters('licenseType'))), parameters('licenseType'), null())]", @@ -1328,8 +1373,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "4084648003861700817" + "version": "0.34.44.8038", + "templateHash": "8556043111080362230" } }, "definitions": { @@ -2957,8 +3002,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -3168,8 +3213,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -3375,8 +3420,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -3577,8 +3622,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -3784,8 +3829,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -3986,8 +4031,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -4196,8 +4241,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -4410,8 +4455,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -4618,8 +4663,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -4822,8 +4867,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -5035,8 +5080,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -5244,8 +5289,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "2171772621334669730" + "version": "0.34.44.8038", + "templateHash": "8482591295619883067" }, "name": "Virtual Machine Extensions", "description": "This module deploys a Virtual Machine Extension." @@ -5439,8 +5484,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.33.93.31351", - "templateHash": "5910828956272534599" + "version": "0.34.44.8038", + "templateHash": "7743264001610407207" }, "name": "Recovery Service Vaults Protection Container Protected Item", "description": "This module deploys a Recovery Services Vault Protection Container Protected Item." diff --git a/avm/res/compute/virtual-machine/version.json b/avm/res/compute/virtual-machine/version.json index 23f3815885..7466cbe674 100644 --- a/avm/res/compute/virtual-machine/version.json +++ b/avm/res/compute/virtual-machine/version.json @@ -1,7 +1,7 @@ { "$schema": "https://aka.ms/bicep-registry-module-version-file-schema#", - "version": "0.12", + "version": "0.13", "pathFilters": [ "./main.json" ] -} \ No newline at end of file +}