forked from Azure/data-landing-zone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataLandingZoneDeployment.yml
294 lines (275 loc) · 15 KB
/
dataLandingZoneDeployment.yml
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
name: Data Landing Zone Deployment
trigger:
branches:
include:
- main
paths:
include:
- infra/*
- code/*
- .ado/workflows/dataLandingZoneDeployment.yml
pr:
branches:
include:
- main
paths:
include:
- infra/*
- code/*
- .ado/workflows/dataLandingZoneDeployment.yml
variables:
AZURE_RESOURCE_MANAGER_CONNECTION_NAME: "data-landing-zone-001-service-connection" # Update to '{resourceManagerConnectionName}'
AZURE_SUBSCRIPTION_ID: "2150d511-458f-43b9-8691-6819ba2e6c7b" # Update to '{dataLandingZoneSubscriptionId}'
AZURE_LOCATION: "northeurope" # Update to '{regionName}'
stages:
- stage: Validation
displayName: 'Validation of IaC templates'
jobs:
- job: Validation
displayName: 'Validation of IaC templates'
continueOnError: false
pool:
vmImage: 'ubuntu-latest'
steps:
# Checkout code
- checkout: self
name: checkout_repository
displayName: 'Checkout repository'
submodules: true
lfs: false
clean: true
continueOnError: false
enabled: true
# Generate Password
- task: PowerShell@2
name: generate_password_001
displayName: Generate Password
enabled: true
continueOnError: false
inputs:
targetType: 'filePath'
filePath: '$(System.DefaultWorkingDirectory)/code/GeneratePassword.ps1'
errorActionPreference: 'stop'
failOnStderr: false
ignoreLASTEXITCODE: false
pwsh: true
# Deploy Data Landing Zone - validation
- task: AzureResourceManagerTemplateDeployment@3
name: data_landing_zone_validation
displayName: Data Landing Zone - validation
enabled: true
continueOnError: false
inputs:
deploymentScope: "Subscription"
azureResourceManagerConnection: ${{ variables.AZURE_RESOURCE_MANAGER_CONNECTION_NAME }}
subscriptionId: ${{ variables.AZURE_SUBSCRIPTION_ID }}
location: ${{ variables.AZURE_LOCATION }}
templateLocation: "Linked artifact"
csmFile: "$(System.DefaultWorkingDirectory)/infra/main.json"
csmParametersFile: "$(System.DefaultWorkingDirectory)/infra/params.dev.json"
deploymentMode: "Validation"
overrideParameters: >
-administratorPassword "$(password)"
# Deploy Data Landing Zone - what-if
- task: AzureCLI@2
name: data_landing_zone_whatif
displayName: Deploy Data Landing Zone - what-if
enabled: true
continueOnError: false
inputs:
azureSubscription: ${{ variables.AZURE_RESOURCE_MANAGER_CONNECTION_NAME }}
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
az account set `
--subscription ${{ variables.AZURE_SUBSCRIPTION_ID }}
az deployment sub what-if `
--location ${{ variables.AZURE_LOCATION }} `
--subscription ${{ variables.AZURE_SUBSCRIPTION_ID }} `
--exclude-change-types Ignore NoChange Unsupported `
--template-file "$(System.DefaultWorkingDirectory)/infra/main.json" `
--parameters "$(System.DefaultWorkingDirectory)/infra/params.dev.json" administratorPassword="$(password)" `
--result-format "FullResourcePayloads"
powerShellErrorActionPreference: "stop"
addSpnToEnvironment: false
useGlobalConfig: false
failOnStandardError: false
powerShellIgnoreLASTEXITCODE: false
- stage: Deployment
displayName: 'Deployment of IaC templates'
dependsOn: Validation
# condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'))
jobs:
- job: Deployment
displayName: 'Deployment of IaC templates'
continueOnError: false
pool:
vmImage: 'ubuntu-latest'
steps:
# Checkout code
- checkout: self
name: checkout_repository
displayName: 'Checkout repository'
submodules: true
lfs: false
clean: true
continueOnError: false
enabled: true
# Generate Password
- task: PowerShell@2
name: generate_password_001
displayName: Generate Password
enabled: true
continueOnError: false
inputs:
targetType: 'filePath'
filePath: '$(System.DefaultWorkingDirectory)/code/GeneratePassword.ps1'
errorActionPreference: 'stop'
failOnStderr: false
ignoreLASTEXITCODE: false
pwsh: true
# Deploy Data Landing Zone
- task: AzureResourceManagerTemplateDeployment@3
name: data_landing_zone_deployment_001
displayName: Data Landing Zone
enabled: true
continueOnError: false
inputs:
deploymentScope: "Subscription"
azureResourceManagerConnection: ${{ variables.AZURE_RESOURCE_MANAGER_CONNECTION_NAME }}
subscriptionId: ${{ variables.AZURE_SUBSCRIPTION_ID }}
location: ${{ variables.AZURE_LOCATION }}
templateLocation: "Linked artifact"
csmFile: "$(System.DefaultWorkingDirectory)/infra/main.json"
csmParametersFile: "$(System.DefaultWorkingDirectory)/infra/params.dev.json"
deploymentOutputs: 'dataLandingZoneDetails01'
deploymentMode: "Incremental"
overrideParameters: >
-administratorPassword "$(password)"
# Restart MySQL Server 001
- task: AzurePowerShell@4
name: mysqlserver_001_restart
displayName: Restart MySQL Server 001
enabled: true
continueOnError: false
inputs:
azureSubscription: ${{ variables.AZURE_RESOURCE_MANAGER_CONNECTION_NAME }}
scriptType: 'filePath'
scriptPath: '$(System.DefaultWorkingDirectory)/code/RestartMySqlServer.ps1'
scriptArguments:
-SubscriptionId $(dataLandingZoneDetails01.mySqlServer001SubscriptionId.value)
-ResourceGroupName $(dataLandingZoneDetails01.mySqlServer001ResourceGroupName.value)
-MySqlServerName $(dataLandingZoneDetails01.mySqlServer001Name.value)
errorActionPreference: 'stop'
failOnStandardError: false
azurePowerShellVersion: 'latestVersion'
# # Setup Databricks 001 - Disabled, because automation is currently blocked.
# - task: AzureCLI@2
# name: setup_databricks_001
# displayName: Setup Databricks 001
# enabled: true
# continueOnError: false
# inputs:
# azureSubscription: ${{ variables.AZURE_RESOURCE_MANAGER_CONNECTION_NAME }}
# scriptType: pscore
# scriptLocation: 'scriptPath'
# scriptPath: '$(System.DefaultWorkingDirectory)/code/SetupDatabricks.ps1'
# powerShellErrorActionPreference: 'stop'
# addSpnToEnvironment: true
# failOnStandardError: false
# powerShellIgnoreLASTEXITCODE: false
# arguments: >
# -DatabricksWorkspaceName $(dataLandingZoneDetails01.databricksIntegration001Name.value)
# -DatabricksWorkspaceId $(dataLandingZoneDetails01.databricksIntegration001Id.value)
# -DatabricksApiUrl $(dataLandingZoneDetails01.databricksIntegration001ApiUrl.value)
# -DatabricksSubscriptionId $(dataLandingZoneDetails01.databricksIntegration001SubscriptionId.value)
# -DatabricksResourceGroupName $(dataLandingZoneDetails01.databricksIntegration001ResourceGroupName.value)
# -HiveKeyVaultId $(dataLandingZoneDetails01.mySqlServer001KeyVaultid.value)
# -HiveConnectionStringSecretName $(dataLandingZoneDetails01.mySqlServer001ConnectionStringSecretName.value)
# -HiveUsernameSecretName $(dataLandingZoneDetails01.mySqlServer001UsernameSecretName.value)
# -HivePasswordSecretName $(dataLandingZoneDetails01.mySqlServer001PasswordSecretName.value)
# -LogAnalyticsKeyVaultId $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeyVaultId.value)
# -LogAnalyticsWorkspaceIdSecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceIdSecretName.value)
# -LogAnalyticsWorkspaceKeySecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeySecretName.value)
# -HiveVersion '2.3.7'
# -HadoopVersion '2.7.4'
# Setup Databricks 001 - Manual Step - Guidance
- bash: |
echo "Please run the following Powershell command to setup Databricks Workspace 001:
./code/SetupDatabricksManually.ps1 \`
-UserEmail '{userEmail}' \`
-UserPassword '{password}' \`
-ClientId '{clientId}' \`
-TenantId '{tenantId}' \`
-DatabricksWorkspaceName $(dataLandingZoneDetails01.databricksIntegration001Name.value) \`
-DatabricksWorkspaceId $(dataLandingZoneDetails01.databricksIntegration001Id.value) \`
-DatabricksApiUrl $(dataLandingZoneDetails01.databricksIntegration001ApiUrl.value) \`
-DatabricksSubscriptionId $(dataLandingZoneDetails01.databricksIntegration001SubscriptionId.value) \`
-DatabricksResourceGroupName $(dataLandingZoneDetails01.databricksIntegration001ResourceGroupName.value) \`
-HiveKeyVaultId $(dataLandingZoneDetails01.mySqlServer001KeyVaultid.value) \`
-HiveConnectionStringSecretName $(dataLandingZoneDetails01.mySqlServer001ConnectionStringSecretName.value) \`
-HiveUsernameSecretName $(dataLandingZoneDetails01.mySqlServer001UsernameSecretName.value) \`
-HivePasswordSecretName $(dataLandingZoneDetails01.mySqlServer001PasswordSecretName.value) \`
-LogAnalyticsKeyVaultId $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeyVaultId.value) \`
-LogAnalyticsWorkspaceIdSecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceIdSecretName.value) \`
-LogAnalyticsWorkspaceKeySecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeySecretName.value) \`
-HiveVersion '2.3.7' \`
-HadoopVersion '2.7.4'
"
name: setup_databricks_001_manual
displayName: Setup Databricks 001 - Manual Step - Guidance
# # Setup databricks 002 - Disabled, because automation is currently blocked.
# - task: AzureCLI@2
# name: setup_databricks_002
# displayName: Setup databricks 002
# enabled: true
# continueOnError: false
# inputs:
# azureSubscription: ${{ variables.AZURE_RESOURCE_MANAGER_CONNECTION_NAME }}
# scriptType: pscore
# scriptLocation: 'scriptPath'
# scriptPath: '$(System.DefaultWorkingDirectory)/code/SetupDatabricks.ps1'
# powerShellErrorActionPreference: 'stop'
# addSpnToEnvironment: true
# failOnStandardError: false
# powerShellIgnoreLASTEXITCODE: false
# arguments: >
# -DatabricksWorkspaceName $(dataLandingZoneDetails01.databricksProduct001Name.value)
# -DatabricksWorkspaceId $(dataLandingZoneDetails01.databricksProduct001Id.value)
# -DatabricksApiUrl $(dataLandingZoneDetails01.databricksProduct001ApiUrl.value)
# -DatabricksSubscriptionId $(dataLandingZoneDetails01.databricksProduct001SubscriptionId.value)
# -DatabricksResourceGroupName $(dataLandingZoneDetails01.databricksProduct001ResourceGroupName.value)
# -HiveKeyVaultId $(dataLandingZoneDetails01.mySqlServer001KeyVaultid.value)
# -HiveConnectionStringSecretName $(dataLandingZoneDetails01.mySqlServer001ConnectionStringSecretName.value)
# -HiveUsernameSecretName $(dataLandingZoneDetails01.mySqlServer001UsernameSecretName.value)
# -HivePasswordSecretName $(dataLandingZoneDetails01.mySqlServer001PasswordSecretName.value)
# -LogAnalyticsKeyVaultId $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeyVaultId.value)
# -LogAnalyticsWorkspaceIdSecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceIdSecretName.value)
# -LogAnalyticsWorkspaceKeySecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeySecretName.value)
# -HiveVersion '2.3.7'
# -HadoopVersion '2.7.4'
# Setup Databricks 002 - Manual Step - Guidance
- bash: |
echo "Please run the following Powershell command to setup Databricks Workspace 002:
./code/SetupDatabricksManually.ps1 \`
-UserEmail '{userEmail}' \`
-UserPassword '{password}' \`
-ClientId '{clientId}' \`
-TenantId '{tenantId}' \`
-DatabricksWorkspaceName $(dataLandingZoneDetails01.databricksProduct001Name.value) \`
-DatabricksWorkspaceId $(dataLandingZoneDetails01.databricksProduct001Id.value) \`
-DatabricksApiUrl $(dataLandingZoneDetails01.databricksProduct001ApiUrl.value) \`
-DatabricksSubscriptionId $(dataLandingZoneDetails01.databricksProduct001SubscriptionId.value) \`
-DatabricksResourceGroupName $(dataLandingZoneDetails01.databricksProduct001ResourceGroupName.value) \`
-HiveKeyVaultId $(dataLandingZoneDetails01.mySqlServer001KeyVaultid.value) \`
-HiveConnectionStringSecretName $(dataLandingZoneDetails01.mySqlServer001ConnectionStringSecretName.value) \`
-HiveUsernameSecretName $(dataLandingZoneDetails01.mySqlServer001UsernameSecretName.value) \`
-HivePasswordSecretName $(dataLandingZoneDetails01.mySqlServer001PasswordSecretName.value) \`
-LogAnalyticsKeyVaultId $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeyVaultId.value) \`
-LogAnalyticsWorkspaceIdSecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceIdSecretName.value) \`
-LogAnalyticsWorkspaceKeySecretName $(dataLandingZoneDetails01.logAnalyticsWorkspaceKeySecretName.value) \`
-HiveVersion '2.3.7' \`
-HadoopVersion '2.7.4'
"
name: setup_databricks_002_manual
displayName: Setup Databricks 002 - Manual Step - Guidance