Skip to content

Commit 02ac911

Browse files
Updated Compute resources with security recommendations (#947)
* Updated security diskEncyptionSet * Updated VirtualMAchine with security recommendations * Updated bicep file * Updated readme * Fix readme * Updated VM module with security recommendations * Updated VM scale set and VM descriptions and readme * Fixed parameters file problems * Added diskEncryptionSetId to VMs files * Added diskEncryptionSet * Updated VM scale set diskEncryptionSet * Updated oSDisk description into bicep and readme files * Commented extensionDiskEncryptionConfig * Updated readmes and commented extension on VMs * Updated Readmes and bicep descriptions * Uncommented encryption extension and removed diskEncryptionSet * Updating Readme based on Linter error * Updated api version based on broken links check error Co-authored-by: Elena Batanero García <elbatane@microsoft.com>
1 parent 9559a1f commit 02ac911

11 files changed

Lines changed: 93 additions & 19 deletions

File tree

arm/Microsoft.Compute/diskEncryptionSets/deploy.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ param keyVaultId string
1010
@description('Required. Key URL (with version) pointing to a key or secret in KeyVault.')
1111
param keyUrl string
1212

13-
@description('Optional. The type of key used to encrypt the data of the disk.')
13+
@description('Optional. The type of key used to encrypt the data of the disk. For security reasons, it is recommended to set encryptionType to EncryptionAtRestWithPlatformAndCustomerKeys')
1414
@allowed([
1515
'EncryptionAtRestWithCustomerKey'
1616
'EncryptionAtRestWithPlatformAndCustomerKeys'
1717
])
18-
param encryptionType string = 'EncryptionAtRestWithCustomerKey'
18+
param encryptionType string = 'EncryptionAtRestWithPlatformAndCustomerKeys'
1919

2020
@description('Optional. Set this flag to true to enable auto-updating of this disk encryption set to the latest key version.')
2121
param rotationToLatestKeyVersionEnabled bool = false

arm/Microsoft.Compute/diskEncryptionSets/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This template deploys a disk encryption set.
1515
| Parameter Name | Type | Default Value | Possible Values | Description |
1616
| :-- | :-- | :-- | :-- | :-- |
1717
| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered |
18-
| `encryptionType` | string | `EncryptionAtRestWithCustomerKey` | `[EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys]` | Optional. The type of key used to encrypt the data of the disk. |
18+
| `encryptionType` | string | `EncryptionAtRestWithPlatformAndCustomerKeys` | `[EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys]` | Optional. The type of key used to encrypt the data of the disk. For security reasons, it is recommended to set 'encryptionType' to 'EncryptionAtRestWithPlatformAndCustomerKeys' |
1919
| `keyUrl` | string | | | Required. Key URL (with version) pointing to a key or secret in KeyVault. |
2020
| `keyVaultId` | string | | | Required. Resource ID of the KeyVault containing the key or secret. |
2121
| `location` | string | `[resourceGroup().location]` | | Optional. Resource location. |

arm/Microsoft.Compute/virtualMachineScaleSets/.parameters/linux.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"osType": {
5252
"value": "Linux"
5353
},
54+
"encryptionAtHost": {
55+
"value": false
56+
},
5457
"imageReference": {
5558
"value": {
5659
"publisher": "Canonical",

arm/Microsoft.Compute/virtualMachineScaleSets/.parameters/windows.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"osType": {
4141
"value": "Windows"
4242
},
43+
"encryptionAtHost": {
44+
"value": false
45+
},
4346
"imageReference": {
4447
"value": {
4548
"publisher": "MicrosoftWindowsServer",

arm/Microsoft.Compute/virtualMachineScaleSets/deploy.bicep

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,28 @@ param name string
44
@description('Optional. Location for all resources.')
55
param location string = resourceGroup().location
66

7+
@description('Optional. 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 virtual machine scale sets.')
8+
param encryptionAtHost bool = true
9+
10+
@description('Optional. Specifies the SecurityType of the virtual machine scale set. It is set as TrustedLaunch to enable UefiSettings.')
11+
param securityType string = ''
12+
13+
@description('Optional. Specifies whether secure boot should be enabled on the virtual machine scale set. This parameter is part of the UefiSettings. SecurityType should be set to TrustedLaunch to enable UefiSettings.')
14+
param secureBootEnabled bool = false
15+
16+
@description('Optional. Specifies whether vTPM should be enabled on the virtual machine scale set. This parameter is part of the UefiSettings. SecurityType should be set to TrustedLaunch to enable UefiSettings.')
17+
param vTpmEnabled bool = false
18+
719
@description('Required. OS image reference. In case of marketplace images, it\'s the combination of the publisher, offer, sku, version attributes. In case of custom images it\'s the resource ID of the custom image.')
820
param imageReference object
921

1022
@description('Optional. Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use.')
1123
param plan object = {}
1224

13-
@description('Required. Specifies the OS disk.')
25+
@description('Required. Specifies the OS disk. For security reasons, it is recommended to specify DiskEncryptionSet into the osDisk object. Restrictions: DiskEncryptionSet cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VM Scale sets.')
1426
param osDisk object
1527

16-
@description('Optional. Specifies the data disks.')
28+
@description('Optional. Specifies the data disks. For security reasons, it is recommended to specify DiskEncryptionSet into the dataDisk object. Restrictions: DiskEncryptionSet cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VM Scale sets.')
1729
param dataDisks array = []
1830

1931
@description('Optional. The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled.')
@@ -377,6 +389,15 @@ resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2021-04-01' = {
377389
linuxConfiguration: osType == 'Linux' ? linuxConfiguration : null
378390
secrets: secrets
379391
}
392+
securityProfile: {
393+
encryptionAtHost: encryptionAtHost
394+
securityType: securityType
395+
uefiSettings: securityType == 'TrustedLaunch' ? {
396+
secureBootEnabled: secureBootEnabled
397+
vTpmEnabled: vTpmEnabled
398+
} : null
399+
400+
}
380401
storageProfile: {
381402
imageReference: imageReference
382403
osDisk: {
@@ -390,7 +411,7 @@ resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2021-04-01' = {
390411
vhdContainers: contains(osDisk, 'vhdContainers') ? osDisk.vhdContainers : null
391412
managedDisk: {
392413
storageAccountType: osDisk.managedDisk.storageAccountType
393-
diskEncryptionSet: contains(osDisk, 'diskEncryptionSet') ? osDisk.diskEncryptionSet : null
414+
diskEncryptionSet: contains(osDisk.managedDisk, 'diskEncryptionSet') ? osDisk.managedDisk.diskEncryptionSet : null
394415
}
395416
}
396417
dataDisks: [for (item, j) in dataDisks: {

arm/Microsoft.Compute/virtualMachineScaleSets/readme.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The following resources are required to be able to deploy this resource.
3333
| `bootDiagnosticStorageAccountUri` | string | `[format('.blob.{0}/', environment().suffixes.storage)]` | | Optional. Storage account boot diagnostic base URI. |
3434
| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered |
3535
| `customData` | string | | | Optional. Custom data associated to the VM, this value will be automatically converted into base64 to account for the expected VM format. |
36-
| `dataDisks` | array | `[]` | | Optional. Specifies the data disks. |
36+
| `dataDisks` | array | `[]` | | Optional. Specifies the data disks. For security reasons, it is recommended to specify DiskEncryptionSet into the dataDisk object. Restrictions: DiskEncryptionSet cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VM Scale sets. |
3737
| `diagnosticEventHubAuthorizationRuleId` | string | | | Optional. Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to. |
3838
| `diagnosticEventHubName` | string | | | Optional. Name of the diagnostic event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. |
3939
| `diagnosticLogsRetentionInDays` | int | `365` | | Optional. Specifies the number of days that logs will be kept for; a value of 0 will retain data indefinitely. |
@@ -46,6 +46,7 @@ The following resources are required to be able to deploy this resource.
4646
| `enableAutomaticUpdates` | bool | `True` | | Optional. Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. |
4747
| `enableEvictionPolicy` | bool | | | Optional. Specifies the eviction policy for the low priority virtual machine. Will result in 'Deallocate' eviction policy. |
4848
| `enableServerSideEncryption` | bool | | | Optional. Specifies if Windows VM disks should be encrypted with Server-side encryption + Customer managed Key. |
49+
| `encryptionAtHost` | bool | `True` | | Optional. This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine scale set. 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 VM Scale sets. |
4950
| `extensionAntiMalwareConfig` | object | `{object}` | | Optional. The configuration for the [Anti Malware] extension. Must at least contain the ["enabled": true] property to be executed |
5051
| `extensionCustomScriptConfig` | object | `{object}` | | Optional. The configuration for the [Custom Script] extension. Must at least contain the ["enabled": true] property to be executed |
5152
| `extensionDependencyAgentConfig` | object | `{object}` | | Optional. The configuration for the [Dependency Agent] extension. Must at least contain the ["enabled": true] property to be executed |
@@ -68,7 +69,7 @@ The following resources are required to be able to deploy this resource.
6869
| `monitoringWorkspaceId` | string | | | Optional. Resource ID of the monitoring log analytics workspace. |
6970
| `name` | string | | | Required. Name of the VMSS. |
7071
| `nicConfigurations` | array | `[]` | | Required. Configures NICs and PIPs. |
71-
| `osDisk` | object | | | Required. Specifies the OS disk. |
72+
| `osDisk` | object | | | Required. Specifies the OS disk. For security reasons, it is recommended to specify DiskEncryptionSet into the osDisk object. Restrictions: DiskEncryptionSet cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VM Scale sets.|
7273
| `osType` | string | | `[Windows, Linux]` | Required. The chosen OS type |
7374
| `overprovision` | bool | | | Optional. Specifies whether the Virtual Machine Scale Set should be overprovisioned. |
7475
| `pauseTimeBetweenBatches` | string | `PT0S` | | Optional. The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format |
@@ -83,17 +84,20 @@ The following resources are required to be able to deploy this resource.
8384
| `scaleSetFaultDomain` | int | `2` | | Optional. Fault Domain count for each placement group. |
8485
| `scheduledEventsProfile` | object | `{object}` | | Optional. Specifies Scheduled Event related configurations |
8586
| `secrets` | array | `[]` | | Optional. Specifies set of certificates that should be installed onto the virtual machines in the scale set. |
87+
| `securityType` | string | | `TrustedLaunch` | Optional. Specifies the SecurityType of the virtual machine scale set. It is set as TrustedLaunch to enable UefiSettings. |
88+
| `secureBootEnabled` | bool | `False` | | Optional. Specifies whether secure boot should be enabled on the virtual machine scale set. This parameter is part of the UefiSettings. SecurityType should be set to TrustedLaunch to enable UefiSettings. |
8689
| `singlePlacementGroup` | bool | `True` | | Optional. When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup is false, it may not be modified to true. |
8790
| `skuCapacity` | int | `1` | | Optional. The initial instance count of scale set VMs. |
8891
| `skuName` | string | | | Required. The SKU size of the VMs. |
8992
| `systemAssignedIdentity` | bool | | | Optional. Enables system assigned managed identity on the resource. |
9093
| `tags` | object | `{object}` | | Optional. Tags of the resource. |
91-
| `timeZone` | string | | | Optional. Specifies the time zone of the virtual machine. e.g. 'Pacific Standard Time'. Possible values can be TimeZoneInfo.id value from time zones returned by TimeZoneInfo.GetSystemTimeZones. |
94+
| `timeZone` | string | | | Optional. Specifies the time zone of the virtual machine. e.g. 'Pacific Standard Time'. Possible values can be 'TimeZoneInfo.id' value from time zones returned by TimeZoneInfo.GetSystemTimeZones. |
9295
| `ultraSSDEnabled` | bool | | | Optional. The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled. |
9396
| `upgradePolicyMode` | string | `Manual` | `[Manual, Automatic, Rolling]` | Optional. Specifies the mode of an upgrade to virtual machines in the scale set.' Manual - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action. ; Automatic - All virtual machines in the scale set are automatically updated at the same time. - Automatic, Manual, Rolling |
9497
| `userAssignedIdentities` | object | `{object}` | | Optional. The ID(s) to assign to the resource. |
9598
| `vmNamePrefix` | string | `vmssvm` | | Optional. Specifies the computer name prefix for all of the virtual machines in the scale set. |
9699
| `vmPriority` | string | `Regular` | `[Regular, Low, Spot]` | Optional. Specifies the priority for the virtual machine. |
100+
| `vTpmEnabled` | bool | `False` | | Optional. Specifies whether vTPM should be enabled on the virtual machine scale set. This parameter is part of the UefiSettings. SecurityType should be set to TrustedLaunch to enable UefiSettings. |
97101
| `winRM` | object | `{object}` | | Optional. Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - WinRMConfiguration object. |
98102
| `zoneBalance` | bool | | | Optional. Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. |
99103

@@ -140,7 +144,10 @@ The following resources are required to be able to deploy this resource.
140144
"createOption": "fromImage",
141145
"diskSizeGB": "128",
142146
"managedDisk": {
143-
"storageAccountType": "Premium_LRS"
147+
"storageAccountType": "Premium_LRS",
148+
"diskEncryptionSet": { // Restrictions: DiskEncryptionSet cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VM Scale sets.
149+
"id": "/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/diskEncryptionSets/<desName>"
150+
}
144151
}
145152
}
146153
}

arm/Microsoft.Compute/virtualMachines/.parameters/linux.parameters.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"osType": {
1717
"value": "Linux"
1818
},
19+
"encryptionAtHost": {
20+
"value": false
21+
},
1922
"imageReference": {
2023
"value": {
2124
"publisher": "Canonical",
@@ -34,6 +37,7 @@
3437
}
3538
}
3639
},
40+
3741
"adminUsername": {
3842
"value": "localAdminUser"
3943
},

arm/Microsoft.Compute/virtualMachines/.parameters/windows.parameters.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"name": {
66
"value": "<<namePrefix>>-vm-win-01"
77
},
8+
"encryptionAtHost": {
9+
"value": false
10+
},
811
"imageReference": {
912
"value": {
1013
"publisher": "MicrosoftWindowsServer",
@@ -23,9 +26,12 @@
2326
"diskSizeGB": "128",
2427
"managedDisk": {
2528
"storageAccountType": "Premium_LRS"
29+
2630
}
31+
2732
}
2833
},
34+
2935
"adminUsername": {
3036
"value": "localAdminUser"
3137
},

arm/Microsoft.Compute/virtualMachines/deploy.bicep

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,28 @@ param vmComputerNamesTransformation string = 'none'
88
@description('Optional. Specifies the size for the VMs')
99
param vmSize string = 'Standard_D2s_v3'
1010

11+
@description('Optional. 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.')
12+
param encryptionAtHost bool = true
13+
14+
@description('Optional. Specifies the SecurityType of the virtual machine. It is set as TrustedLaunch to enable UefiSettings.')
15+
param securityType string = ''
16+
17+
@description('Optional. Specifies whether secure boot should be enabled on the virtual machine. This parameter is part of the UefiSettings. SecurityType should be set to TrustedLaunch to enable UefiSettings.')
18+
param secureBootEnabled bool = false
19+
20+
@description('Optional. Specifies whether vTPM should be enabled on the virtual machine. This parameter is part of the UefiSettings. SecurityType should be set to TrustedLaunch to enable UefiSettings.')
21+
param vTpmEnabled bool = false
22+
1123
@description('Required. OS image reference. In case of marketplace images, it\'s the combination of the publisher, offer, sku, version attributes. In case of custom images it\'s the resource ID of the custom image.')
1224
param imageReference object
1325

1426
@description('Optional. Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use.')
1527
param plan object = {}
1628

17-
@description('Required. Specifies the OS disk.')
29+
@description('Required. Specifies the OS disk. For security reasons, it is recommended to specify DiskEncryptionSet into the osDisk object. Restrictions: DiskEncryptionSet cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VMs.')
1830
param osDisk object
1931

20-
@description('Optional. Specifies the data disks.')
32+
@description('Optional. Specifies the data disks. For security reasons, it is recommended to specify DiskEncryptionSet into the dataDisk object. Restrictions: DiskEncryptionSet cannot be enabled if Azure Disk Encryption (guest-VM encryption using bitlocker/DM-Crypt) is enabled on your VMs.')
2133
param dataDisks array = []
2234

2335
@description('Optional. The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled.')
@@ -344,6 +356,15 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-07-01' = {
344356
hardwareProfile: {
345357
vmSize: vmSize
346358
}
359+
securityProfile: {
360+
encryptionAtHost: encryptionAtHost
361+
securityType: securityType
362+
uefiSettings: securityType == 'TrustedLaunch' ? {
363+
secureBootEnabled: secureBootEnabled
364+
vTpmEnabled: vTpmEnabled
365+
} : null
366+
367+
}
347368
storageProfile: {
348369
imageReference: imageReference
349370
osDisk: {
@@ -353,6 +374,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-07-01' = {
353374
diskSizeGB: osDisk.diskSizeGB
354375
managedDisk: {
355376
storageAccountType: osDisk.managedDisk.storageAccountType
377+
diskEncryptionSet: contains(osDisk.managedDisk, 'diskEncryptionSet') ? osDisk.managedDisk.diskEncryptionSet : null
356378
}
357379
}
358380
dataDisks: [for (dataDisk, index) in dataDisks: {

0 commit comments

Comments
 (0)