@@ -39,7 +39,7 @@ function Test-CreateDatabaseInternal ($location = "westcentralus")
39
39
$job1 | Wait-Job
40
40
$db = $job1.Output
41
41
42
- Assert-AreEqual $databaseName $db.DatabaseName
42
+ Assert-AreEqual $databaseName $db.DatabaseName
43
43
Assert-NotNull $db.MaxSizeBytes
44
44
Assert-NotNull $db.Edition
45
45
Assert-NotNull $db.CurrentServiceObjectiveName
@@ -68,7 +68,7 @@ function Test-CreateDatabaseInternal ($location = "westcentralus")
68
68
Assert-AreEqual $dwdb.Edition DataWarehouse
69
69
Assert-AreEqual $dwdb.CurrentServiceObjectiveName DW100
70
70
Assert-AreEqual $dwdb.CollationName $collationName
71
-
71
+
72
72
# Create with all parameters
73
73
$databaseName = Get-DatabaseName
74
74
$db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName `
@@ -107,7 +107,7 @@ function Test-CreateDatabaseInternal ($location = "westcentralus")
107
107
#>
108
108
function Test-CreateVcoreDatabase
109
109
{
110
- # Setup
110
+ # Setup
111
111
$location = Get-Location " Microsoft.Sql" " operations" " Southeast Asia"
112
112
$rg = Create- ResourceGroupForTest $location
113
113
$server = Create- ServerForTest $rg $location
@@ -120,7 +120,7 @@ function Test-CreateVcoreDatabase
120
120
$job1 | Wait-Job
121
121
$db = $job1.Output
122
122
123
- Assert-AreEqual $databaseName $db.DatabaseName
123
+ Assert-AreEqual $databaseName $db.DatabaseName
124
124
Assert-NotNull $db.MaxSizeBytes
125
125
Assert-AreEqual GP_Gen4_2 $db.CurrentServiceObjectiveName
126
126
Assert-AreEqual 2 $db.Capacity
@@ -132,7 +132,7 @@ function Test-CreateVcoreDatabase
132
132
$job1 | Wait-Job
133
133
$db = $job1.Output
134
134
135
- Assert-AreEqual $databaseName $db.DatabaseName
135
+ Assert-AreEqual $databaseName $db.DatabaseName
136
136
Assert-NotNull $db.MaxSizeBytes
137
137
Assert-AreEqual GP_Gen4_2 $db.CurrentServiceObjectiveName
138
138
Assert-AreEqual 2 $db.Capacity
@@ -144,6 +144,45 @@ function Test-CreateVcoreDatabase
144
144
}
145
145
}
146
146
147
+ <#
148
+ . SYNOPSIS
149
+ Tests creating a database with license type.
150
+ #>
151
+ function Test-CreateVcoreDatabaseWithLicenseType
152
+ {
153
+ # Setup
154
+ $location = Get-Location " Microsoft.Sql" " operations" " West Central US"
155
+ $rg = Create- ResourceGroupForTest
156
+ $server = Create- ServerForTest $rg $location
157
+
158
+ try
159
+ {
160
+ # Create with Edition and RequestedServiceObjectiveName - Base Price
161
+ $databaseName = Get-DatabaseName
162
+ $db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - RequestedServiceObjectiveName GP_Gen4_1 - Edition GeneralPurpose - LicenseType BasePrice
163
+ Assert-AreEqual BasePrice $db.LicenseType
164
+
165
+ # Create with Edition and RequestedServiceObjectiveName - LicenseIncluded
166
+ $databaseName = Get-DatabaseName
167
+ $db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - RequestedServiceObjectiveName GP_Gen4_1 - Edition GeneralPurpose - LicenseType LicenseIncluded
168
+ Assert-AreEqual LicenseIncluded $db.LicenseType
169
+
170
+ # Create with VCore parameter set - BasePrice
171
+ $databaseName = Get-DatabaseName
172
+ $db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - VCore 2 - ComputeGeneration Gen4 - Edition GeneralPurpose - LicenseType BasePrice
173
+ Assert-AreEqual BasePrice $db.LicenseType
174
+
175
+ # Create with VCore parameter set - LicenseIncluded
176
+ $databaseName = Get-DatabaseName
177
+ $db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - VCore 2 - ComputeGeneration Gen4 - Edition GeneralPurpose - LicenseType LicenseIncluded
178
+ Assert-AreEqual LicenseIncluded $db.LicenseType
179
+ }
180
+ finally
181
+ {
182
+ Remove-ResourceGroupForTest $rg
183
+ }
184
+ }
185
+
147
186
<#
148
187
. SYNOPSIS
149
188
Tests creating a database with sample name.
@@ -245,13 +284,13 @@ function Test-UpdateDatabaseInternal ($location = "westcentralus")
245
284
# Setup
246
285
$rg = Create- ResourceGroupForTest
247
286
$server = Create- ServerForTest $rg $location
248
-
287
+
249
288
$databaseName = Get-DatabaseName
250
289
$db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName `
251
290
- Edition Standard - MaxSizeBytes 250 GB - RequestedServiceObjectiveName S0
252
291
Assert-AreEqual $db.DatabaseName $databaseName
253
292
254
- # Database will be Standard s0 with maxsize: 268435456000 (250GB)
293
+ # Database will be Standard s0 with maxsize: 268435456000 (250GB)
255
294
256
295
try
257
296
{
@@ -307,11 +346,11 @@ function Test-UpdateDatabaseInternal ($location = "westcentralus")
307
346
308
347
<#
309
348
. SYNOPSIS
310
- Tests updating a vcore database
349
+ Tests updating a vcore database
311
350
#>
312
- function Test-UpdateVcoreDatabase ()
351
+ function Test-UpdateVcoreDatabase ()
313
352
{
314
- # Setup
353
+ # Setup
315
354
$location = Get-Location " Microsoft.Sql" " operations" " Southeast Asia"
316
355
$rg = Create- ResourceGroupForTest $location
317
356
$server = Create- ServerForTest $rg $location
@@ -385,6 +424,47 @@ function Test-UpdateVcoreDatabase ()
385
424
}
386
425
}
387
426
427
+ <#
428
+ . SYNOPSIS
429
+ Tests updating a vcore database license type
430
+ #>
431
+ function Test-UpdateVcoreDatabaseLicenseType ()
432
+ {
433
+ # Setup
434
+ $location = Get-Location " Microsoft.Sql" " operations" " Southeast Asia"
435
+ $rg = Create- ResourceGroupForTest $location
436
+ $server = Create- ServerForTest $rg $location
437
+
438
+ # Create vcore database
439
+ $databaseName = Get-DatabaseName
440
+ $db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - RequestedServiceObjectiveName GP_Gen4_1 - Edition GeneralPurpose
441
+ Assert-AreEqual $db.DatabaseName $databaseName
442
+ Assert-AreEqual $db.LicenseType LicenseIncluded # Default license type
443
+
444
+ try
445
+ {
446
+ # Alter with license type - License Included
447
+ $db1 = Set-AzureRmSqlDatabase - ResourceGroupName $db.ResourceGroupName - ServerName $db.ServerName - DatabaseName $db.DatabaseName - LicenseType LicenseIncluded
448
+ Assert-AreEqual LicenseIncluded $db1.LicenseType
449
+
450
+ # Alter with license type - Base Price
451
+ $db1 = Set-AzureRmSqlDatabase - ResourceGroupName $db.ResourceGroupName - ServerName $db.ServerName - DatabaseName $db.DatabaseName - LicenseType BasePrice
452
+ Assert-AreEqual BasePrice $db1.LicenseType
453
+
454
+ # Test piping - LicenseIncluded
455
+ $db1 = $db1 | Set-AzureRmSqlDatabase - LicenseType LicenseIncluded
456
+ Assert-AreEqual LicenseIncluded $db1.LicenseType
457
+
458
+ # Test piping - BasePrice
459
+ $db1 = $db1 | Set-AzureRmSqlDatabase - LicenseType BasePrice
460
+ Assert-AreEqual BasePrice $db1.LicenseType
461
+ }
462
+ finally
463
+ {
464
+ Remove-ResourceGroupForTest $rg
465
+ }
466
+ }
467
+
388
468
<#
389
469
. SYNOPSIS
390
470
Tests updating a database with zone redundancy
@@ -395,7 +475,7 @@ function Test-UpdateDatabaseWithZoneRedundant ()
395
475
$location = Get-Location " Microsoft.Sql" " operations" " Southeast Asia"
396
476
$rg = Create- ResourceGroupForTest $location
397
477
$server = Create- ServerForTest $rg $location
398
-
478
+
399
479
$databaseName = Get-DatabaseName
400
480
$db1 = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName `
401
481
- Edition Premium
@@ -442,7 +522,7 @@ function Test-UpdateDatabaseWithZoneRedundantNotSpecified ()
442
522
$location = Get-Location " Microsoft.Sql" " operations" " Southeast Asia"
443
523
$rg = Create- ResourceGroupForTest $location
444
524
$server = Create- ServerForTest $rg $location
445
-
525
+
446
526
$databaseName = Get-DatabaseName
447
527
$db = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName `
448
528
- Edition Premium - ZoneRedundant
@@ -480,7 +560,7 @@ function Test-RenameDatabase
480
560
{
481
561
$location = " westcentralus"
482
562
$server = Create- ServerForTest $rg $location
483
-
563
+
484
564
# Create with default values
485
565
$databaseName = Get-DatabaseName
486
566
$db1 = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - MaxSizeBytes 1 GB
@@ -528,17 +608,17 @@ function Test-GetDatabaseInternal ($location = "westcentralus")
528
608
# Setup
529
609
$rg = Create- ResourceGroupForTest
530
610
$server = Create- ServerForTest $rg $location
531
-
611
+
532
612
# Create with default values
533
613
$databaseName = Get-DatabaseName
534
614
$db1 = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - MaxSizeBytes 1 GB
535
615
Assert-AreEqual $db1.DatabaseName $databaseName
536
616
537
- # Create database with non-defaults
617
+ # Create database with non-defaults
538
618
$databaseName = Get-DatabaseName
539
619
$db2 = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName `
540
620
- CollationName " Japanese_Bushu_Kakusu_100_CS_AS" - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic
541
- Assert-AreEqual $db2.DatabaseName $databaseName
621
+ Assert-AreEqual $db2.DatabaseName $databaseName
542
622
543
623
try
544
624
{
@@ -556,21 +636,21 @@ function Test-GetDatabaseInternal ($location = "westcentralus")
556
636
$all = $server | Get-AzureRmSqlDatabase
557
637
Assert-AreEqual $all.Count 4 # 4 because master database is included
558
638
559
- $gdb1 = Get-AzureRmSqlDatabase - ResourceGroupName $server.ResourceGroupname - ServerName $server.ServerName - DatabaseName $db1.DatabaseName
560
- Assert-NotNull $gdb1
561
- Assert-AreEqual $db1.DatabaseName $gdb1.DatabaseName
562
- Assert-AreEqual $db1.Edition $gdb1.Edition
563
- Assert-AreEqual $db1.CollationName $gdb1.CollationName
564
- Assert-AreEqual $db1.CurrentServiceObjectiveName $gdb1.CurrentServiceObjectiveName
565
- Assert-AreEqual $db1.MaxSizeBytes $gdb1.MaxSizeBytes
566
-
567
- $gdb2 = $db2 | Get-AzureRmSqlDatabase
568
- Assert-NotNull $gdb2
569
- Assert-AreEqual $db2.DatabaseName $gdb2.DatabaseName
570
- Assert-AreEqual $db2.Edition $gdb2.Edition
571
- Assert-AreEqual $db2.CollationName $gdb2.CollationName
572
- Assert-AreEqual $db2.CurrentServiceObjectiveName $gdb2.CurrentServiceObjectiveName
573
- Assert-AreEqual $db2.MaxSizeBytes $gdb2.MaxSizeBytes
639
+ $gdb1 = Get-AzureRmSqlDatabase - ResourceGroupName $server.ResourceGroupname - ServerName $server.ServerName - DatabaseName $db1.DatabaseName
640
+ Assert-NotNull $gdb1
641
+ Assert-AreEqual $db1.DatabaseName $gdb1.DatabaseName
642
+ Assert-AreEqual $db1.Edition $gdb1.Edition
643
+ Assert-AreEqual $db1.CollationName $gdb1.CollationName
644
+ Assert-AreEqual $db1.CurrentServiceObjectiveName $gdb1.CurrentServiceObjectiveName
645
+ Assert-AreEqual $db1.MaxSizeBytes $gdb1.MaxSizeBytes
646
+
647
+ $gdb2 = $db2 | Get-AzureRmSqlDatabase
648
+ Assert-NotNull $gdb2
649
+ Assert-AreEqual $db2.DatabaseName $gdb2.DatabaseName
650
+ Assert-AreEqual $db2.Edition $gdb2.Edition
651
+ Assert-AreEqual $db2.CollationName $gdb2.CollationName
652
+ Assert-AreEqual $db2.CurrentServiceObjectiveName $gdb2.CurrentServiceObjectiveName
653
+ Assert-AreEqual $db2.MaxSizeBytes $gdb2.MaxSizeBytes
574
654
}
575
655
finally
576
656
{
@@ -634,17 +714,17 @@ function Test-RemoveDatabaseInternal ($location = "westcentralus")
634
714
# Setup
635
715
$rg = Create- ResourceGroupForTest
636
716
$server = Create- ServerForTest $rg $location
637
-
717
+
638
718
# Create with default values
639
719
$databaseName = Get-DatabaseName
640
720
$db1 = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName - MaxSizeBytes 1 GB
641
721
Assert-AreEqual $db1.DatabaseName $databaseName
642
722
643
- # Create database with non-defaults
723
+ # Create database with non-defaults
644
724
$databaseName = Get-DatabaseName
645
725
$db2 = New-AzureRmSqlDatabase - ResourceGroupName $rg.ResourceGroupName - ServerName $server.ServerName - DatabaseName $databaseName `
646
726
- CollationName " Japanese_Bushu_Kakusu_100_CS_AS" - MaxSizeBytes 1 GB - Edition Basic - RequestedServiceObjectiveName Basic
647
- Assert-AreEqual $db2.DatabaseName $databaseName
727
+ Assert-AreEqual $db2.DatabaseName $databaseName
648
728
649
729
try
650
730
{
@@ -655,16 +735,16 @@ function Test-RemoveDatabaseInternal ($location = "westcentralus")
655
735
Assert-AreEqual $dwdb.DatabaseName $databaseName
656
736
657
737
Remove-AzureRmSqlDatabase - ResourceGroupName $server.ResourceGroupname - ServerName $server.ServerName - DatabaseName $dwdb.DatabaseName - Force
658
-
738
+
659
739
$all = $server | Get-AzureRmSqlDatabase
660
740
Assert-AreEqual $all.Count 3 # 3 because master database is included
661
-
662
- Remove-AzureRmSqlDatabase - ResourceGroupName $server.ResourceGroupname - ServerName $server.ServerName - DatabaseName $db1.DatabaseName - Force
663
741
664
- $db2 | Remove-AzureRmSqlDatabase - Force
742
+ Remove-AzureRmSqlDatabase - ResourceGroupName $server.ResourceGroupname - ServerName $server.ServerName - DatabaseName $db1.DatabaseName - Force
743
+
744
+ $db2 | Remove-AzureRmSqlDatabase - Force
665
745
666
- $all = $server | Get-AzureRmSqlDatabase
667
- Assert-AreEqual $all.Count 1 # 1 because master database is included
746
+ $all = $server | Get-AzureRmSqlDatabase
747
+ Assert-AreEqual $all.Count 1 # 1 because master database is included
668
748
}
669
749
finally
670
750
{
0 commit comments