-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainBuild.bicep
209 lines (176 loc) · 6.57 KB
/
mainBuild.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
targetScope = 'subscription'
param AzTenantID string
param artifactsLocation string
param AVDResourceGroup string
param workspaceLocation string
@description('Boolean used to determine if Monitoring agent is needed')
param monitoringAgent bool = false
@description('Wheter to use emphemeral disks for VMs')
param ephemeral bool = true
@description('Declares whether Azure AD joined or not')
param AADJoin bool = false
@description('Determines if Session Hosts are auto enrolled in Intune')
param intune bool = false
@description('Expiration time for the HostPool registration token. This must be up to 30 days from todays date.')
param tokenExpirationTime string
@description('OU Path were new AVD Session Hosts will be placed in Active Directory')
param ouPath string
@description('Domain that AVD Session Hosts will be joined to.')
param domain string
@description('If true Host Pool, App Group and Workspace will be created. Default is to join Session Hosts to existing AVD environment')
param newBuild bool = false
param administratorAccountUserName string
@secure()
param administratorAccountPassword string
@allowed([
'Personal'
'Pooled'
])
param hostPoolType string = 'Pooled'
param hostPoolName string
@allowed([
'Automatic'
'Direct'
])
param personalDesktopAssignmentType string = 'Direct'
param maxSessionLimit int = 12
@allowed([
'BreadthFirst'
'DepthFirst'
'Persistent'
])
param loadBalancerType string = 'BreadthFirst'
@description('Custom RDP properties to be applied to the AVD Host Pool.')
param customRdpProperty string
@description('Friendly Name of the Host Pool, this is visible via the AVD client')
param hostPoolFriendlyName string
@description('Name of the AVD Workspace to used for this deployment')
param workspaceName string = 'ABRI-AVD-PROD'
param appGroupFriendlyName string
@description('List of application group resource IDs to be added to Workspace. MUST add existing ones!')
param applicationGroupReferences string
param desktopName string
@description('CSV list of default users to assign to AVD Application Group.')
param defaultUsers string
@description('Application ID for Service Principal. Used for DSC scripts.')
param appID string
@description('Application Secret for Service Principal.')
@secure()
param appSecret string
param vmResourceGroup string
param vmLocation string
param vmSize string
param numberOfInstances int = 2
param currentInstances int = 0
param vmPrefix string = 'ABRI-AVD-PROD'
@allowed([
'Standard_LRS'
'Premium_LRS'
])
param vmDiskType string
param existingVNETResourceGroup string
@description('Name of the VNET that the AVD Session Hosts will be connected to.')
param existingVNETName string
@description('The name of the relevant VNET Subnet that is to be used for deployment.')
param existingSubnetName string
@description('Subscription containing the Shared Image Gallery')
param sharedImageGallerySubscription string
@description('Resource Group containing the Shared Image Gallery.')
param sharedImageGalleryResourceGroup string
@description('Name of the existing Shared Image Gallery to be used for image.')
param sharedImageGalleryName string
@description('Name of the Shared Image Gallery Definition being used for deployment. I.e: AVDGolden')
param sharedImageGalleryDefinitionname string
@description('Version name for image to be deployed as. I.e: 1.0.0')
param sharedImageGalleryVersionName string
//Used for Monitoring Module
@description('Subscription that Log Analytics Workspace is located in.')
param logworkspaceSub string
@description('Resource Group that Log Analytics Workspace is located in.')
param logworkspaceResourceGroup string
@description('Name of Log Analytics Workspace for AVD to be joined to.')
param logworkspaceName string
//Used in VMswitLA module
@description('Log Analytics Workspace ID')
param workspaceID string
@description('Log Analytics Workspace Key')
param workspaceKey string
param tagParams object
module resourceGroupDeploy './modules/resourceGroup.bicep' = {
name: 'backPlane'
params: {
AVDResourceGroup: AVDResourceGroup
AVDlocation: workspaceLocation
vmResourceGroup: vmResourceGroup
VMlocation: vmLocation
}
}
module backPlane './modules/backPlane.bicep' = {
name: 'backPlane'
scope: resourceGroup(AVDResourceGroup)
params: {
location: workspaceLocation
workspaceLocation: workspaceLocation
logworkspaceSub: logworkspaceSub
logworkspaceResourceGroup: logworkspaceResourceGroup
logworkspaceName: logworkspaceName
hostPoolName: hostPoolName
hostPoolFriendlyName: hostPoolFriendlyName
hostPoolType: hostPoolType
appGroupFriendlyName: appGroupFriendlyName
applicationGroupReferences: applicationGroupReferences
loadBalancerType: loadBalancerType
workspaceName: workspaceName
personalDesktopAssignmentType: personalDesktopAssignmentType
customRdpProperty: customRdpProperty
tokenExpirationTime: tokenExpirationTime
maxSessionLimit: maxSessionLimit
newBuild: newBuild
}
dependsOn: [
resourceGroupDeploy
]
}
module VMswithLA './modules/VMswithLA.bicep' = {
name: '${sharedImageGalleryVersionName}-VMswithLA'
scope: resourceGroup(vmResourceGroup)
params: {
AzTenantID: AzTenantID
location: vmLocation
administratorAccountUserName: administratorAccountUserName
administratorAccountPassword: administratorAccountPassword
artifactsLocation: artifactsLocation
vmDiskType: vmDiskType
vmPrefix: vmPrefix
vmSize: vmSize
currentInstances: currentInstances
AVDnumberOfInstances: numberOfInstances
existingVNETResourceGroup: existingVNETResourceGroup
existingVNETName: existingVNETName
existingSubnetName: existingSubnetName
sharedImageGallerySubscription: sharedImageGallerySubscription
sharedImageGalleryResourceGroup: sharedImageGalleryResourceGroup
sharedImageGalleryName: sharedImageGalleryName
sharedImageGalleryDefinitionname: sharedImageGalleryDefinitionname
sharedImageGalleryVersionName: sharedImageGalleryVersionName
hostPoolName: hostPoolName
domainToJoin: domain
ouPath: ouPath
appGroupName: reference(extensionResourceId('/subscriptions/${subscription().subscriptionId}/resourceGroups/${AVDResourceGroup}', 'Microsoft.Resources/deployments', 'backPlane'), '2019-10-01').outputs.appGroupName.value
appID: appID
appSecret: appSecret
defaultUsers: defaultUsers
desktopName: desktopName
resourceGroupName: AVDResourceGroup
workspaceID: workspaceID
workspaceKey: workspaceKey
tagParams: tagParams
monitoringAgent: monitoringAgent
ephemeral: ephemeral
AADJoin: AADJoin
intune: intune
}
dependsOn: [
backPlane
]
}