diff --git a/.github/workflows/ms.desktopvirtualization.applicationgroups.yml b/.github/workflows/ms.desktopvirtualization.applicationgroups.yml index db44002f93..929df1944d 100644 --- a/.github/workflows/ms.desktopvirtualization.applicationgroups.yml +++ b/.github/workflows/ms.desktopvirtualization.applicationgroups.yml @@ -106,8 +106,7 @@ jobs: - name: 'Using test file [${{ matrix.moduleTestFilePaths }}]' uses: ./.github/actions/templates/validateModuleDeployment with: - templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' + templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' location: '${{ env.location }}' resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' diff --git a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/common/dependencies.bicep b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/common/dependencies.bicep new file mode 100644 index 0000000000..d9b11aa7c6 --- /dev/null +++ b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/common/dependencies.bicep @@ -0,0 +1,29 @@ +@description('Optional. The location to deploy to.') +param location string = resourceGroup().location + +@description('Required. The name of the Managed Identity to create.') +param managedIdentityName string + +@description('Required. The name of the Host Pool to create.') +param hostPoolName string + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +resource hostPool 'Microsoft.DesktopVirtualization/hostPools@2021-07-12' = { + name: hostPoolName + location: location + properties: { + hostPoolType: 'Pooled' + loadBalancerType: 'BreadthFirst' + preferredAppGroupType: 'Desktop' + } +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + +@description('The resource ID of the created Host Pool.') +output hostPoolResourceId string = hostPool.id diff --git a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/common/deploy.test.bicep b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/common/deploy.test.bicep new file mode 100644 index 0000000000..c7dcafd8f9 --- /dev/null +++ b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/common/deploy.test.bicep @@ -0,0 +1,97 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'ms.desktopvirtualization.applicationgroups-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to.') +param location string = deployment().location + +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') +param serviceShort string = 'dvagcom' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +module resourceGroupResources 'dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-paramNested' + params: { + managedIdentityName: 'dep-<>-msi-${serviceShort}' + hostPoolName: 'dep-<>-hp-${serviceShort}' + } +} + +// Diagnostics +// =========== +module diagnosticDependencies '../../../../.shared/dependencyConstructs/diagnostic.dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' + params: { + storageAccountName: 'dep<>diasa${serviceShort}01' + logAnalyticsWorkspaceName: 'dep-<>-law-${serviceShort}' + eventHubNamespaceEventHubName: 'dep-<>-evh-${serviceShort}' + eventHubNamespaceName: 'dep-<>-evhns-${serviceShort}' + location: location + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + applicationGroupType: 'RemoteApp' + hostpoolName: last(split(resourceGroupResources.outputs.hostPoolResourceId, '/')) + applications: [ + { + commandLineArguments: '' + commandLineSetting: 'DoNotAllow' + description: 'Notepad by ARM template' + filePath: 'C:\\Windows\\System32\\notepad.exe' + friendlyName: 'Notepad' + iconIndex: 0 + iconPath: 'C:\\Windows\\System32\\notepad.exe' + name: 'notepad' + showInPortal: true + } + { + filePath: 'C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe' + friendlyName: 'Wordpad' + name: 'wordpad' + } + ] + description: 'This is my first Remote Applications bundle' + diagnosticLogsRetentionInDays: 7 + diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId + diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId + diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId + diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName + friendlyName: 'Remote Applications 1' + location: location + lock: 'CanNotDelete' + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + } +} diff --git a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min.parameters.json b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min.parameters.json deleted file mode 100644 index ecf7a145e6..0000000000 --- a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min.parameters.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-avdag-min-001" - }, - "applicationGroupType": { - "value": "RemoteApp" - }, - "hostpoolName": { - "value": "adp-<>-az-avdhp-x-001" - } - } -} diff --git a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min/dependencies.bicep b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min/dependencies.bicep new file mode 100644 index 0000000000..a11899cd86 --- /dev/null +++ b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min/dependencies.bicep @@ -0,0 +1,18 @@ +@description('Optional. The location to deploy to.') +param location string = resourceGroup().location + +@description('Required. The name of the Host Pool to create.') +param hostPoolName string + +resource hostPool 'Microsoft.DesktopVirtualization/hostPools@2021-07-12' = { + name: hostPoolName + location: location + properties: { + hostPoolType: 'Pooled' + loadBalancerType: 'BreadthFirst' + preferredAppGroupType: 'Desktop' + } +} + +@description('The resource ID of the created Host Pool.') +output hostPoolResourceId string = hostPool.id diff --git a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min/deploy.test.bicep b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min/deploy.test.bicep new file mode 100644 index 0000000000..e8bd8fb8d3 --- /dev/null +++ b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/min/deploy.test.bicep @@ -0,0 +1,47 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'ms.desktopvirtualization.applicationgroups-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to.') +param location string = deployment().location + +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') +param serviceShort string = 'dvagmin' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +module resourceGroupResources 'dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-paramNested' + params: { + hostPoolName: 'dep-<>-hp-${serviceShort}' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + applicationGroupType: 'RemoteApp' + hostpoolName: last(split(resourceGroupResources.outputs.hostPoolResourceId, '/')) + } +} diff --git a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/parameters.json b/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/parameters.json deleted file mode 100644 index 7e71ce4904..0000000000 --- a/modules/Microsoft.DesktopVirtualization/applicationgroups/.test/parameters.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-avdag-x-001" - }, - "lock": { - "value": "CanNotDelete" - }, - "location": { - "value": "westeurope" - }, - "applicationGroupType": { - "value": "RemoteApp" - }, - "hostpoolName": { - "value": "adp-<>-az-avdhp-x-001" - }, - "friendlyName": { - "value": "Remote Applications 1" - }, - "description": { - "value": "This is my first Remote Applications bundle" - }, - "applications": { - "value": [ - { - "name": "notepad", - "description": "Notepad by ARM template", - "friendlyName": "Notepad", - "filePath": "C:\\Windows\\System32\\notepad.exe", - "commandLineSetting": "DoNotAllow", - "commandLineArguments": "", - "showInPortal": true, - "iconPath": "C:\\Windows\\System32\\notepad.exe", - "iconIndex": 0 - }, - { - "name": "wordpad", - "filePath": "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe", - "friendlyName": "Wordpad" - } - ] - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - }, - "diagnosticLogsRetentionInDays": { - "value": 7 - }, - "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" - }, - "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" - }, - "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" - }, - "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" - } - } -} diff --git a/modules/Microsoft.DesktopVirtualization/applicationgroups/readme.md b/modules/Microsoft.DesktopVirtualization/applicationgroups/readme.md index b1fe6a0f0c..f597d51d56 100644 --- a/modules/Microsoft.DesktopVirtualization/applicationgroups/readme.md +++ b/modules/Microsoft.DesktopVirtualization/applicationgroups/readme.md @@ -169,7 +169,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Min

+

Example 1: Common

@@ -177,59 +177,12 @@ The following module usage examples are retrieved from the content of the files ```bicep module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Applicationgroups' + name: '${uniqueString(deployment().name)}-test-dvagcom' params: { // Required parameters applicationGroupType: 'RemoteApp' - hostpoolName: 'adp-<>-az-avdhp-x-001' - name: '<>-az-avdag-min-001' - } -} -``` - -
-

- -

- -via JSON Parameter file - -```json -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - // Required parameters - "applicationGroupType": { - "value": "RemoteApp" - }, - "hostpoolName": { - "value": "adp-<>-az-avdhp-x-001" - }, - "name": { - "value": "<>-az-avdag-min-001" - } - } -} -``` - -
-

- -

Example 2: Parameters

- -
- -via Bicep module - -```bicep -module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Applicationgroups' - params: { - // Required parameters - applicationGroupType: 'RemoteApp' - hostpoolName: 'adp-<>-az-avdhp-x-001' - name: '<>-az-avdag-x-001' + hostpoolName: '' + name: '<>dvagcom001' // Non-required parameters applications: [ { @@ -250,18 +203,18 @@ module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/de } ] description: 'This is my first Remote Applications bundle' - diagnosticEventHubAuthorizationRuleId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey' - diagnosticEventHubName: 'adp-<>-az-evh-x-001' + diagnosticEventHubAuthorizationRuleId: '' + diagnosticEventHubName: '' diagnosticLogsRetentionInDays: 7 - diagnosticStorageAccountId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001' - diagnosticWorkspaceId: '/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001' + diagnosticStorageAccountId: '' + diagnosticWorkspaceId: '' friendlyName: 'Remote Applications 1' - location: 'westeurope' + location: '' lock: 'CanNotDelete' roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } @@ -287,10 +240,10 @@ module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/de "value": "RemoteApp" }, "hostpoolName": { - "value": "adp-<>-az-avdhp-x-001" + "value": "" }, "name": { - "value": "<>-az-avdag-x-001" + "value": "<>dvagcom001" }, // Non-required parameters "applications": { @@ -317,25 +270,25 @@ module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/de "value": "This is my first Remote Applications bundle" }, "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" + "value": "" }, "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" + "value": "" }, "diagnosticLogsRetentionInDays": { "value": 7 }, "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" + "value": "" }, "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" + "value": "" }, "friendlyName": { "value": "Remote Applications 1" }, "location": { - "value": "westeurope" + "value": "" }, "lock": { "value": "CanNotDelete" @@ -344,7 +297,7 @@ module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/de "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } @@ -356,3 +309,50 @@ module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/de

+ +

Example 2: Min

+ +
+ +via Bicep module + +```bicep +module applicationgroups './Microsoft.DesktopVirtualization/applicationgroups/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-dvagmin' + params: { + // Required parameters + applicationGroupType: 'RemoteApp' + hostpoolName: '' + name: '<>dvagmin001' + } +} +``` + +
+

+ +

+ +via JSON Parameter file + +```json +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + // Required parameters + "applicationGroupType": { + "value": "RemoteApp" + }, + "hostpoolName": { + "value": "" + }, + "name": { + "value": "<>dvagmin001" + } + } +} +``` + +
+