Skip to content

Azure pipeline fix20231207 #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Build/tSQLt.validatebuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
<echo message=" +----> outputfile: ${execute.sql.outputfile}" />
<echo message=" +----> executeas: ${execute.sql.executeas}" />
<echo message=" +----> sqlconnect: ${execute.sql.sqlconnect}" />
<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" />
<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" />
<echo message="${execute.sql.sqlcmd}" />
<condition property="execute.sql.statement_or_file.output.tofile">
<not>
Expand Down
4 changes: 1 addition & 3 deletions CI/Azure-DevOps/AZ_MainPipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau
- name: VMMatrix
type: object
default:
- name: SQL2008R2
SQLVersionEdition: 2008R2Std
- name: SQL2012
SQLVersionEdition: 2012Ent
- name: SQL2014
Expand Down Expand Up @@ -195,7 +193,7 @@ stages:
inputs:
targetType: 'inline'
script: |
$DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet
$DS = Invoke-Sqlcmd -Query "SELECT SUSER_NAME() U,SYSDATETIME() T,@@VERSION V;" -ServerInstance "$(CreateSQLVMEnvironment.FQDNAndPort)" -Username "$(CreateSQLVMEnvironment.SQLUserName)" -Password "$(CreateSQLVMEnvironment.SQLPwd)" -As DataSet -TrustServerCertificate
$DS.Tables[0].Rows | %{ echo "{ $($_['U']), $($_['T']), $($_['V']) }" }


Expand Down
28 changes: 21 additions & 7 deletions CI/Azure-DevOps/CreateSQLVM_azcli.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<# 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" #>
<# USAGE:

az login
az account set --name "tSQLt CI Subscription"

./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"
#>
Param(
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $Location,
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $Size,
Expand Down Expand Up @@ -98,22 +104,30 @@ $FQDN = (az network public-ip show --resource-group $ResourceGroupName --name $P
Log-Output "FQDN: ", $FQDN;
Log-Output "DONE: Creating PIP $PipName";

Log-Output "START: Creating NSG and Rules $NsgName";
Log-Output "START: Creating NSG and Rules $NsgName --> nsg create";
$output = az network nsg create --name $NsgName --resource-group $ResourceGroupName --location $Location | ConvertFrom-Json;
if (!$output) {
Write-Error "Error creating NIC";
return
}
Log-Output "START: Creating NSG and Rules $NsgName --> nsg rule create --name `"RDPRule`"";
$DestPort = 3389;
Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><->";
Log-Output "ResourceGroupName: ", $ResourceGroupName;
Log-Output "NsgName: ", $NsgName;
Log-Output "DestPort: ", $DestPort;
Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><->";
$output = az network nsg rule create --name "RDPRule" --nsg-name $NsgName --priority 1000 --resource-group $ResourceGroupName --access Allow `
--destination-address-prefixes * --destination-port-ranges 3389 --direction Inbound --protocol Tcp --source-address-prefixes * `
--source-port-ranges * | ConvertFrom-Json;
--destination-address-prefixes '*' --destination-port-ranges $DestPort --direction Inbound --protocol Tcp --source-address-prefixes '*' `
--source-port-ranges '*' | ConvertFrom-Json;
if (!$output) {
Write-Error "Error creating NIC RDPRule";
return
}
Log-Output "START: Creating NSG and Rules $NsgName --> nsg rule create --name `"MSSQLRule`"";
$output = az network nsg rule create --name "MSSQLRule" --nsg-name $NsgName --priority 1001 --resource-group $ResourceGroupName --access Allow `
--destination-address-prefixes * --destination-port-ranges $SQLPort --direction Inbound --protocol Tcp --source-address-prefixes * `
--source-port-ranges * | ConvertFrom-Json;
--destination-address-prefixes '*' --destination-port-ranges $SQLPort --direction Inbound --protocol Tcp --source-address-prefixes '*' `
--source-port-ranges '*' | ConvertFrom-Json;
if (!$output) {
Write-Error "Error creating NIC MSSQLRule";
return
Expand Down Expand Up @@ -163,7 +177,7 @@ $SQLVM|Out-String|Log-Output;
Log-Output 'DONE: Applying SqlVM Config'

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

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