Do you use a mandatory web proxy for Internet traffic in your environment and want to enable Azure Virtual Desktop (AVD) on your Azure Local VMs?

You may have encountered this challenge when adding new AVD session hosts on Azure Local to your host pool, as the AVD deployment wizard currently does not provide an option to configure a web proxy.
At present, you have two options:
- Use an Azure ARM template to configure the web proxy during AVD VM deployment on Azure local.
- First, deploy a new VM on Azure Local, configure the web proxy in the wizard, and then install the AVD agent to register the VM in your host pool—either through manual installation or via a PowerShell script.
What the Script does?
The Install-AVD-Agent.ps1 script automates the download of the sources and installation of the AVD Agent and Bootloader. It uses a mandatory registration token to securely register your VM with the AVD host pool.
Note: Outbound internet traffic is required to download the AVD agent and bootloader sources.
The script:
- Handles errors gracefully to ensure smooth deployment
- Downloads the latest AVD Agent and Bootloader installers
- Installs both components silently
Download the script here.
How to Use
- Open PowerShell on your VM or run the script remotely.
- Run the script with your registration token:
.\Install-AVD-Agent.ps1 -AVDRegistrationToken “<your_reqtoken_here>” - The script will handle the rest—downloading, installing, and registering your VM with AVD.
Note: You must first create an AVD host pool registration token in the portal or using a PowerShell command.
Here is an example PS snippet for downloading and running the script file by using the Run Azure VM command option:
$AVDRegistrationToken = "<your_regtoken_here>"
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/avdpunks/public/refs/heads/main/Install-AVD-Agent.ps1' -OutFile 'c:\windows\temp\Install-AVD-Agent.ps1'
Start-Sleep -Seconds 10
Set-Location -Path c:\windows\temp\
& .\Install-AVD-Agent.ps1 -AVDRegistrationToken $AVDRegistrationToken
Conclusion
Configuring a web proxy for AVD VMs can be streamlined using either an ARM template during deployment or by manually setting up the proxy before installing the AVD agent. Leveraging the Install-AVD-Agent.ps1 script ensures a secure, automated, and error-resilient installation process, reducing manual effort and minimizing configuration issues.
By following these steps and ensuring outbound internet access, you can efficiently register your VMs to the AVD host pool and maintain a consistent, reliable deployment experience.

