Skip to content

Commit

Permalink
Merge pull request #664 from Azure/issue-662
Browse files Browse the repository at this point in the history
updates
  • Loading branch information
danycontre authored Sep 9, 2024
2 parents ca574a3 + 2ef56da commit 6322afb
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 2 deletions.
75 changes: 74 additions & 1 deletion workload/arm/brownfield/deployNewSessionHostsToHostPools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "8529136871393216686"
"templateHash": "14096690486777536500"
}
},
"parameters": {
Expand Down Expand Up @@ -405,6 +405,12 @@
"metadata": {
"description": "Organizational owner of the AVD deployment. (Default: [email protected])"
}
},
"dataCollectionRuleId": {
"type": "string",
"metadata": {
"description": "Data collection rule ID."
}
}
},
"variables": {
Expand Down Expand Up @@ -5720,6 +5726,73 @@
"sessionHostsAntimalwareExtension"
]
},
{
"copy": {
"name": "dataCollectionRuleAssociation",
"count": "[length(range(1, parameters('count')))]"
},
"condition": "[parameters('deployMonitoring')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
"name": "[format('DCR-Asso-{0}-{1}', sub(range(1, parameters('count'))[copyIndex()], 1), parameters('time'))]",
"subscriptionId": "[format('{0}', parameters('computeSubscriptionId'))]",
"resourceGroup": "[format('{0}', parameters('computeRgResourceGroupName'))]",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"virtualMachineName": {
"value": "[format('{0}{1}', variables('varSessionHostNamePrefix'), padLeft(add(range(1, parameters('count'))[copyIndex()], parameters('countIndex')), 4, '0'))]"
},
"dataCollectionRuleId": {
"value": "[parameters('dataCollectionRuleId')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "15961062277630290779"
}
},
"parameters": {
"virtualMachineName": {
"type": "string",
"metadata": {
"description": "VM name."
}
},
"dataCollectionRuleId": {
"type": "string",
"metadata": {
"description": "Data collection rule ID."
}
}
},
"resources": [
{
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
"apiVersion": "2022-06-01",
"scope": "[format('Microsoft.Compute/virtualMachines/{0}', parameters('virtualMachineName'))]",
"name": "[parameters('virtualMachineName')]",
"properties": {
"dataCollectionRuleId": "[parameters('dataCollectionRuleId')]",
"description": "AVD Insights data collection rule association"
}
}
]
}
},
"dependsOn": [
"monitoring",
"sessionHostsAntimalwareExtension"
]
},
{
"copy": {
"name": "sessionHostConfiguration",
Expand Down
19 changes: 19 additions & 0 deletions workload/bicep/brownfield/newSessionHosts/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ param opsTeamTag string = '[email protected]'
@sys.description('Organizational owner of the AVD deployment. (Default: [email protected])')
param ownerTag string = '[email protected]'

@sys.description('Data collection rule ID.')
param dataCollectionRuleId string

// =========== //
// Variable declaration //
// =========== //
Expand Down Expand Up @@ -436,6 +439,22 @@ module monitoring '../../../../avm/1.0.0/res/compute/virtual-machine/extension/m
]
}]

// Data collection rule association
module dataCollectionRuleAssociation '../..//modules/avdSessionHosts/.bicep/dataCollectionRulesAssociation.bicep' = [for i in range(1, count): if (deployMonitoring) {
scope: resourceGroup('${computeSubscriptionId}', '${computeRgResourceGroupName}')
name: 'DCR-Asso-${i - 1}-${time}'
params: {
virtualMachineName: '${varSessionHostNamePrefix}${padLeft((i + countIndex), 4, '0')}'
dataCollectionRuleId: dataCollectionRuleId
}
dependsOn: [
monitoring
sessionHostsAntimalwareExtension
alaWorkspace
]
}]


// Apply AVD session host configurations
module sessionHostConfiguration '../../modules/avdSessionHosts/.bicep/configureSessionHost.bicep' = [for i in range(1, count): {
scope: resourceGroup('${computeSubscriptionId}', '${computeRgResourceGroupName}')
Expand Down
12 changes: 11 additions & 1 deletion workload/portal-ui/brownfield/portalUiNewSessionHosts.json
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,20 @@
"required": true
}
},
{
"name": "monitoringDataCollectionRuleSelection",
"type": "Microsoft.Solutions.ResourceSelector",
"label": "Data Collection Rule",
"resourceType": "Microsoft.Insights/dataCollectionRules",
"constraints": {
"required": true
}
},
{
"name": "deployMonitoringInfo1",
"type": "Microsoft.Common.InfoBox",
"options": {
"text": "Azure Virtual Desktop monitoring requires an existing Azure Log Analytics Workspace or the creation of a new one.",
"text": "Azure Virtual Desktop monitoring requires an existing Azure Log Analytics Workspace and Data Collection Rules.",
"uri": "https://docs.microsoft.com/azure/virtual-desktop/azure-monitor",
"style": "Info"
}
Expand Down Expand Up @@ -1155,6 +1164,7 @@
"asgResourceId": "[if(steps('network').networkSettings.applicationSecurityGroup, steps('network').networkSettings.applicationSecurityGroupSelectorId.id, '')]",
"deployMonitoring": "[steps('monitoring').configureMonitoring]",
"alaWorkspaceResourceId": "[if(steps('monitoring').configureMonitoring, steps('monitoring').motoringSettings.monitoringWorkspaceSelection.id, '')]",
"dataCollectionRuleId": "[if(steps('monitoring').configureMonitoring, steps('monitoring').motoringSettings.monitoringDataCollectionRuleSelection.id, '')]",
"customNaming": "[steps('resourceNaming').resourceNamingSelection]",
"sessionHostCustomNamePrefix": "[if(steps('resourceNaming').resourceNamingSelection, steps('resourceNaming').resourceNamingCompute.sessionHostCustomNamePrefix, '')]",
"createResourceTags": "[steps('resourceTagging').resourceTaggingSelection]",
Expand Down

0 comments on commit 6322afb

Please sign in to comment.