-
Notifications
You must be signed in to change notification settings - Fork 71
247 lines (226 loc) · 13.1 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
name: Data Landing Zone Deployment
on:
push:
branches: [main]
paths:
- "infra/**"
- "code/**"
- ".github/workflows/dataLandingZoneDeployment.yml"
pull_request:
branches: [main]
paths:
- "infra/**"
- "code/**"
- ".github/workflows/dataLandingZoneDeployment.yml"
env:
AZURE_SUBSCRIPTION_ID: "2150d511-458f-43b9-8691-6819ba2e6c7b" # Update to '{dataLandingZoneSubscriptionId}'
AZURE_LOCATION: "northeurope" # Update to '{regionName}'
jobs:
validation:
name: "Validation of IaC templates"
runs-on: ubuntu-latest
continue-on-error: false
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check Out Repository
id: checkout_repository
uses: actions/checkout@v3
# Login to Azure
- name: Azure Login
id: azure_login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
# Generate Password
- name: Generate Password
id: generate_password_001
run: |
echo "Generating Password"
pwsh "${GITHUB_WORKSPACE}/code/GeneratePassword.ps1" -GitHub
# Deploy Data Landing Zone - validation
- name: Deploy Data Landing Zone - validation
id: data_landing_zone_validation
uses: azure/arm-deploy@v1
with:
scope: subscription
subscriptionId: ${{ env.AZURE_SUBSCRIPTION_ID }}
region: ${{ env.AZURE_LOCATION }}
template: ${{ github.workspace }}/infra/main.json
parameters: ${{ github.workspace }}/infra/params.dev.json administratorPassword="${{ steps.generate_password_001.outputs.password }}"
deploymentMode: Validate
failOnStdErr: false
# Deploy Data Landing Zone - what-if
- name: Deploy Data Landing Zone - what-if
id: data_landing_zone_whatif
uses: azure/CLI@v1
with:
azcliversion: "agentazcliversion"
inlineScript: |
az account set \
--subscription ${{ env.AZURE_SUBSCRIPTION_ID }}
az deployment sub what-if \
--location ${{ env.AZURE_LOCATION }} \
--subscription ${{ env.AZURE_SUBSCRIPTION_ID }} \
--exclude-change-types Ignore NoChange Unsupported \
--template-file "${GITHUB_WORKSPACE}/infra/main.json" \
--parameters "${GITHUB_WORKSPACE}/infra/params.dev.json" administratorPassword="${{ steps.generate_password_001.outputs.password }}" \
--result-format "FullResourcePayloads"
# Log out from Azure
- name: Log out from Azure
id: azure_logout
uses: azure/cli@v1
with:
azcliversion: "agentazcliversion"
inlineScript: |
az logout
deployment:
name: "Deployment of IaC templates"
needs: [validation]
runs-on: ubuntu-latest
if: github.event_name == 'push'
continue-on-error: false
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check Out Repository
id: checkout_repository
uses: actions/checkout@v3
# Login to Azure
- name: Azure Login
id: azure_login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true
# Generate Password
- name: Generate Password
id: generate_password_001
run: |
echo "Generating Password"
pwsh "${GITHUB_WORKSPACE}/code/GeneratePassword.ps1" -GitHub
# Deploy Data Landing Zone
- name: Deploy Data Landing Zone
id: data_landing_zone_deployment001
uses: azure/arm-deploy@v1
with:
scope: subscription
subscriptionId: ${{ env.AZURE_SUBSCRIPTION_ID }}
region: ${{ env.AZURE_LOCATION }}
template: ${{ github.workspace }}/infra/main.json
parameters: ${{ github.workspace }}/infra/params.dev.json administratorPassword="${{ steps.generate_password_001.outputs.password }}"
deploymentMode: Incremental
failOnStdErr: false
# Restart MySql Server 001
- name: Restart MySql Server 001
id: mysqlserver_001_restart
uses: azure/powershell@v1
with:
azPSVersion: latest
inlineScript: |
& "${{ github.workspace }}/code/RestartMySqlServer.ps1" `
-SubscriptionId "${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001SubscriptionId }}" `
-ResourceGroupName "${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001ResourceGroupName }}" `
-MySqlServerName "${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001Name }}"
# # Setup databricks 001 - Disabled, because automation is currently blocked.
# - name: Setup Databricks 001
# id: setup_databricks_001
# uses: azure/powershell@v1
# with:
# azPSVersion: latest
# inlineScript: |
# Write-Host "Setting Up Databricks Workspace 001"
# & "${{ github.workspace }}/code/SetupDatabricks.ps1" `
# -DatabricksWorkspaceName '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001Name }}' `
# -DatabricksWorkspaceId '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001Id }}' `
# -DatabricksApiUrl '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001ApiUrl }}' `
# -DatabricksSubscriptionId '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001SubscriptionId }}' `
# -DatabricksResourceGroupName '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001ResourceGroupName }}' `
# -HiveKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001KeyVaultid }}' `
# -HiveConnectionStringSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001ConnectionStringSecretName }}' `
# -HiveUsernameSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001UsernameSecretName }}' `
# -HivePasswordSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001PasswordSecretName }}' `
# -LogAnalyticsKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeyVaultId }}' `
# -LogAnalyticsWorkspaceIdSecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceIdSecretName }}' `
# -LogAnalyticsWorkspaceKeySecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeySecretName }}' `
# -HiveVersion '2.3.7' `
# -HadoopVersion '2.7.4' `
# Setup Databricks 001 - Manual Step - Guidance
- name: Setup Databricks 001 - Manual Step - Guidance
id: setup_databricks_001_manual
run: |
echo "Please run the following Powershell command to setup Databricks Workspace 001:
./code/SetupDatabricksManually.ps1 \`
-UserEmail '{userEmail}' \`
-UserPassword '{password}' \`
-ClientId '{clientId}' \`
-TenantId '{tenantId}' \`
-DatabricksWorkspaceName '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001Name }}' \`
-DatabricksWorkspaceId '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001Id }}' \`
-DatabricksApiUrl '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001ApiUrl }}' \`
-DatabricksSubscriptionId '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001SubscriptionId }}' \`
-DatabricksResourceGroupName '${{ steps.data_landing_zone_deployment001.outputs.databricksIntegration001ResourceGroupName }}' \`
-HiveKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001KeyVaultid }}' \`
-HiveConnectionStringSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001ConnectionStringSecretName }}' \`
-HiveUsernameSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001UsernameSecretName }}' \`
-HivePasswordSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001PasswordSecretName }}' \`
-LogAnalyticsKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeyVaultId }}' \`
-LogAnalyticsWorkspaceIdSecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceIdSecretName }}' \`
-LogAnalyticsWorkspaceKeySecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeySecretName }}' \`
-HiveVersion '2.3.7' \`
-HadoopVersion '2.7.4'
"
# # Setup databricks 002 - Disabled, because automation is currently blocked.
# - name: Setup Databricks 002
# id: setup_databricks_002
# uses: azure/powershell@v1
# with:
# azPSVersion: latest
# inlineScript: |
# Write-Host "Setting Up Databricks Workspace 002"
# & "${{ github.workspace }}/code/SetupDatabricks.ps1" `
# -DatabricksWorkspaceName '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001Name }}' `
# -DatabricksWorkspaceId '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001Id }}' `
# -DatabricksApiUrl '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001ApiUrl }}' `
# -DatabricksSubscriptionId '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001SubscriptionId }}' `
# -DatabricksResourceGroupName '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001ResourceGroupName }}' `
# -HiveKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001KeyVaultid }}' `
# -HiveConnectionStringSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001ConnectionStringSecretName }}' `
# -HiveUsernameSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001UsernameSecretName }}' `
# -HivePasswordSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001PasswordSecretName }}' `
# -LogAnalyticsKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeyVaultId }}' `
# -LogAnalyticsWorkspaceIdSecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceIdSecretName }}' `
# -LogAnalyticsWorkspaceKeySecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeySecretName }}' `
# -HiveVersion '2.3.7' `
# -HadoopVersion '2.7.4' `
# Setup Databricks 002 - Manual Step - Guidance
- name: Setup Databricks 002 - Manual Step - Guidance
id: setup_databricks_002_manual
run: |
echo "Please run the following Powershell command to setup Databricks Workspace 002:
./code/SetupDatabricksManually.ps1 \`
-UserEmail '{userEmail}' \`
-UserPassword '{password}' \`
-ClientId '{clientId}' \`
-TenantId '{tenantId}' \`
-DatabricksWorkspaceName '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001Name }}' \`
-DatabricksWorkspaceId '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001Id }}' \`
-DatabricksApiUrl '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001ApiUrl }}' \`
-DatabricksSubscriptionId '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001SubscriptionId }}' \`
-DatabricksResourceGroupName '${{ steps.data_landing_zone_deployment001.outputs.databricksProduct001ResourceGroupName }}' \`
-HiveKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001KeyVaultid }}' \`
-HiveConnectionStringSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001ConnectionStringSecretName }}' \`
-HiveUsernameSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001UsernameSecretName }}' \`
-HivePasswordSecretName '${{ steps.data_landing_zone_deployment001.outputs.mySqlServer001PasswordSecretName }}' \`
-LogAnalyticsKeyVaultId '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeyVaultId }}' \`
-LogAnalyticsWorkspaceIdSecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceIdSecretName }}' \`
-LogAnalyticsWorkspaceKeySecretName '${{ steps.data_landing_zone_deployment001.outputs.logAnalyticsWorkspaceKeySecretName }}' \`
-HiveVersion '2.3.7' \`
-HadoopVersion '2.7.4'
"
# Log out from Azure
- name: Log out from Azure
id: azure_logout
uses: azure/cli@v1
with:
azcliversion: "agentazcliversion"
inlineScript: |
az logout