Skip to content

Commit f724ad2

Browse files
authored
Merge pull request #196 from tSQLt-org/AzurePipelineFix20231207
Azure pipeline fix20231207
2 parents a16745d + ac7b784 commit f724ad2

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

Build/tSQLt.validatebuild.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@
451451
<echo message=" +----> outputfile: ${execute.sql.outputfile}" />
452452
<echo message=" +----> executeas: ${execute.sql.executeas}" />
453453
<echo message=" +----> sqlconnect: ${execute.sql.sqlconnect}" />
454-
<property name="execute.sql.sqlcmd" value="&quot;${sqlcmd.path}&quot;\sqlcmd ${execute.sql.sqlconnect} -I -i &quot;${execute.sql.executeas}&quot; ${execute.sql.filename} -v NewDbName=${execute.sql.newDatabase} DbName=${execute.sql.database} BuildLogTableName=&quot;${logtable.name}&quot; ExecuteStatement=&quot;${execute.sql.statement}&quot; -V11" />
454+
<property name="execute.sql.sqlcmd" value="&quot;${sqlcmd.path}&quot;\sqlcmd ${execute.sql.sqlconnect} -I -i &quot;${execute.sql.executeas}&quot; ${execute.sql.filename} -v NewDbName=${execute.sql.newDatabase} DbName=${execute.sql.database} BuildLogTableName=&quot;${logtable.name}&quot; ExecuteStatement=&quot;${execute.sql.statement}&quot; -V11 -C" />
455455
<echo message="${execute.sql.sqlcmd}" />
456456
<condition property="execute.sql.statement_or_file.output.tofile">
457457
<not>

CI/Azure-DevOps/AZ_MainPipeline.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau
2020
- name: VMMatrix
2121
type: object
2222
default:
23-
- name: SQL2008R2
24-
SQLVersionEdition: 2008R2Std
2523
- name: SQL2012
2624
SQLVersionEdition: 2012Ent
2725
- name: SQL2014
@@ -195,7 +193,7 @@ stages:
195193
inputs:
196194
targetType: 'inline'
197195
script: |
198-
$DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet
196+
$DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet -TrustServerCertificate
199197
$DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" }
200198
201199

CI/Azure-DevOps/CreateSQLVM_azcli.ps1

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
<# USAGE: ./CreateSQLVM.ps1 -Location "East US 2" -Size "Standard_D2as_v4" -ResourceGroupName "myTestResourceGroup" -VMAdminName "azureAdminName" -VMAdminPwd "aoeihag;ladjfalkj23" -SQLVersionEdition "2017" -SQLPort "41433" -SQLUserName "tSQLt_sa" -SQLPwd "aoeihag;ladjfalkj46" -BuildId "001" #>
1+
<# USAGE:
2+
3+
az login
4+
az account set --name "tSQLt CI Subscription"
5+
6+
./CreateSQLVM_azcli.ps1 -Location "East US 2" -Size "Standard_D2as_v4" -ResourceGroupName "myTestResourceGroup" -VMAdminName "azureadminname" -VMAdminPwd "aoeihag;ladjfalkj23" -SQLVersionEdition "2017" -SQLPort "41433" -SQLUserName "tSQLt_sa" -SQLPwd "aoeihag;ladjfalkj46" -BuildId "001" -VmPriority "Spot"
7+
#>
28
Param(
39
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $Location,
410
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $Size,
@@ -98,22 +104,30 @@ $FQDN = (az network public-ip show --resource-group $ResourceGroupName --name $P
98104
Log-Output "FQDN: ", $FQDN;
99105
Log-Output "DONE: Creating PIP $PipName";
100106

101-
Log-Output "START: Creating NSG and Rules $NsgName";
107+
Log-Output "START: Creating NSG and Rules $NsgName --> nsg create";
102108
$output = az network nsg create --name $NsgName --resource-group $ResourceGroupName --location $Location | ConvertFrom-Json;
103109
if (!$output) {
104110
Write-Error "Error creating NIC";
105111
return
106112
}
113+
Log-Output "START: Creating NSG and Rules $NsgName --> nsg rule create --name `"RDPRule`"";
114+
$DestPort = 3389;
115+
Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><->";
116+
Log-Output "ResourceGroupName: ", $ResourceGroupName;
117+
Log-Output "NsgName: ", $NsgName;
118+
Log-Output "DestPort: ", $DestPort;
119+
Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><->";
107120
$output = az network nsg rule create --name "RDPRule" --nsg-name $NsgName --priority 1000 --resource-group $ResourceGroupName --access Allow `
108-
--destination-address-prefixes * --destination-port-ranges 3389 --direction Inbound --protocol Tcp --source-address-prefixes * `
109-
--source-port-ranges * | ConvertFrom-Json;
121+
--destination-address-prefixes '*' --destination-port-ranges $DestPort --direction Inbound --protocol Tcp --source-address-prefixes '*' `
122+
--source-port-ranges '*' | ConvertFrom-Json;
110123
if (!$output) {
111124
Write-Error "Error creating NIC RDPRule";
112125
return
113126
}
127+
Log-Output "START: Creating NSG and Rules $NsgName --> nsg rule create --name `"MSSQLRule`"";
114128
$output = az network nsg rule create --name "MSSQLRule" --nsg-name $NsgName --priority 1001 --resource-group $ResourceGroupName --access Allow `
115-
--destination-address-prefixes * --destination-port-ranges $SQLPort --direction Inbound --protocol Tcp --source-address-prefixes * `
116-
--source-port-ranges * | ConvertFrom-Json;
129+
--destination-address-prefixes '*' --destination-port-ranges $SQLPort --direction Inbound --protocol Tcp --source-address-prefixes '*' `
130+
--source-port-ranges '*' | ConvertFrom-Json;
117131
if (!$output) {
118132
Write-Error "Error creating NIC MSSQLRule";
119133
return
@@ -163,7 +177,7 @@ $SQLVM|Out-String|Log-Output;
163177
Log-Output 'DONE: Applying SqlVM Config'
164178

165179
Log-Output 'START: Prep SQL Server for tSQLt Build'
166-
$DS = Invoke-Sqlcmd -InputFile "$dir/GetSQLServerVersion.sql" -ServerInstance "$FQDN,$SQLPort" -Username "$SQLUserName" -Password "$SQLPwd" -As DataSet
180+
$DS = Invoke-Sqlcmd -InputFile "$dir/GetSQLServerVersion.sql" -ServerInstance "$FQDN,$SQLPort" -Username "$SQLUserName" -Password "$SQLPwd" -As DataSet -TrustServerCertificate
167181
$DS.Tables[0].Rows | %{ Log-Output "{ $($_['LoginName']), $($_['TimeStamp']), $($_['VersionDetail']), $($_['ProductVersion']), $($_['ProductLevel']), $($_['SqlVersion']), $($_['ServerCollation']) }" }
168182

169183
$ActualSQLVersion = $DS.Tables[0].Rows[0]['SqlVersion'];

0 commit comments

Comments
 (0)