-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.bicep
157 lines (145 loc) · 5.28 KB
/
main.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
targetScope = 'subscription'
//Define AVD deployment parameters
param resourceGroupPrefrix string = 'BICEP-AVD-RG-'
param hostpoolName string = 'myBicepHostpool'
param hostpoolFriendlyName string = 'My Bicep deployed Hostpool'
param appgroupName string = 'myBicepAppGroup'
param appgroupNameFriendlyName string = 'My Bicep deployed Appgroup'
param workspaceName string = 'myBicepWorkspace'
param workspaceNameFriendlyName string = 'My Bicep deployed Workspace'
param preferredAppGroupType string = 'Desktop'
param avdbackplanelocation string = 'eastus'
param hostPoolType string = 'pooled'
param loadBalancerType string = 'BreadthFirst'
param logAnalyticsWorkspaceName string = 'BicepLAWorkspace'
param logAnalyticslocation string = 'westeurope'
//Define Networking deployment parameters
param vnetName string = 'bicep-vnet'
param vnetaddressPrefix string = '10.0.0.0/15'
param subnetPrefix string = '10.0.1.0/24'
param vnetLocation string = 'westeurope'
param subnetName string = 'bicep-subnet'
//Define Azure Files deployment parameters
param storageaccountlocation string = 'westeurope'
param storageaccountName string = 'bicepsa${uniqueString(storageaccountlocation)}' //Make unique before running
param storageaccountkind string = 'FileStorage'
param storgeaccountglobalRedundancy string = 'Premium_LRS'
param fileshareFolderName string = 'profilecontainers'
//Define Shared Image Gallery and Azure Image Parameters
param sigName string = 'BicepavdSIG'
param imageDefinitionName string = 'BicepAIBavdImage'
param imagePublisher string = 'MicrosoftWindowsDesktop'
param imageOffer string = 'windows-10'
param imageSKU string = '20h2-ent'
param uamiName string = '${'AIBUser'}${utcNow()}'
//Define Azure Image Builder Parameters
//Set below to true to start the Image Definition build using AIB once deployment completes
param InvokeRunImageBuildThroughDeploymentScript bool = false
//Create Resource Groups
resource rgavd 'Microsoft.Resources/resourceGroups@2020-06-01' = {
name: '${resourceGroupPrefrix}BACKPLANE'
location: 'westeurope'
}
resource rgnetw 'Microsoft.Resources/resourceGroups@2020-06-01' = {
name: '${resourceGroupPrefrix}NETWORK'
location: 'westeurope'
}
resource rgfs 'Microsoft.Resources/resourceGroups@2020-06-01' = {
name: '${resourceGroupPrefrix}FILESERVICES'
location: 'westeurope'
}
resource rdmon 'Microsoft.Resources/resourceGroups@2020-06-01' = {
name: '${resourceGroupPrefrix}MONITOR'
location: 'westeurope'
}
resource rgsig 'Microsoft.Resources/resourceGroups@2020-06-01' = {
name: '${resourceGroupPrefrix}SIG'
location: 'westeurope'
}
//Create avd backplane objects and configure Log Analytics Diagnostics Settings
module avdbackplane './avd-backplane-module.bicep' = {
name: 'avdbackplane'
scope: rgavd
params: {
hostpoolName: hostpoolName
hostpoolFriendlyName: hostpoolFriendlyName
appgroupName: appgroupName
appgroupNameFriendlyName: appgroupNameFriendlyName
workspaceName: workspaceName
workspaceNameFriendlyName: workspaceNameFriendlyName
preferredAppGroupType: preferredAppGroupType
applicationgrouptype: preferredAppGroupType
avdbackplanelocation: avdbackplanelocation
hostPoolType: hostPoolType
loadBalancerType: loadBalancerType
logAnalyticsWorkspaceName: logAnalyticsWorkspaceName
logAnalyticslocation: logAnalyticslocation
logAnalyticsResourceGroup: rdmon.name
avdBackplaneResourceGroup: rgavd.name
}
}
//Create avd Netwerk and Subnet
module avdnetwork './avd-network-module.bicep' = {
name: 'avdnetwork'
scope: rgnetw
params: {
vnetName: vnetName
vnetaddressPrefix: vnetaddressPrefix
subnetPrefix: subnetPrefix
vnetLocation: vnetLocation
subnetName: subnetName
}
}
//Create avd Azure File Services and FileShare`
module avdFileServices './avd-fileservices-module.bicep' = {
name: 'avdFileServices'
scope: rgfs
params: {
storageaccountlocation: storageaccountlocation
storageaccountName: storageaccountName
storageaccountkind: storageaccountkind
storgeaccountglobalRedundancy: storgeaccountglobalRedundancy
fileshareFolderName: fileshareFolderName
}
}
//Create Private Endpoint for file storage
module pep './avd-fileservices-privateendpoint-module.bicep' = {
name: 'privateEndpoint'
scope: rgnetw
params: {
location: vnetLocation
privateEndpointName: 'pep-sto'
storageAccountId: avdFileServices.outputs.storageAccountId
vnetId: avdnetwork.outputs.vnetId
subnetId: avdnetwork.outputs.subnetId
}
}
//Create avd Shared Image Gallery and Image Definition
module avdsig './avd-sig-module.bicep' = {
name: 'avdsig'
scope: rgsig
params: {
sigName: sigName
sigLocation: rgsig.location
imagePublisher: imagePublisher
imageDefinitionName: imageDefinitionName
imageOffer: imageOffer
imageSKU: imageSKU
uamiName: uamiName
roleNameGalleryImage: '${'BicepSIGRole'}'
}
}
//Create AIB Image and optionally build and add version to SIG Definition
module avdaib './avd-image-builder-module.bicep' = {
name: 'avdimagebuilder${avdsig.name}'
scope: rgsig
params: {
siglocation: rgsig.location
uamiName: uamiName
imagePublisher: imagePublisher
imageOffer: imageOffer
imageSKU: imageSKU
galleryImageId: avdsig.outputs.avdidoutput
InvokeRunImageBuildThroughDeploymentScript: InvokeRunImageBuildThroughDeploymentScript
}
}