Skip to content

Commit

Permalink
3523 hosts pools ScheduledAgentUpdates issue (#3582)
Browse files Browse the repository at this point in the history
* ignore working files

* scheduled agent update fix

* scheduled agent update fix

* [Bug Report]: Agent scheduled updates gives error 404 after deploying AVD host pool with host-pools module
Fixes #3523

* Update modules/desktop-virtualization/host-pools/main.bicep

Co-authored-by: Alexander Sehr <ASehr@hotmail.de>

* Update modules/desktop-virtualization/host-pools/main.bicep

Co-authored-by: Alexander Sehr <ASehr@hotmail.de>

* Update modules/desktop-virtualization/host-pools/main.bicep

Removing comments from template

Co-authored-by: Alexander Sehr <ASehr@hotmail.de>

---------

Co-authored-by: Alexander Sehr <ASehr@hotmail.de>
  • Loading branch information
ThojoUno and AlexanderSehr authored Aug 19, 2023
1 parent 2300df2 commit d6da285
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,6 @@ FodyWeavers.xsd

# MacOS
.DS_Store

# Do not include files in workloads folder
/workloads
6 changes: 6 additions & 0 deletions modules/desktop-virtualization/host-pools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ This module deploys an Azure Virtual Desktop (AVD) Host Pool.
| Parameter Name | Type | Default Value | Allowed Values | Description |
| :-- | :-- | :-- | :-- | :-- |
| `agentUpdate` | object | `{object}` | | The session host configuration for updating agent, monitoring agent, and stack component. |
| `agentUpdateMaintenanceWindowDayOfWeek` | string | `'Sunday'` | `[Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday]` | Update day for scheduled agent updates. |
| `agentUpdateMaintenanceWindowHour` | int | `22` | | Update hour for scheduled agent updates. |
| `agentUpdateMaintenanceWindows` | array | `[System.Management.Automation.OrderedHashtable]` | | List of maintenance windows for scheduled agent updates. |
| `agentUpdateMaintenanceWindowTimeZone` | string | `'Central Standard Time'` | | Time zone for scheduled agent updates. |
| `agentUpdateType` | string | `'Default'` | `[Default, Scheduled]` | Enable scheduled agent updates, Default means agent updates will automatically be installed by AVD when they become available. |
| `agentUpdateUseSessionHostLocalTime` | bool | `False` | | Whether to use localTime of the virtual machine for scheduled agent updates. |
| `customRdpProperty` | string | `'audiocapturemode:i:1;audiomode:i:0;drivestoredirect:s:;redirectclipboard:i:1;redirectcomports:i:1;redirectprinters:i:1;redirectsmartcards:i:1;screen mode id:i:2;'` | | Host Pool RDP properties. |
| `description` | string | `''` | | The description of the Host Pool to be created. |
| `diagnosticEventHubAuthorizationRuleId` | string | `''` | | Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to. |
Expand Down
46 changes: 44 additions & 2 deletions modules/desktop-virtualization/host-pools/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,53 @@ param startVMOnConnect bool = false
@sys.description('Optional. Array of role assignment objects that contain the \'roleDefinitionIdOrName\' and \'principalIds\' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
param roleAssignments array = []

@sys.description('Optional. Enable scheduled agent updates, Default means agent updates will automatically be installed by AVD when they become available.')
@allowed([
'Default'
'Scheduled'
])
param agentUpdateType string = 'Default'

@sys.description('Optional. Update hour for scheduled agent updates.')
@minValue(1)
@maxValue(23)
param agentUpdateMaintenanceWindowHour int = 22

@sys.description('Optional. Update day for scheduled agent updates.')
@allowed([
'Sunday'
'Monday'
'Tuesday'
'Wednesday'
'Thursday'
'Friday'
'Saturday'
])
param agentUpdateMaintenanceWindowDayOfWeek string = 'Sunday'

@sys.description('Optional. List of maintenance windows for scheduled agent updates.')
param agentUpdateMaintenanceWindows array = [
{
hour: agentUpdateMaintenanceWindowHour
dayOfWeek: agentUpdateMaintenanceWindowDayOfWeek
}
]

@sys.description('Optional. Time zone for scheduled agent updates.')
param agentUpdateMaintenanceWindowTimeZone string = 'Central Standard Time'

@sys.description('Optional. Whether to use localTime of the virtual machine for scheduled agent updates.')
param agentUpdateUseSessionHostLocalTime bool = false

@sys.description('Optional. The session host configuration for updating agent, monitoring agent, and stack component.')
param agentUpdate object = {
useSessionHostLocalTime: true
type: agentUpdateType
maintenanceWindows: agentUpdateMaintenanceWindows
maintenanceWindowTimeZone: agentUpdateMaintenanceWindowTimeZone
useSessionHostLocalTime: agentUpdateUseSessionHostLocalTime
}


@sys.description('Optional. The ring number of HostPool.')
param ring int = -1

Expand Down Expand Up @@ -203,7 +245,7 @@ resource hostPool 'Microsoft.DesktopVirtualization/hostPools@2022-09-09' = {
registrationTokenOperation: 'Update'
}
vmTemplate: ((!empty(vmTemplate)) ? null : string(vmTemplate))
agentUpdate: agentUpdate
agentUpdate: (agentUpdateType == 'Scheduled') ? agentUpdate : null
ring: ring != -1 ? ring : null
ssoadfsAuthority: ssoadfsAuthority
ssoClientId: ssoClientId
Expand Down
82 changes: 75 additions & 7 deletions modules/desktop-virtualization/host-pools/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.19.5.34762",
"templateHash": "15864651736629560577"
}
"version": "0.18.4.5664",
"templateHash": "8022860912421276738"
},
"name": "Azure Virtual Desktop (AVD) Host Pools",
"description": "This module deploys an Azure Virtual Desktop (AVD) Host Pool.",
"owner": "Azure/module-maintainers"
},
"parameters": {
"name": {
Expand Down Expand Up @@ -203,10 +206,75 @@
"description": "Optional. Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalIds' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11'."
}
},
"agentUpdateType": {
"type": "string",
"defaultValue": "Default",
"allowedValues": [
"Default",
"Scheduled"
],
"metadata": {
"description": "Optional. Enable scheduled agent updates, Default means agent updates will automatically be installed by AVD when they become available."
}
},
"agentUpdateMaintenanceWindowHour": {
"type": "int",
"defaultValue": 22,
"maxValue": 23,
"minValue": 1,
"metadata": {
"description": "Optional. Update hour for scheduled agent updates."
}
},
"agentUpdateMaintenanceWindowDayOfWeek": {
"type": "string",
"defaultValue": "Sunday",
"allowedValues": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"metadata": {
"description": "Optional. Update day for scheduled agent updates."
}
},
"agentUpdateMaintenanceWindows": {
"type": "array",
"defaultValue": [
{
"hour": "[parameters('agentUpdateMaintenanceWindowHour')]",
"dayOfWeek": "[parameters('agentUpdateMaintenanceWindowDayOfWeek')]"
}
],
"metadata": {
"description": "Optional. List of maintenance windows for scheduled agent updates."
}
},
"agentUpdateMaintenanceWindowTimeZone": {
"type": "string",
"defaultValue": "Central Standard Time",
"metadata": {
"description": "Optional. Time zone for scheduled agent updates."
}
},
"agentUpdateUseSessionHostLocalTime": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Optional. Whether to use localTime of the virtual machine for scheduled agent updates."
}
},
"agentUpdate": {
"type": "object",
"defaultValue": {
"useSessionHostLocalTime": true
"type": "[parameters('agentUpdateType')]",
"maintenanceWindows": "[parameters('agentUpdateMaintenanceWindows')]",
"maintenanceWindowTimeZone": "[parameters('agentUpdateMaintenanceWindowTimeZone')]",
"useSessionHostLocalTime": "[parameters('agentUpdateUseSessionHostLocalTime')]"
},
"metadata": {
"description": "Optional. The session host configuration for updating agent, monitoring agent, and stack component."
Expand Down Expand Up @@ -337,7 +405,7 @@
"registrationTokenOperation": "Update"
},
"vmTemplate": "[if(not(empty(parameters('vmTemplate'))), null(), string(parameters('vmTemplate')))]",
"agentUpdate": "[parameters('agentUpdate')]",
"agentUpdate": "[if(equals(parameters('agentUpdateType'), 'Scheduled'), parameters('agentUpdate'), null())]",
"ring": "[if(not(equals(parameters('ring'), -1)), parameters('ring'), null())]",
"ssoadfsAuthority": "[parameters('ssoadfsAuthority')]",
"ssoClientId": "[parameters('ssoClientId')]",
Expand Down Expand Up @@ -410,8 +478,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.19.5.34762",
"templateHash": "10241186313653123794"
"version": "0.18.4.5664",
"templateHash": "14279396732857224845"
}
},
"parameters": {
Expand Down

0 comments on commit d6da285

Please sign in to comment.