@@ -22,22 +22,26 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau
22
22
default :
23
23
# - name: SQL2012
24
24
# SQLVersionEdition: 2012Ent
25
- - name : SQL2014
26
- SQLVersionEdition : 2014
25
+ # - name: SQL2014
26
+ # SQLVersionEdition: 2014
27
27
- name : SQL2016
28
28
SQLVersionEdition : 2016
29
- - name : SQL2017
30
- SQLVersionEdition : 2017
31
- - name : SQL2019
32
- SQLVersionEdition : 2019
33
- - name : SQL2022
34
- SQLVersionEdition : 2022
35
- - name : SQL2017Linux
36
- SQLVersionEdition : 2017L
37
- - name : SQL2019Linux
38
- SQLVersionEdition : 2019L
39
- - name : SQL2022Linux
40
- SQLVersionEdition : 2022L
29
+ # - name: SQL2017
30
+ # SQLVersionEdition: 2017
31
+ # - name: SQL2019
32
+ # SQLVersionEdition: 2019
33
+ # - name: SQL2022
34
+ # SQLVersionEdition: 2022
35
+ # - name: SQL2017Linux
36
+ # SQLVersionEdition: 2017L
37
+ # - name: SQL2019Linux
38
+ # SQLVersionEdition: 2019L
39
+ # - name: SQL2022Linux
40
+ # SQLVersionEdition: 2022L
41
+ - name : CreateEnvOnly
42
+ displayName : Create Environment Only
43
+ default : false
44
+ type : boolean
41
45
- name : VMPriority
42
46
displayName : VM Priority
43
47
type : string
@@ -221,14 +225,12 @@ stages:
221
225
# $SerializedVMDetails;
222
226
223
227
# -----------------------------------------------------------------------#
224
- # IMPORTANT (and, you've got to be kidding me): #
225
- # The space below is absolutely required to make the ANT Task work. #
228
+ # The space below is required to make ANT work. (Not currently in use.) #
226
229
# ---------------------------------------|-------------------------------#
227
230
$FQDNAndPort = $VMDetails.SQLVmFQDN + ", " + $VMDetails.SQLVmPort;
228
231
# ---------------------------------------|-------------------------------#
229
232
# -----------------------------------------------------------------------#
230
233
231
- # TODO refactor such that the resourcegroupname is created in a previous step, so that it can be used by the delete job, even if this one is cancelled/failed.
232
234
$ResourceGroupName = $VMDetails.ResourceGroupName;
233
235
Write-Host "##vso[task.setvariable variable=SQLUserName;isOutput=true]$SQLUserName"
234
236
Write-Host "##vso[task.setvariable variable=SQLPwd;isOutput=true]$SQLPwd"
@@ -238,17 +240,54 @@ stages:
238
240
# Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails";
239
241
240
242
243
+ - job : PrintSQLInfo
244
+ dependsOn : Create
245
+ strategy :
246
+ matrix :
247
+ ${{ each version in parameters.VMMatrix }} :
248
+ ${{ format('{0}', version.name) }} :
249
+ SQLVersionEdition : ${{ version.SQLVersionEdition }}
250
+ SQLVersionName : ${{ version.name }}
251
+ variables :
252
+ databaseAccessDetails : $[convertToJson(dependencies.Create.outputs)]
253
+ steps :
254
+ - checkout : none
241
255
- task : PowerShell@2
242
- name : PrintSQLVersionInfo
243
- env :
244
- USER_NAME : $(tSQLt-UserForCIEnvironment-UserName)
245
- PASSWORD : $(tSQLt-UserForCIEnvironment-Password)
256
+ name : PrintSQLInfo
246
257
inputs :
247
258
targetType : ' inline'
248
259
script : |
249
- $DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet -TrustServerCertificate
260
+ $inputObject = @'
261
+ $(databaseAccessDetails)
262
+ '@;
263
+ $myJsonObject = ConvertFrom-JSON -InputObject $inputObject;
264
+ $SQLUserNameKey = "$(System.JobName).CreateSQLVMEnvironment.SQLUserName";
265
+ $SQLPwdKey = "$(System.JobName).CreateSQLVMEnvironment.SQLPwd";
266
+ $FQDNAndPortKey = "$(System.JobName).CreateSQLVMEnvironment.FQDNAndPort";
267
+ $SQLUserName = $myJsonObject.$SQLUserNameKey;
268
+ $SQLPwd = $myJsonObject.$SQLPwdKey;
269
+ $FQDNAndPort = $myJsonObject.$FQDNAndPortKey;
270
+
271
+ $DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$FQDNAndPort" -Username "$SQLUserName" -Password "$SQLPwd" -As DataSet -TrustServerCertificate
250
272
$DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" }
251
273
274
+ if("${{ parameters.CreateEnvOnly }}" -ieq "true"){
275
+ Write-Host '==========================================================' -ForegroundColor Yellow;
276
+ Write-Host "Name: $(SQLVersionName)";
277
+ Write-Host "FQDN: $FQDNAndPort";
278
+ Write-Host "User: $SQLUserName";
279
+ Write-Host "Pass: $SQLPwd";
280
+ Write-Host '==========================================================' -ForegroundColor Yellow;
281
+
282
+ Write-Warning 'This information is now public! Run the following Powershell Statement to change the password immediately!';
283
+
284
+ $PwdChngCommand = "`$NewPwd = -join ((40..95+97..126) | Get-Random -Count 40 | % {[char]`$_}); Write-Output `"New Password: `$NewPwd`"; Invoke-Sqlcmd -Query `"ALTER LOGIN [$SQLUserName] WITH PASSWORD = '`$NewPwd';`" -ServerInstance `"$FQDNAndPort`" -Username `"$SQLUserName`" -Password `"$SQLPwd`" -TrustServerCertificate;";
285
+ Write-Host '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' -ForegroundColor Yellow;
286
+ Write-Host $PwdChngCommand
287
+ Write-Host '==========================================================' -ForegroundColor Yellow;
288
+
289
+ }
290
+
252
291
253
292
# #########################################################################################################
254
293
# # BUILD tSQLt - PART 1 ##
@@ -257,6 +296,7 @@ stages:
257
296
258
297
- stage : Build_tSQLt_Part1
259
298
dependsOn : [] # this removes the implicit dependency on previous stage and causes this to run in parallel
299
+ condition : eq(${{ parameters.CreateEnvOnly }}, false)
260
300
261
301
jobs :
262
302
@@ -395,9 +435,6 @@ stages:
395
435
${{ format('{0}', version.name) }} :
396
436
SQLVersionEdition : ${{ version.SQLVersionEdition }}
397
437
398
- pool :
399
- vmImage : ' windows-latest'
400
-
401
438
variables :
402
439
databaseAccessDetails : $[convertToJson(stageDependencies.Create_Environments.Create.outputs)]
403
440
@@ -805,20 +842,21 @@ stages:
805
842
dependsOn :
806
843
- Create_Environments
807
844
- Validate
808
- condition : always()
845
+
846
+ condition : not(eq(${{ parameters.CreateEnvOnly }}, true))
847
+
809
848
pool :
810
849
vmImage : ' windows-latest'
811
850
812
851
jobs :
813
-
814
852
- job : Delete_VM
815
853
816
854
strategy :
817
855
matrix :
818
856
${{ each version in parameters.VMMatrix }} :
819
857
${{ format('{0}', version.name) }} :
820
858
SQLVersionEdition : ${{ version.SQLVersionEdition }}
821
-
859
+
822
860
variables :
823
861
databaseAccessDetails : $[convertToJson(stageDependencies.Create_Environments.Create.outputs)]
824
862
0 commit comments