Forum Discussion

StefanKi's avatar
StefanKi
Iron Contributor
Sep 25, 2024

AVD and Bicep

Hello, 

 

I’m trying to deploy AVD as ADD joined using bicep but it failed. The session host is created but not correctly assigned to the host pool. There is always an error with the DomainTrustCheck and DomainJoinedCheck

 

My code:

resource joinAzuredomain 'Microsoft.Compute/virtualMachines/extensions@2024-07-01' = {
  name: '${vmPrefix}/joinAzuredomain'
  location: location
  properties: {
    publisher: 'Microsoft.Azure.ActiveDirectory'
    type: 'AADLoginForWindows'
    typeHandlerVersion: '1.0'
    autoUpgradeMinorVersion: true
  }
  dependsOn: [
    vm
  ]
} 

resource dscextension 'Microsoft.Compute/virtualMachines/extensions@2024-07-01' =  {
name: '${vmPrefix}/dscextension'
  location: location
  properties: {
    publisher: 'Microsoft.Powershell'
    type: 'DSC'
    typeHandlerVersion: '2.73'
    autoUpgradeMinorVersion: true
    settings: {
      modulesUrl: 'https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Configuration_1.0.02627.270.zip'
      configurationFunction: 'Configuration.ps1\\AddSessionHost'
      properties: {
        HostPoolName: hostPoolName
        registrationInfoToken: HostPoolToken
        aadJoin: AADJoin
      }
    }
  }
  dependsOn: [
    joinAzuredomain
  ]
}

I follow steps found on the following links to make most of my deployment.

Ref : https://rozemuller.com/avd-automation-cocktail-avd-with-bicep-and-azure-cli/

Ref: https://tighetec.co.uk/2021/07/07/deploy-azure-virtual-desktop-with-project-bicep/

  • Thank you for your support. I solved it.

    I had the AVD resources (HostPool. Workspace,...) and the session host in different resource groups. If I create everything in one RG it works.
  • StefanKi 

     

    Please make sure your Bicep script correctly configures the necessary extensions, below the example, please ensure you fully understand before apply:

     

    resource joinAzuredomain 'Microsoft.Compute/virtualMachines/extensions@2024-07-01' = {
    name: '${vmPrefix}/joinAzuredomain'
    location: location
    properties: {
    publisher: 'Microsoft.Azure.ActiveDirectory'
    type: 'AADLoginForWindows'
    typeHandlerVersion: '1.0'
    autoUpgradeMinorVersion: true
    }
    dependsOn: [ vm ]
    }

    resource dscextension 'Microsoft.Compute/virtualMachines/extensions@2024-07-01' = {
    name: '${vmPrefix}/dscextension'
    location: location
    properties: {
    publisher: 'Microsoft.Powershell'
    type: 'DSC'
    typeHandlerVersion: '2.73'
    autoUpgradeMinorVersion: true
    settings: {
    modulesUrl: 'https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Configuration_1.0.02627.270.zip'
    configurationFunction: 'Configuration.ps1\\AddSessionHost'
    properties: {
    HostPoolName: hostPoolName
    registrationInfoToken: HostPoolToken
    aadJoin: AADJoin
    }
    }
    }
    dependsOn: [ joinAzuredomain ]
    }

      • jlou65535's avatar
        jlou65535
        Iron Contributor

        StefanKi 

        Encountering errors during Azure Virtual Desktop deployment?

        An issue may arise in the DSC phase due to the setup of AADLoginForWindows or Microsoft.PowerShell.DSC extensions. The problem stems from new subnet configurations defaulting to private subnets.

         

        To ensure smooth operation, your AVD virtual machines must have a subnet allowing outbound traffic.

         

Resources