Skip to content

Commit 62e72ed

Browse files
committed
Making exceptions for 2008R2
1 parent 05b7364 commit 62e72ed

File tree

2 files changed

+68
-7
lines changed

2 files changed

+68
-7
lines changed

CI/Azure-DevOps/CreateSQLVM_azcli.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,20 @@ Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><->";
5555
URN for az cli --> $SQLVersionEditionInfo.publisher+":"+$SQLVersionEditionInfo.offer+":"+$SQLVersionEditionInfo.sku+":"+$SQLVersionEditionInfo.version
5656
#>
5757
$SQLVersionEditionHash = @{
58-
"2008R2Std"=@{"sqlversion"="2008R2";"offer"="SQL2008R2SP3-WS2008R2SP1";"publisher"="microsoftsqlserver";"sku"="Standard";"osType"="Windows";"version"="latest"}; #MicrosoftSQLServer:SQL2008R2SP3-WS2008R2SP1:Standard:latest
59-
"2012Ent"=@{"sqlversion"="2012";"offer"="SQL2012SP4-WS2012R2";"publisher"="microsoftsqlserver";"sku"="Enterprise";"osType"="Windows";"version"="latest"}; #MicrosoftSQLServer:SQL2012SP4-WS2012R2:Enterprise:latest
60-
"2014"=@{"sqlversion"="2014";"offer"="sql2014sp3-ws2012r2";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest"}; #MicrosoftSQLServer:sql2014sp3-ws2012r2:sqldev:latest
61-
"2016"=@{"sqlversion"="2016";"offer"="SQL2016SP2-WS2016";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest"}; #MicrosoftSQLServer:sql2016sp2-ws2019:sqldev:latest
62-
"2017"=@{"sqlversion"="2017";"offer"="sql2017-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest"}; #MicrosoftSQLServer:sql2017-ws2019:sqldev:latest
63-
"2019"=@{"sqlversion"="2019";"offer"="sql2019-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest"} #MicrosoftSQLServer:sql2019-ws2019:sqldev:latest
58+
"2008R2Std"=@{"sqlversion"="2008R2";"offer"="SQL2008R2SP3-WS2008R2SP1";"publisher"="microsoftsqlserver";"sku"="Standard";"osType"="Windows";"version"="latest";"bicep"="CreateSqlVirtualMachineTemplate-2008R2.bicep"}; #MicrosoftSQLServer:SQL2008R2SP3-WS2008R2SP1:Standard:latest
59+
"2012Ent"=@{"sqlversion"="2012";"offer"="SQL2012SP4-WS2012R2";"publisher"="microsoftsqlserver";"sku"="Enterprise";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:SQL2012SP4-WS2012R2:Enterprise:latest
60+
"2014"=@{"sqlversion"="2014";"offer"="sql2014sp3-ws2012r2";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2014sp3-ws2012r2:sqldev:latest
61+
"2016"=@{"sqlversion"="2016";"offer"="SQL2016SP2-WS2016";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2016sp2-ws2019:sqldev:latest
62+
"2017"=@{"sqlversion"="2017";"offer"="sql2017-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"}; #MicrosoftSQLServer:sql2017-ws2019:sqldev:latest
63+
"2019"=@{"sqlversion"="2019";"offer"="sql2019-ws2019";"publisher"="microsoftsqlserver";"sku"="sqldev";"osType"="Windows";"version"="latest";"bicep"="CreateSQLVirtualMachineTemplate.bicep"} #MicrosoftSQLServer:sql2019-ws2019:sqldev:latest
6464
};
6565

6666
$SQLVersionEditionInfo = $SQLVersionEditionHash.$SQLVersionEdition;
6767
$ImageUrn = $SQLVersionEditionInfo.publisher+":"+$SQLVersionEditionInfo.offer+":"+$SQLVersionEditionInfo.sku+":"+$SQLVersionEditionInfo.version;
68+
$TemplateFile = $dir + "/" + $SQLVersionEditionInfo.bicep;
6869
Log-Output "ImageUrn: ", $ImageUrn;
6970
Log-Output "SQLVersionEditionInfo: ", $SQLVersionEditionInfo;
71+
Log-Output "TemplateFile: ", $TemplateFile;
7072

7173
Log-Output "START: Creating Resource Group $ResourceGroupName";
7274
$output = az group create --location "$Location" --name "$ResourceGroupName" | ConvertFrom-Json;
@@ -151,7 +153,7 @@ Log-Output "VmResourceId: ", $VmResourceId;
151153
Log-Output "DONE: Creating VM $VMName";
152154

153155
Log-Output 'START: Applying SqlVM Config'
154-
$output = az deployment group create --resource-group $ResourceGroupName --template-file "$dir/CreateSQLVirtualMachineTemplate.bicep" `
156+
$output = az deployment group create --resource-group $ResourceGroupName --template-file "$TemplateFile" `
155157
--parameters sqlPortNumber=$SQLPort sqlAuthenticationLogin="$SQLUserName" sqlAuthenticationPassword="$SQLPwd" newVMName="$VMName" newVMRID="$VmResourceId" | ConvertFrom-Json;
156158
if (!$output) {
157159
Write-Error "Error creating SqlVM";
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
param sqlConnectivityType string = 'Public'
2+
param sqlPortNumber int = 41433
3+
param sqlStorageWorkloadType string = 'General'
4+
param sqlStorageDisksConfigurationType string = 'NEW'
5+
param sqlDataSettingsDefaultFilePath string = 'F:\\data'
6+
param sqlDataSettingsLUNs array = [
7+
0
8+
]
9+
param sqlLogSettingsDefaultFilePath string = 'F:\\log'
10+
param sqlLogSettingsLUNs array = [
11+
0
12+
]
13+
param sqlAutopatchingDayOfWeek string = 'Sunday'
14+
param sqlAutopatchingStartHour int = 2
15+
param sqlAutopatchingWindowDuration int = 60
16+
param sqlAuthenticationLogin string = 'tSQLt'
17+
param sqlAuthenticationPassword string = 'sdlfksdlkfjlsdkjf39939^'
18+
param newVMName string = 'V1052sql2014sp3'
19+
param newVMRID string = '/subscriptions/58c04a99-5b92-410c-9e41-10262f68ca80/resourceGroups/tSQLtCI_DevTestLab_20200318_1052-V1052sql2014sp3-155797/providers/Microsoft.Compute/virtualMachines/V1052sql2014sp3'
20+
21+
resource newVMName_resource 'Microsoft.SqlVirtualMachine/SqlVirtualMachines@2017-03-01-preview' = {
22+
name: newVMName
23+
location: resourceGroup().location
24+
properties: {
25+
virtualMachineResourceId: newVMRID
26+
sqlManagement: 'Full'
27+
sqlServerLicenseType: 'PAYG'
28+
autoPatchingSettings: {
29+
enable: true
30+
dayOfWeek: sqlAutopatchingDayOfWeek
31+
maintenanceWindowStartingHour: sqlAutopatchingStartHour
32+
maintenanceWindowDuration: sqlAutopatchingWindowDuration
33+
}
34+
keyVaultCredentialSettings: {
35+
enable: false
36+
credentialName: ''
37+
}
38+
storageConfigurationSettings: {
39+
diskConfigurationType: sqlStorageDisksConfigurationType
40+
sqlDataSettings : {
41+
luns: sqlDataSettingsLUNs
42+
defaultFilePath: sqlDataSettingsDefaultFilePath
43+
}
44+
sqlLogSettings: {
45+
luns: sqlLogSettingsLUNs
46+
defaultFilePath: sqlLogSettingsDefaultFilePath
47+
}
48+
storageWorkloadType: sqlStorageWorkloadType
49+
}
50+
serverConfigurationsManagementSettings: {
51+
sqlConnectivityUpdateSettings: {
52+
connectivityType: sqlConnectivityType
53+
port: sqlPortNumber
54+
sqlAuthUpdateUserName: sqlAuthenticationLogin
55+
sqlAuthUpdatePassword: sqlAuthenticationPassword
56+
}
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)