Skip to content

Commit c485acd

Browse files
committed
Merge pull request Azure#35 from Azure/ignite
u
2 parents 5a13577 + c109fcb commit c485acd

19 files changed

+10013
-2103
lines changed

src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6666
</Reference>
6767
<Reference Include="Microsoft.Azure.Management.Sql">
68-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.23.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
68+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.24.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7171
<SpecificVersion>False</SpecificVersion>
@@ -163,6 +163,7 @@
163163
<Compile Include="ScenarioTests\ServerCrudTests.cs" />
164164
<Compile Include="ScenarioTests\ServerUpgradeTests.cs" />
165165
<Compile Include="ScenarioTests\SqlTestsBase.cs" />
166+
<Compile Include="ScenarioTests\TransparentDataEncryptionCrudTests.cs" />
166167
<Compile Include="UnitTests\AzureSqlCmdletBaseAttributeTests.cs" />
167168
<Compile Include="UnitTests\AzureSqlDatabaseAttributeTests.cs" />
168169
<Compile Include="UnitTests\AzureSqlDatabaseServerServiceObjectiveAttributeTests.cs" />
@@ -223,6 +224,9 @@
223224
<None Include="ScenarioTests\ServerUpgradeTests.ps1">
224225
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
225226
</None>
227+
<None Include="ScenarioTests\TransparentDataEncryptionCrudTests.ps1">
228+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
229+
</None>
226230
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.DataMaskingTests\TestDatabaseDataMaskingBasicRuleLifecycle.json">
227231
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
228232
</None>
@@ -376,6 +380,12 @@
376380
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerCrudTests\TestServerUpdate.json">
377381
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
378382
</None>
383+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.TransparentDataEncryptionCrudTests\TestDatabaseTransparentDataEncryptionGet.json">
384+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
385+
</None>
386+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.TransparentDataEncryptionCrudTests\TestDatabaseTransparentDataEncryptionUpdate.json">
387+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
388+
</None>
379389
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerUpgradeTests\TestServerUpgradeWithRecommendedDatabase.json">
380390
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
381391
</None>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ScenarioTest.SqlTests;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Xunit;
18+
19+
namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
20+
{
21+
public class TransparentDataEncryptionCrudTests : SqlTestsBase
22+
{
23+
[Fact]
24+
[Trait(Category.Sql, Category.CheckIn)]
25+
public void TestDatabaseTransparentDataEncryptionUpdate()
26+
{
27+
RunPowerShellTest("Test-UpdateTransparentDataEncryption");
28+
}
29+
30+
[Fact]
31+
[Trait(Category.Sql, Category.CheckIn)]
32+
public void TestDatabaseTransparentDataEncryptionGet()
33+
{
34+
RunPowerShellTest("Test-GetTransparentDataEncryption");
35+
}
36+
}
37+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Tests updating a database transparent data encryption
18+
#>
19+
function Test-UpdateTransparentDataEncryption
20+
{
21+
# Setup
22+
$rg = Create-ResourceGroupForTest
23+
$server = Create-ServerForTest $rg
24+
25+
# Create with default values
26+
$databaseName = Get-DatabaseName
27+
$db = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName
28+
Assert-AreEqual $db.DatabaseName $databaseName
29+
30+
#Default database will be Standard s0 with maxsize: 268435456000 (250GB)
31+
32+
try
33+
{
34+
# Alter all properties
35+
$tde1 = Set-AzureSqlDatabaseTransparentDataEncryption -ResourceGroupName $db.ResourceGroupName -ServerName $db.ServerName -DatabaseName $db.DatabaseName `
36+
-State Enabled
37+
Assert-AreEqual $tde1.State Enabled
38+
}
39+
finally
40+
{
41+
Remove-ResourceGroupForTest $rg
42+
}
43+
}
44+
45+
46+
<#
47+
.SYNOPSIS
48+
Tests Getting a database transparent data encryption
49+
#>
50+
function Test-GetTransparentDataEncryption
51+
{
52+
# Setup
53+
$rg = Create-ResourceGroupForTest
54+
$server = Create-ServerForTest $rg
55+
56+
# Create with default values
57+
$databaseName = Get-DatabaseName
58+
$db = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName
59+
Assert-AreEqual $db.DatabaseName $databaseName
60+
61+
try
62+
{
63+
$tde1 = Get-AzureSqlDatabaseTransparentDataEncryption -ResourceGroupName $server.ResourceGroupname -ServerName $server.ServerName -DatabaseName $db.DatabaseName
64+
Assert-AreEqual $tde1.State Disabled
65+
66+
$tde2 = $tde1 | Get-AzureSqlDatabaseTransparentDataEncryption
67+
Assert-AreEqual $tde2.State Disabled
68+
69+
# Alter all properties
70+
$tde3 = Set-AzureSqlDatabaseTransparentDataEncryption -ResourceGroupName $db.ResourceGroupName -ServerName $db.ServerName -DatabaseName $db.DatabaseName `
71+
-State Enabled
72+
Assert-AreEqual $tde3.State Enabled
73+
74+
$tdeActivity = Get-AzureSqlDatabaseTransparentDataEncryptionActivity -ResourceGroupName $server.ResourceGroupname -ServerName $server.ServerName -DatabaseName $db.DatabaseName
75+
Assert-AreEqual $tdeActivity.Status Encrypting
76+
77+
$tde4 = Get-AzureSqlDatabaseTransparentDataEncryption -ResourceGroupName $server.ResourceGroupname -ServerName $server.ServerName -DatabaseName $db.DatabaseName
78+
Assert-AreEqual $tde4.State Enabled
79+
}
80+
finally
81+
{
82+
Remove-ResourceGroupForTest $rg
83+
}
84+
}

0 commit comments

Comments
 (0)