Skip to content

Commit

Permalink
Including option to use VMSS Flex (#678)
Browse files Browse the repository at this point in the history
* updates

* updates

* updates

* updates

* updates

* updates
  • Loading branch information
danycontre authored Oct 8, 2024
1 parent 309b329 commit 51d7a9a
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 232 deletions.
6 changes: 2 additions & 4 deletions workload/arm/brownfield/deployNewSessionHostsToHostPools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "14713858361202530562"
"templateHash": "2465926344295153346"
}
},
"parameters": {
Expand Down Expand Up @@ -1611,9 +1611,7 @@
"encryptionAtHost": {
"value": "[parameters('diskZeroTrust')]"
},
"virtualMachineScaleSetResourceId": {
"value": "[parameters('virtualMachineScaleSetResourceId')]"
},
"virtualMachineScaleSetResourceId": "[if(not(empty(parameters('virtualMachineScaleSetResourceId'))), createObject('value', parameters('virtualMachineScaleSetResourceId')), createObject('value', ''))]",
"osType": {
"value": "Windows"
},
Expand Down
460 changes: 237 additions & 223 deletions workload/arm/deploy-baseline.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion workload/bicep/brownfield/newSessionHosts/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ module sessionHosts '../../../../avm/1.0.0/res/compute/virtual-machine/main.bice
systemAssigned: true
}: null
encryptionAtHost: diskZeroTrust
virtualMachineScaleSetResourceId: virtualMachineScaleSetResourceId
virtualMachineScaleSetResourceId: !empty(virtualMachineScaleSetResourceId) ? virtualMachineScaleSetResourceId : ''
osType: 'Windows'
licenseType: 'Windows_Client'
vmSize: vmSize
Expand Down
6 changes: 5 additions & 1 deletion workload/bicep/deploy-baseline.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ param availabilityZonesCompute bool = true
@sys.description('When true, Zone Redundant Storage (ZRS) is used, when set to false, Locally Redundant Storage (LRS) is used. (Default: false)')
param zoneRedundantStorage bool = false

@sys.description('Deploys a VMSS Flex group and associates session hosts with it for availability purposes. (Default: true)')
param deployVmssFlex bool = true

@sys.description('Sets the number of fault domains for the availability set. (Default: 2)')
param vmssFlatformFaultDomainCount int = 2

Expand Down Expand Up @@ -1441,7 +1444,7 @@ module msixAzureFilesStorage './modules/storageAzureFiles/deploy.bicep' = if (va
}

// VMSS Flex
module vmScaleSetFlex './modules/avdSessionHosts/.bicep/vmScaleSet.bicep' = if (avdDeploySessionHosts) {
module vmScaleSetFlex './modules/avdSessionHosts/.bicep/vmScaleSet.bicep' = if (avdDeploySessionHosts && deployVmssFlex) {
name: 'AVD-VMSS-Flex-${time}'
scope: resourceGroup('${avdWorkloadSubsId}', '${varComputeObjectsRgName}')
params: {
Expand Down Expand Up @@ -1473,6 +1476,7 @@ module sessionHosts './modules/avdSessionHosts/deploy.bicep' = [
createIntuneEnrollment: createIntuneEnrollment
maxVmssFlexMembersCount: varMaxVmssFlexMembersCount
vmssFlexNamePrefix: varVmssFlexNamePrefix
useVmssFlex: deployVmssFlex
batchId: i - 1
computeObjectsRgName: varComputeObjectsRgName
count: i == varSessionHostBatchCount && varMaxSessionHostsDivisionRemainderValue > 0
Expand Down
5 changes: 4 additions & 1 deletion workload/bicep/modules/avdSessionHosts/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ param subscriptionId string
@sys.description('Quantity of session hosts to deploy.')
param count int

@sys.description('Associate VMs with VMSS Flex group.')
param useVmssFlex bool

@sys.description('Max VMs per availability set.')
param maxVmssFlexMembersCount int

Expand Down Expand Up @@ -178,7 +181,7 @@ module sessionHosts '../../../../avm/1.0.0/res/compute/virtual-machine/main.bice
systemAssigned: true
}: null
encryptionAtHost: encryptionAtHost
virtualMachineScaleSetResourceId: '/subscriptions/${subscriptionId}/resourceGroups/${computeObjectsRgName}/providers/Microsoft.Compute/virtualMachineScaleSets/${vmssFlexNamePrefix}-${padLeft(((1 + (i + countIndex) / maxVmssFlexMembersCount)), 3, '0')}'
virtualMachineScaleSetResourceId: useVmssFlex ? '/subscriptions/${subscriptionId}/resourceGroups/${computeObjectsRgName}/providers/Microsoft.Compute/virtualMachineScaleSets/${vmssFlexNamePrefix}-${padLeft(((1 + (i + countIndex) / maxVmssFlexMembersCount)), 3, '0')}': ''
osType: 'Windows'
licenseType: 'Windows_Client'
vmSize: vmSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
},
"deployGpuPolicies": {
"value": false
},
"deployVmssFlex": {
"value": true
}
}
}
3 changes: 2 additions & 1 deletion workload/docs/deploy-baseline.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
- **Deploy sessions hosts** - You can choose to not deploy session hosts just the Azure Virtual Desktop service objects.
- **Session host region** - Provide the region to where you want to deploy the session hosts. This defaults to the Management Plane region but can be changed.
- **Session hosts OU path (Optional)** - Provide OU where to locate session hosts, if not provided session hosts will be placed on the default (computers) OU. If left empty the computer account will be created in the default Computers OU. Example: OU=avd,DC=contoso,DC=com.
- **Availability zones** - If you deselect the checkbox, an Availability set will be created instead and session hosts will be created in the availability set. If you select the checkbox the accelerator will distribute compute and storage resources across availability zones.
- **Availability zones** - If you deselect the checkbox, VMs will be deployed regionally and will be associated with a regional VMSS Flex (if VMSS is enabled). If you select the checkbox the accelerator will distribute compute and storage resources across availability zones and will also associate the VMs with a VMSS Flex group created to use multiple availability zones.
- **VMSS Flex** - If you deselect the checkbox, no VMSS Flex will be created. If you select the checkbox, the accelerator will deploy a VMSS Flex and VMs will be associated with it.
- **VM size** - Select the SKU size for the session hosts.
- **VM count** - Select the number of session hosts to deploy.
- **OS disk type** - Select the OS Disk SKU type. Premium is recommended for performance and higher SLA.
Expand Down
1 change: 1 addition & 0 deletions workload/portal-ui/brownfield/portalUiNewSessionHosts.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
"label": "Select VMSS Flex",
"visible": true,
"resourceType": "Microsoft.Compute/virtualMachineScaleSets",
"toolTip": "Deploy and associate session hosts with a Virtual Machine Scale Set (VMSS) with Flex orchestration to distribute session hosts across fault domains.",
"constraints": {
"required": false
},
Expand Down
11 changes: 10 additions & 1 deletion workload/portal-ui/portal-ui-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,15 @@
"visible": true,
"label": "Availability zones",
"defaultValue": true,
"toolTip": "Distribute compute resources across availability zones using multi zone VMSS Flex with 1 fault domain. If 'No' is selected then a VMSS Flex will be created to host the VMs at a regional level but distributing across multiple fault domains."
"toolTip": "Distribute compute resources across availability zones using multi zone VMSS Flex with 1 fault domain (when VMSS Flex is enabled). If 'No' is selected then a VMSS Flex will be created to host the VMs at a regional level but distributing across multiple fault domains."
},
{
"name": "sessionHostsAvailabilitySettingsVmss",
"type": "Microsoft.Common.CheckBox",
"visible": true,
"label": "VMSS Flex",
"defaultValue": true,
"toolTip": "Deploy and associate session hosts with a Virtual Machine Scale Set (VMSS) with Flex orchestration to distribute session hosts across fault domains."
},
{
"name": "sessionHostsRegion",
Expand Down Expand Up @@ -2385,6 +2393,7 @@
"avdDeployScalingPlan": "[if(contains(steps('basics').resourceScope.location.name, 'china'), false, steps('managementPlane').managementPlaneHostPoolScaling.scalingPlan)]",
"avdEnterpriseAppObjectId": "[first(map(steps('managementPlane').managementPlaneHostPoolScaling.avdEnterpriseApplication.value, (item) => item.id))]",
"availabilityZonesCompute": "[if(equals(steps('sessionHosts').deploySessionHosts, true), steps('sessionHosts').sessionHostsRegionSection.sessionHostsAvailabilitySettings, false)]",
"deployVmssFlex": "[if(equals(steps('sessionHosts').deploySessionHosts, true), steps('sessionHosts').sessionHostsRegionSection.sessionHostsAvailabilitySettingsVmss, false)]",
"zoneRedundantStorage": "[if(or(steps('storage').storageFslogix.fslogixDeployment, steps('storage').storageMsix.msixDeployment), steps('storage').storageGeneralSettings.storageGeneralSettingsZoneRedundancy, false)]",
"avdDeploySessionHostsCount": "[if(equals(steps('sessionHosts').deploySessionHosts, true), steps('sessionHosts').sessionHostsSettingsSection.sessionHostsCount, 1)]",
"useSharedImage": "[if(equals(steps('sessionHosts').deploySessionHosts, true), steps('sessionHosts').sessionHostsOsSection.sessionHostsImageSource, false)]",
Expand Down

0 comments on commit 51d7a9a

Please sign in to comment.