Autoscaling virtual Desktop incompatible with ARM / BICEP Deployment

Autoscaling virtual Desktop incompatible with ARM / BICEP Deployment
0

Upvotes

Upvote

 Feb 07 2022
4 Comments (4 New)
Tell us more

In the current version of Autoscaling we get deployment errors for all machines which are shut down during a new deployment.

 

The system tries to update the Powershell DSC module every time even with machines which are shut down.

 

 

resource virtualMachines_name_Microsoft_PowerShell_DSC 'Microsoft.Compute/virtualMachines/extensions@2021-03-01' = {
  parent: virtualMachines_resource
  name: 'Microsoft.PowerShell.DSC'
  location: location
  properties: {
    autoUpgradeMinorVersion: true
    publisher: 'Microsoft.Powershell'
    type: 'DSC'
    typeHandlerVersion: '2.73'
    settings: {
      modulesUrl: modulesDSCUrl
      configurationFunction: 'Configuration.ps1\\AddSessionHost'
      properties: {
        hostPoolName: hostpoolName
        registrationInfoToken: registrationToken
        aadJoin: false
      }
    }
    protectedSettings: {}
  }
}

 

 

Comments
Microsoft

Hi @Dominic Böttger , could you please provide a bit more clarity? Are you saying that Autoscale has shut down VMs in the host pool, and at that time you are trying to add VMs to the host pool and there is a problem? What are the exact error messages you are getting?

Microsoft
Status changed to: Tell us more
 
Regular Visitor

The VMs are created and were running, autoscale did shut them down, then after some time I did some changes on another setting in my bicep, not related to the virtual desktop and I received the error unable to deploy as the machine is turned off.

So after any machine has been turned off automatically my whole deployment fails.

 

My current workaround is now to turn off the shutdown to be able to deploy the machines. So as soon as I deactivate the scaling my deployments are running again.

Regular Visitor

I did not figure out any solution. I also checked if I could check in den bicep file if the extension already exists, but this does not seem to be possible.

 

The deployment fails every single time when one of the machines have been shut down by the autoscaler as it tries to deploy the extensions every single time.


This is my current configuration:

param registrationToken string
param hostpoolName string
param vmName string
param location string
param machineImage string
param machineImageGalleryRG string
param vmAdminUser string
param vmAdminPassword string
param subnetId string


var storageSuffix = environment().suffixes.storage
var modulesDSCUrl = 'https://wvdportalstorageblob.blob.${storageSuffix}/galleryartifacts/Configuration_8-3-2021.zip'

resource networkInterfaces_resource 'Microsoft.Network/networkInterfaces@2020-11-01' = {
  name: '${vmName}-nic'
  location: location
  properties: {
    ipConfigurations: [
      {
        name: 'ipconfig'
        properties: {
          privateIPAllocationMethod: 'Dynamic'
          subnet: {
            id: subnetId
          }
          primary: true
          privateIPAddressVersion: 'IPv4'
        }
      }
    ]
    enableAcceleratedNetworking: false
    enableIPForwarding: false
  }
}

resource MachineImage 'Microsoft.Compute/galleries/images/versions@2021-07-01' existing = {
  name: machineImage
  scope: resourceGroup(machineImageGalleryRG)
}

resource virtualMachines_resource 'Microsoft.Compute/virtualMachines@2021-07-01' = {
  name: vmName
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    hardwareProfile: {
      vmSize: 'Standard_B4ms'
    }
    storageProfile: {
      imageReference: {
        id: MachineImage.id
      }
      osDisk: {
        createOption: 'FromImage'
        managedDisk: {
          storageAccountType: 'StandardSSD_LRS'
        }
        diskSizeGB: 256
      }
      dataDisks: []
    }
    osProfile: {
      computerName: vmName
      adminUsername: vmAdminUser
      adminPassword: vmAdminPassword
      windowsConfiguration: {
        provisionVMAgent: true
        enableAutomaticUpdates: true
        patchSettings: {
          patchMode: 'AutomaticByOS'
          assessmentMode: 'ImageDefault'
        }
      }
      secrets: []
      allowExtensionOperations: true
    }
    networkProfile: {
      networkInterfaces: [
        {
          id: networkInterfaces_resource.id
        }
      ]
    }
    diagnosticsProfile: {
      bootDiagnostics: {
        enabled: true
      }
    }
    licenseType: 'Windows_Client'
  }
}

var aadLoginExtensionName = 'AADLoginForWindows'

resource virtualMachineName_aadLoginExtensionName 'Microsoft.Compute/virtualMachines/extensions@2021-04-01' = {
  parent: virtualMachines_resource
  name: aadLoginExtensionName
  location: location
  properties: {
    publisher: 'Microsoft.Azure.ActiveDirectory'
    type: aadLoginExtensionName
    typeHandlerVersion: '1.0'
    autoUpgradeMinorVersion: true
    settings: {
      mdmId: '0000000a-0000-0000-c000-000000000000'
    }
  }
}

resource virtualMachines_name_Microsoft_PowerShell_DSC 'Microsoft.Compute/virtualMachines/extensions@2021-03-01' = {
  parent: virtualMachines_resource
  name: 'Microsoft.PowerShell.DSC'
  location: location
  properties: {
    autoUpgradeMinorVersion: true
    publisher: 'Microsoft.Powershell'
    type: 'DSC'
    typeHandlerVersion: '2.80'
    settings: {
      modulesUrl: modulesDSCUrl
      configurationFunction: 'Configuration.ps1\\AddSessionHost'
      properties: {
        hostPoolName: hostpoolName
        registrationInfoToken: registrationToken
        aadJoin: false
      }
    }
    protectedSettings: {}
  }
}