@@ -22,22 +22,26 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau
2222 default :
2323 # - name: SQL2012
2424 # SQLVersionEdition: 2012Ent
25- - name : SQL2014
26- SQLVersionEdition : 2014
25+ # - name: SQL2014
26+ # SQLVersionEdition: 2014
2727 - name : SQL2016
2828 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
4145 - name : VMPriority
4246 displayName : VM Priority
4347 type : string
@@ -221,14 +225,12 @@ stages:
221225 # $SerializedVMDetails;
222226
223227 # -----------------------------------------------------------------------#
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.) #
226229 # ---------------------------------------|-------------------------------#
227230 $FQDNAndPort = $VMDetails.SQLVmFQDN + ", " + $VMDetails.SQLVmPort;
228231 # ---------------------------------------|-------------------------------#
229232 # -----------------------------------------------------------------------#
230233
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.
232234 $ResourceGroupName = $VMDetails.ResourceGroupName;
233235 Write-Host "##vso[task.setvariable variable=SQLUserName;isOutput=true]$SQLUserName"
234236 Write-Host "##vso[task.setvariable variable=SQLPwd;isOutput=true]$SQLPwd"
@@ -238,17 +240,54 @@ stages:
238240 # Write-Host "##vso[task.setvariable variable=SerializedVMDetails;isOutput=true]$SerializedVMDetails";
239241
240242
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
241255 - task : PowerShell@2
242- name : PrintSQLVersionInfo
243- env :
244- USER_NAME : $(tSQLt-UserForCIEnvironment-UserName)
245- PASSWORD : $(tSQLt-UserForCIEnvironment-Password)
256+ name : PrintSQLInfo
246257 inputs :
247258 targetType : ' inline'
248259 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
250272 $DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" }
251273
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+
252291
253292# #########################################################################################################
254293# # BUILD tSQLt - PART 1 ##
@@ -257,6 +296,7 @@ stages:
257296
258297- stage : Build_tSQLt_Part1
259298 dependsOn : [] # this removes the implicit dependency on previous stage and causes this to run in parallel
299+ condition : eq(${{ parameters.CreateEnvOnly }}, false)
260300
261301 jobs :
262302
@@ -395,9 +435,6 @@ stages:
395435 ${{ format('{0}', version.name) }} :
396436 SQLVersionEdition : ${{ version.SQLVersionEdition }}
397437
398- pool :
399- vmImage : ' windows-latest'
400-
401438 variables :
402439 databaseAccessDetails : $[convertToJson(stageDependencies.Create_Environments.Create.outputs)]
403440
@@ -805,20 +842,21 @@ stages:
805842 dependsOn :
806843 - Create_Environments
807844 - Validate
808- condition : always()
845+
846+ condition : not(eq(${{ parameters.CreateEnvOnly }}, true))
847+
809848 pool :
810849 vmImage : ' windows-latest'
811850
812851 jobs :
813-
814852 - job : Delete_VM
815853
816854 strategy :
817855 matrix :
818856 ${{ each version in parameters.VMMatrix }} :
819857 ${{ format('{0}', version.name) }} :
820858 SQLVersionEdition : ${{ version.SQLVersionEdition }}
821-
859+
822860 variables :
823861 databaseAccessDetails : $[convertToJson(stageDependencies.Create_Environments.Create.outputs)]
824862
0 commit comments