Skip to content

Commit

Permalink
feat: amv/res/desktop-virtualization/scaling-plan API updates (#2347)
Browse files Browse the repository at this point in the history
## Description

- Updating API version for desktop virtualization scaling plans, this
will enable the use of the feature with pooled and personal host pools.

Fixes #2308
Closes #2308

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|          |

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ x] Update to CI Environment or utilities (Non-module affecting
changes)
- [ x] Azure Verified Module updates:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [x ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ x] Update to documentation

## Checklist

- [ x] I'm sure there are no other open Pull Requests for the same
update/change
- [ ] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [ x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->

---------

Co-authored-by: danycontre <[email protected]>
  • Loading branch information
danycontre and danycontre authored Jun 14, 2024
1 parent d6094f0 commit 8cf03ea
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 30 deletions.
9 changes: 8 additions & 1 deletion avm/res/desktop-virtualization/scaling-plan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This module deploys an Azure Virtual Desktop Scaling Plan.
| :-- | :-- |
| `Microsoft.Authorization/locks` | [2020-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-05-01/locks) |
| `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) |
| `Microsoft.DesktopVirtualization/scalingPlans` | [2022-09-09](https://learn.microsoft.com/en-us/azure/templates/Microsoft.DesktopVirtualization/2022-09-09/scalingPlans) |
| `Microsoft.DesktopVirtualization/scalingPlans` | [2023-09-05](https://learn.microsoft.com/en-us/azure/templates/Microsoft.DesktopVirtualization/2023-09-05/scalingPlans) |
| `Microsoft.Insights/diagnosticSettings` | [2021-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Insights/2021-05-01-preview/diagnosticSettings) |

## Usage examples
Expand Down Expand Up @@ -735,6 +735,13 @@ Host pool type of the Scaling Plan.
- Required: No
- Type: string
- Default: `'Pooled'`
- Allowed:
```Bicep
[
'Personal'
'Pooled'
]
```

### Parameter: `location`

Expand Down
52 changes: 27 additions & 25 deletions avm/res/desktop-virtualization/scaling-plan/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ param friendlyName string = name
param timeZone string = 'UTC'

@sys.description('Optional. Host pool type of the Scaling Plan.')
@allowed([
'Personal'
'Pooled'
])
param hostPoolType string = 'Pooled'

@sys.description('Optional. Exclusion tag to be used for exclusion of VMs from Scaling Plan.')
Expand Down Expand Up @@ -66,26 +70,25 @@ var builtInRoleNames = {
'Desktop Virtualization Workspace Reader': '/providers/Microsoft.Authorization/roleDefinitions/0fa44ee9-7a7d-466b-9bb2-2bf446b1204d'
}

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' =
if (enableTelemetry) {
name: '46d3xbcp.res.desktopvirtualization-scalingplan.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: '46d3xbcp.res.desktopvirtualization-scalingplan.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
}
}
}
}

resource scalingPlan 'Microsoft.DesktopVirtualization/scalingPlans@2022-09-09' = {
resource scalingPlan 'Microsoft.DesktopVirtualization/scalingPlans@2023-09-05' = {
name: name
location: location
tags: tags
Expand All @@ -100,17 +103,16 @@ resource scalingPlan 'Microsoft.DesktopVirtualization/scalingPlans@2022-09-09' =
}
}

resource scalingPlan_lock 'Microsoft.Authorization/locks@2020-05-01' =
if (!empty(lock ?? {}) && lock.?kind != 'None') {
name: lock.?name ?? 'lock-${name}'
properties: {
level: lock.?kind ?? ''
notes: lock.?kind == 'CanNotDelete'
? 'Cannot delete resource or child resources.'
: 'Cannot delete or modify the resource or child resources.'
}
scope: scalingPlan
resource scalingPlan_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') {
name: lock.?name ?? 'lock-${name}'
properties: {
level: lock.?kind ?? ''
notes: lock.?kind == 'CanNotDelete'
? 'Cannot delete resource or child resources.'
: 'Cannot delete or modify the resource or child resources.'
}
scope: scalingPlan
}

resource scalingPlan_roleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01' = [
for (roleAssignment, index) in (roleAssignments ?? []): {
Expand Down
12 changes: 8 additions & 4 deletions avm/res/desktop-virtualization/scaling-plan/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "9815061252044383943"
"version": "0.28.1.47646",
"templateHash": "12551745482202425473"
},
"name": "Azure Virtual Desktop Scaling Plan",
"description": "This module deploys an Azure Virtual Desktop Scaling Plan.",
Expand Down Expand Up @@ -231,6 +231,10 @@
"hostPoolType": {
"type": "string",
"defaultValue": "Pooled",
"allowedValues": [
"Personal",
"Pooled"
],
"metadata": {
"description": "Optional. Host pool type of the Scaling Plan."
}
Expand Down Expand Up @@ -342,7 +346,7 @@
},
"scalingPlan": {
"type": "Microsoft.DesktopVirtualization/scalingPlans",
"apiVersion": "2022-09-09",
"apiVersion": "2023-09-05",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
Expand Down Expand Up @@ -452,7 +456,7 @@
"metadata": {
"description": "The location of the Scaling Plan."
},
"value": "[reference('scalingPlan', '2022-09-09', 'full').location]"
"value": "[reference('scalingPlan', '2023-09-05', 'full').location]"
}
}
}

0 comments on commit 8cf03ea

Please sign in to comment.