AVD Operator is a tool made of first-party tools that is intended to manage the operations of host management in Azure Virtual Desktop (AVD) environments. It is not intended to be a tool to deploy AVD core resources; it is intended to maintain the lifecycle of the AVD session hosts to ensure hosts are up to date with patches, applications, etc.
The core Azure resources making up AVD Operator are Function Apps, App Configurations, Storage Queues, Key Vaults, & Storage Accounts.
- Azure tenant with Contributor and User Access Administrator roles on the environment.
- Service Principal with the following configuration:
- Requires Contributor and User Access Administrator on the environment
- User Access Administrator roles can be limited to:
App Configuration Data Ownerfor the Service Principal to allow it to read the App Configuration for the host pool.Key Vault Secrets Userfor the function app to allow it to read Key Vault secrets to authenticate with the Service Principal.
- User Access Administrator roles can be limited to:
Cloud Device Administratorrole assigned to Entra ID to manage device registrations. Can be constrained by putting devices in a dynamic group that populates an Entra Administrative Unit.- Client/App ID and Secret stored in a Key Vault (defined in
pAuthKeyVault) to allow the function app to authenticate to Azure and Entra.- Name of Service Principal Client ID:
avd-operator-client-id - Name of Service Principal Secret:
avd-operator-client-secret
- Name of Service Principal Client ID:
- Requires Contributor and User Access Administrator on the environment
Desktop Virtualization Power On Off Contributorfor the first-partyAzure Virtual DesktopApp Registration set on the session hosts' subscription. For more information.- FSLogix
Storage Accountthat has been configured for the correct identity solution.- Defined in the
DEPLOYMENT_LOCATIONSparameter within thefslogixStorageAccountNameproperty. - Existing Log Analytics Workspace information is contained in the
LOG_ANALYTICS_WORKSPACEparameter.
- Defined in the
Disk Encryption Setused to encrypt session host disks (OS and Data).- Defined in the
DEPLOYMENT_LOCATIONSparameter within thediskEncryptionSetproperty.
- Defined in the
Dynamic Entra Device Security Group*(Intune only)- Used when Intune compliance is required.
Azure Gallery Imageto build the session hosts.- Defined in the
GALLERY_IMAGE_DEFINITIONparameter.
- Defined in the
AVD Host Pooland associated dependencies (application group, workspace, etc).- Defined in the
HOST_POOLparameter.
- Defined in the
Log Analytics Workspaceto send AVD Insights data and logs.- Defined in the
LOG_ANALYTICS_WORKSPACEparameter.
- Defined in the
- After fulfilling the prerequisites, populate the
./bicep/main.template.bicepparamparameter file. Make sure to rename the file to match the appropriate environment. Parameter descriptions are found in the parameter file. - Once the parameter file is populated with appropriate values, Run the
Invoke-BicepDeployment.ps1script with appropriate deployment settings. Those settings/parameters are found in the comment-based help of the script, along with an example. See Notes section below for troubleshooting.
- Once the Bicep template is deployed successfully, the contents of the function app need to be deployed. Run the
Invoke-FunctionAppDeployment.ps1script to do so. Parameter descriptions and an example can be found in the comment-based help of the script.
- Finally, run the
Invoke-RdAgentDownload.ps1script to stage the required binaries for the Remote Desktop agents to be installed during host deployment and configuration. Parameter descriptions and an example can be found in the comment-based help of the script.
maxDequeueCountfor the functions should be set to 5, but for testing, set to 1, in filefunction-app\host.json::extensions\maxDequeueCount- Ensure
pServicePrincipalObjectIdvalue is the object ID from the Service Principal. - It is assumed a user account is deploying the bicep template. See Bicep resource
rRoleAssignmentDeployerfor details or to make changes to allow for a service principal deployment. - Error
[Error] EXCEPTION: Value cannot be null. (Parameter 'key')means one of thesubscriptionIdproperties in the bicepparam file is incorrect. - Sometimes Storage Account authorization seems to get stuck. If that happens, reauthenticate the storage account:
Set-AzStorageAccount ` -ResourceGroupName "<RG_NAME>" ` -Name "<SA_NAME>" ` -EnableActiveDirectoryDomainServicesForFile $true ` -ActiveDirectoryDomainName "<DOMAIN.NAME>" ` -ActiveDirectoryNetBiosDomainName "<DOMAIN>" ` -ActiveDirectoryForestName "<FOREST.NAME>" ` -ActiveDirectoryDomainGuid "<GUID>" ` -ActiveDirectoryDomainsid "<SID>" ` -ActiveDirectoryAzureStorageSid "<STORAGE_SID>" ` -ActiveDirectorySamAccountName "<SA_NAME>" ` -ActiveDirectoryAccountType "Computer"
- TODO: Add documentation for host file entries and pass in via param.
- If run in Windows PowerShell 5, the Bicep deployment will fail due to missing permissions on the App Configuration resource.
- On first deployment, the app configuration key values might respond with a 'forbidden' message. If this occurs, wait 5-15 minutes and redeploy. This is due to the assigned RBAC role taking a while to replicate. If the issue persists, reauthenticate with
az login.