Skip to content

Commit 300ee8d

Browse files
committed
Merge pull request #615 from yoavrubin/dev
Adding support of storage v2 to Sql auditing
2 parents 179166f + 10a4115 commit 300ee8d

36 files changed

+10400
-9543
lines changed

ChangeLog.txt

Lines changed: 99 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,107 @@
1-
2015.07.16 version 0.9.5
1+
2015.07.17 version 0.9.5
2+
* Azure SQL cmdlets
3+
* Allowing to use of Storage V2 accounts in Auditing policies
24
* Azure RedisCache cmdlets
3-
* Set-AzureRedisCache - Bug fix done in management API that fixes bug here as well, Make return type public
4-
* New-AzureRedisCache - Make return type public
5-
* Get-AzureRedisCache - Make return type public
6-
* Azure Network Resource Provider cmdlets
7-
* Added Application Gateway cmdlets
8-
* New-AzureApplicationGateway
9-
* Start-AzureApplicationGateway
10-
* Stop-AzureApplicationGateway
11-
* SetAzureApplicationGateway
12-
* GetAzureApplicationGateway
13-
* RemoveAzureApplicationGateway
14-
* Added Application Gateway Backend Address Pool cmdlets
15-
* New-AzureApplicationGatewayBackendAddressPool
16-
* Add-AzureApplicationGatewayBackendAddressPool
17-
* Set-AzureApplicationGatewayBackendAddressPool
18-
* Get-AzureApplicationGatewayBackendAddressPool
19-
* Remove-AzureApplicationGatewayBackendAddressPool
20-
* Added Application Gateway Backend HTTP Settings cmdlets
21-
* New-AzureApplicationGatewayBackendHttpSettings
22-
* Add-AzureApplicationGatewayBackendHttpSettings
23-
* Set-AzureApplicationGatewayBackendHttpSettings
24-
* Get-AzureApplicationGatewayBackendHttpSettings
25-
* Remove-AzureApplicationGatewayBackendHttpSettings
26-
* Added Application Gateway Frontend IP Configuration cmdlets
27-
* New-AzureApplicationGatewayFrontendIPConfiguration
28-
* Add-AzureApplicationGatewayFrontendIPConfiguration
29-
* Set-AzureApplicationGatewayFrontendIPConfiguration
30-
* Get-AzureApplicationGatewayFrontendIPConfiguration
31-
* Remove-AzureApplicationGatewayFrontendIPConfiguration
32-
* Added Application Gateway Frontend Port cmdlets
33-
* New-AzureApplicationGatewayFrontendPort
34-
* Add-AzureApplicationGatewayFrontendPort
35-
* Set-AzureApplicationGatewayFrontendPort
36-
* Get-AzureApplicationGatewayFrontendPort
37-
* Remove-AzureApplicationGatewayFrontendPort
38-
* Added Application Gateway IP Configuration cmdlets
39-
* New-AzureApplicationGatewayGatewayIPConfiguration
40-
* Add-AzureApplicationGatewayGatewayIPConfiguration
41-
* Set-AzureApplicationGatewayGatewayIPConfiguration
42-
* Get-AzureApplicationGatewayGatewayIPConfiguration
43-
* Remove-AzureApplicationGatewayGatewayIPConfiguration
44-
* Added Application Gateway HTTP Listener cmdlets
45-
* New-AzureApplicationGatewayHttpListener
46-
* Add-AzureApplicationGatewayHttpListener
47-
* Set-AzureApplicationGatewayHttpListener
48-
* Get-AzureApplicationGatewayHttpListener
49-
* Remove-AzureApplicationGatewayHttpListener
50-
* Added Application Gateway Request Routing Rule cmdlets
51-
* New-AzureApplicationGatewayRequestRoutingRule
52-
* Add-AzureApplicationGatewayRequestRoutingRule
53-
* Set-AzureApplicationGatewayRequestRoutingRule
54-
* Get-AzureApplicationGatewayRequestRoutingRule
55-
* Remove-AzureApplicationGatewayRequestRoutingRule
56-
* Added Application Gateway SKU cmdlets
57-
* New-AzureApplicationGatewaySku
58-
* Set-AzureApplicationGatewaySku
59-
* Get-AzureApplicationGatewaySku
60-
* Added Application Gateway SSL Certificate cmdlets
61-
* New-AzureApplicationGatewaySslCertificate
62-
* Add-AzureApplicationGatewaySslCertificate
63-
* Set-AzureApplicationGatewaySslCertificate
64-
* Get-AzureApplicationGatewaySslCertificate
65-
* Remove-AzureApplicationGatewaySslCertificate
66-
* Fixed minor bugs AzureLoadbalancer
67-
* Renamed Get-AzureCheckDnsAvailablity to Test-AzureDnsAvailability
68-
* Added cmdlets to RouteTables and Routes
69-
* New-AzureRouteTable
70-
* Get-AzureRouteTable
71-
* Set-AzureRouteTable
72-
* Remove-AzureRouteTable
73-
* New-AzureRouteConfig
74-
* Add-AzureRouteConfig
75-
* Set-AzureRouteConfig
76-
* Get-AzureRouteConfig
77-
* Remove-AzureRouteConfig
78-
*Azure Network cmdlets
79-
* Reserved IP cmdlets (New-AzureReservedIP, Get-AzureReservedIP, Set-AzureReservedIPAssociation, Remove-AzureReservedIPAssociation) fixed to support -VirtualIPName parameter
80-
* Multivip Cmdlets (Add-AzureVirtualIP, Remove-AzureVirtualIP) fixed to support -VirtualIPName parameter
81-
82-
2015.07.10 version 1.0.0
5+
* Set-AzureRedisCache - Bug fix done in management API that fixes bug here as well, Make return type public
6+
* New-AzureRedisCache - Make return type public
7+
* Get-AzureRedisCache - Make return type public
8+
* Azure Network Resource Provider cmdlets
9+
* Added Application Gateway cmdlets
10+
* New-AzureApplicationGateway
11+
* Start-AzureApplicationGateway
12+
* Stop-AzureApplicationGateway
13+
* SetAzureApplicationGateway
14+
* GetAzureApplicationGateway
15+
* RemoveAzureApplicationGateway
16+
* Added Application Gateway Backend Address Pool cmdlets
17+
* New-AzureApplicationGatewayBackendAddressPool
18+
* Add-AzureApplicationGatewayBackendAddressPool
19+
* Set-AzureApplicationGatewayBackendAddressPool
20+
* Get-AzureApplicationGatewayBackendAddressPool
21+
* Remove-AzureApplicationGatewayBackendAddressPool
22+
* Added Application Gateway Backend HTTP Settings cmdlets
23+
* New-AzureApplicationGatewayBackendHttpSettings
24+
* Add-AzureApplicationGatewayBackendHttpSettings
25+
* Set-AzureApplicationGatewayBackendHttpSettings
26+
* Get-AzureApplicationGatewayBackendHttpSettings
27+
* Remove-AzureApplicationGatewayBackendHttpSettings
28+
* Added Application Gateway Frontend IP Configuration cmdlets
29+
* New-AzureApplicationGatewayFrontendIPConfiguration
30+
* Add-AzureApplicationGatewayFrontendIPConfiguration
31+
* Set-AzureApplicationGatewayFrontendIPConfiguration
32+
* Get-AzureApplicationGatewayFrontendIPConfiguration
33+
* Remove-AzureApplicationGatewayFrontendIPConfiguration
34+
* Added Application Gateway Frontend Port cmdlets
35+
* New-AzureApplicationGatewayFrontendPort
36+
* Add-AzureApplicationGatewayFrontendPort
37+
* Set-AzureApplicationGatewayFrontendPort
38+
* Get-AzureApplicationGatewayFrontendPort
39+
* Remove-AzureApplicationGatewayFrontendPort
40+
* Added Application Gateway IP Configuration cmdlets
41+
* New-AzureApplicationGatewayGatewayIPConfiguration
42+
* Add-AzureApplicationGatewayGatewayIPConfiguration
43+
* Set-AzureApplicationGatewayGatewayIPConfiguration
44+
* Get-AzureApplicationGatewayGatewayIPConfiguration
45+
* Remove-AzureApplicationGatewayGatewayIPConfiguration
46+
* Added Application Gateway HTTP Listener cmdlets
47+
* New-AzureApplicationGatewayHttpListener
48+
* Add-AzureApplicationGatewayHttpListener
49+
* Set-AzureApplicationGatewayHttpListener
50+
* Get-AzureApplicationGatewayHttpListener
51+
* Remove-AzureApplicationGatewayHttpListener
52+
* Added Application Gateway Request Routing Rule cmdlets
53+
* New-AzureApplicationGatewayRequestRoutingRule
54+
* Add-AzureApplicationGatewayRequestRoutingRule
55+
* Set-AzureApplicationGatewayRequestRoutingRule
56+
* Get-AzureApplicationGatewayRequestRoutingRule
57+
* Remove-AzureApplicationGatewayRequestRoutingRule
58+
* Added Application Gateway SKU cmdlets
59+
* New-AzureApplicationGatewaySku
60+
* Set-AzureApplicationGatewaySku
61+
* Get-AzureApplicationGatewaySku
62+
* Added Application Gateway SSL Certificate cmdlets
63+
* New-AzureApplicationGatewaySslCertificate
64+
* Add-AzureApplicationGatewaySslCertificate
65+
* Set-AzureApplicationGatewaySslCertificate
66+
* Get-AzureApplicationGatewaySslCertificate
67+
* Remove-AzureApplicationGatewaySslCertificate
68+
* Fixed minor bugs AzureLoadbalancer
69+
* Renamed Get-AzureCheckDnsAvailablity to Test-AzureDnsAvailability
70+
* Added cmdlets to RouteTables and Routes
71+
* New-AzureRouteTable
72+
* Get-AzureRouteTable
73+
* Set-AzureRouteTable
74+
* Remove-AzureRouteTable
75+
* New-AzureRouteConfig
76+
* Add-AzureRouteConfig
77+
* Set-AzureRouteConfig
78+
* Get-AzureRouteConfig
79+
* Remove-AzureRouteConfig
80+
* Azure Network cmdlets
81+
* Reserved IP cmdlets (New-AzureReservedIP, Get-AzureReservedIP, Set-AzureReservedIPAssociation, Remove-AzureReservedIPAssociation) fixed to support -VirtualIPName parameter
82+
* Multivip Cmdlets (Add-AzureVirtualIP, Remove-AzureVirtualIP) fixed to support -VirtualIPName parameter
8383
* Azure Backup cmdlets
84-
*Added New-AzureBackupVault cmdlets
85-
*Added Get-AzureBackupVault cmdlets
86-
*Added Set-AzureBackupVault cmdlets
87-
*Added Remove-AzureBackupVault cmdlets
88-
*Added Get-AzureBackupVaultCredential cmdlets
84+
*Added New-AzureBackupVault cmdlets
85+
*Added Get-AzureBackupVault cmdlets
86+
*Added Set-AzureBackupVault cmdlets
87+
*Added Remove-AzureBackupVault cmdlets
88+
*Added Get-AzureBackupVaultCredential cmdlets
8989
* Azure Resource Manager cmdlets
90-
* Fixed formatting of output for Get-UsageAggregates
91-
* Fixed executing Get-UsageAggregates when first cmdlet being called.
90+
* Fixed formatting of output for Get-UsageAggregates
91+
* Fixed executing Get-UsageAggregates when first cmdlet being called.
9292
* Added TrafficManager cmdlets
93-
* Enable-AzureTrafficManagerProfile
94-
* Disable-AzureTrafficManagerProfile
95-
* New-AzureTrafficManagerEndpoint
96-
* Get-AzureTrafficManagerEndpoint
97-
* Set-AzureTrafficManagerEndpoint
98-
* Remove-AzureTrafficManagerEndpoint
99-
* Enable-AzureTrafficManagerEndpoint
100-
* Disable-AzureTrafficManagerEndpoint
93+
* Enable-AzureTrafficManagerProfile
94+
* Disable-AzureTrafficManagerProfile
95+
* New-AzureTrafficManagerEndpoint
96+
* Get-AzureTrafficManagerEndpoint
97+
* Set-AzureTrafficManagerEndpoint
98+
* Remove-AzureTrafficManagerEndpoint
99+
* Enable-AzureTrafficManagerEndpoint
100+
* Disable-AzureTrafficManagerEndpoint
101101
* Upgraded TrafficManager cmdlets
102-
* Get-AzureTrafficManagerProfile
103-
* Name is now optional (it will list all profiles in resource group)
104-
* Resource group is now optional (it will list all profiles in subscription)
105-
102+
* Get-AzureTrafficManagerProfile
103+
* Name is now optional (it will list all profiles in resource group)
104+
* Resource group is now optional (it will list all profiles in subscription)
106105
* Azure Data Factory cmdlets
107106
* Upgraded management library to 1.0.0 with breaking JSON format change.
108107
* Updated list operation paging support in cmdlets.

setup/azurecmdfiles.wxi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,9 @@
15151515
<Component Id="cmp95CE3E0A8DCAF570E9BB97BACD5D3D37" Guid="*">
15161516
<File Id="fil6C841008462630CCAC59CB99E8D9FFB1" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Sql\Microsoft.Azure.Management.Sql.dll" />
15171517
</Component>
1518+
<Component Id="cmpA6382DD7FA07C06254423D6530966AA3" Guid="*">
1519+
<File Id="fil7310B877A7D30750513E4C104A721DD2" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Sql\Microsoft.Azure.Management.Storage.dll" />
1520+
</Component>
15181521
<Component Id="cmpEC1BF12EB3CCE29C1628238CC52B4380" Guid="*">
15191522
<File Id="fil6B289741EE9328CDED33E1F242EF95C6" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Sql\Microsoft.Azure.ResourceManager.dll" />
15201523
</Component>
@@ -4545,6 +4548,7 @@
45454548
<ComponentRef Id="cmpDA20E40FD1BE07A113851AFDBA89787D" />
45464549
<ComponentRef Id="cmp2C144B41FAE124CE1C9921E8B7DB9776" />
45474550
<ComponentRef Id="cmp95CE3E0A8DCAF570E9BB97BACD5D3D37" />
4551+
<ComponentRef Id="cmpA6382DD7FA07C06254423D6530966AA3" />
45484552
<ComponentRef Id="cmpEC1BF12EB3CCE29C1628238CC52B4380" />
45494553
<ComponentRef Id="cmp818CABBA9AFBAC0A3B15EBA346EF1EDD" />
45504554
<ComponentRef Id="cmpD1FFC10879A7E53D48A22EEACFB20B99" />

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
<Reference Include="Microsoft.Azure.Management.Sql">
7171
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.28.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
7272
</Reference>
73+
<Reference Include="Microsoft.Azure.Management.Storage">
74+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
75+
</Reference>
7376
<Reference Include="Microsoft.Azure.ResourceManager">
7477
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.1-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
7578
</Reference>
@@ -281,6 +284,7 @@
281284
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseUpdatePolicyWithStorage.json">
282285
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
283286
</None>
287+
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDatabaseUpdatePolicyWithStorageV2.json" />
284288
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestDisableDatabaseAuditing.json">
285289
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
286290
</None>

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/Common.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ function Create-TestEnvironmentWithParams ($params)
6363
New-AzureResourceGroup -Name $params.rgname -Location "West US" -TemplateFile ".\Templates\sql-audit-test-env-setup.json" -serverName $params.serverName -databaseName $params.databaseName -EnvLocation "West US" -Force
6464
}
6565

66+
<#
67+
.SYNOPSIS
68+
Creates the test environment needed to perform the Sql auditing tests, while using storage V2 as the used storage account
69+
#>
70+
function Create-TestEnvironmentWithStorageV2 ($testSuffix)
71+
{
72+
$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix
73+
New-AzureResourceGroup -Name $params.rgname -Location "West US" -TemplateFile ".\Templates\sql-audit-test-env-setup.json" -serverName $params.serverName -databaseName $params.databaseName -EnvLocation "West US" -Force
74+
New-AzureStorageAccount -Name $params.storageAccount -Location "West US" -ResourceGroupName $params.rgname -Type "Standard_GRS"
75+
}
76+
6677
<#
6778
.SYNOPSIS
6879
Creates the test environment needed to perform the Sql data masking tests

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,51 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.Azure.Test;
16+
using Microsoft.Azure.Test.HttpRecorder;
1517
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1618
using Xunit;
1719

1820
namespace Microsoft.Azure.Commands.ScenarioTest.SqlTests
1921
{
2022
public class SecurityTests : SqlTestsBase
2123
{
24+
protected Microsoft.Azure.Management.Storage.StorageManagementClient GetStorageV2Client()
25+
{
26+
var client = TestBase.GetServiceClient<Microsoft.Azure.Management.Storage.StorageManagementClient>(new CSMTestEnvironmentFactory());
27+
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
28+
{
29+
client.LongRunningOperationInitialTimeout = 0;
30+
client.LongRunningOperationRetryTimeout = 0;
31+
}
32+
return client;
33+
}
34+
35+
protected override void SetupManagementClients()
36+
{
37+
var sqlCSMClient = GetSqlClient(); // to interact with the security endpoints
38+
var storageClient = GetStorageClient();
39+
var storageV2Client = GetStorageV2Client();
40+
var resourcesClient = GetResourcesClient();
41+
var authorizationClient = GetAuthorizationManagementClient();
42+
helper.SetupSomeOfManagementClients(sqlCSMClient, storageClient, storageV2Client, resourcesClient, authorizationClient);
43+
}
44+
45+
2246
[Fact(Skip = "Skip for the version header upgrade on Storage library.")]
2347
[Trait(Category.AcceptanceType, Category.CheckIn)]
2448
public void TestDatabaseUpdatePolicyWithStorage()
2549
{
2650
RunPowerShellTest("Test-DatabaseUpdatePolicyWithStorage");
2751
}
2852

53+
[Fact(Skip = "Skip for the version header upgrade on Storage library.")]
54+
[Trait(Category.AcceptanceType, Category.CheckIn)]
55+
public void TestDatabaseUpdatePolicyWithStorageV2()
56+
{
57+
RunPowerShellTest("Test-DatabaseUpdatePolicyWithStorageV2");
58+
}
59+
2960
[Fact(Skip = "Skip for the version header upgrade on Storage library.")]
3061
[Trait(Category.RunType, Category.LiveOnly)]
3162
public void TestServerUpdatePolicyWithStorage()

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,36 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15+
16+
<#
17+
.SYNOPSIS
18+
Tests that when setting the storage account property's value in a database's auditing policy, that value is later fetched properly
19+
#>
20+
function Test-DatabaseUpdatePolicyWithStorageV2
21+
{
22+
# Setup
23+
$testSuffix = 102
24+
Create-TestEnvironmentWithStorageV2 $testSuffix
25+
$params = Get-SqlAuditingTestEnvironmentParameters $testSuffix
26+
27+
try
28+
{
29+
# Test
30+
Set-AzureSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -StorageAccountName $params.storageAccount
31+
$policy = Get-AzureSqlDatabaseAuditingPolicy -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName
32+
33+
# Assert
34+
Assert-AreEqual $policy.StorageAccountName $params.storageAccount
35+
Assert-AreEqual $policy.AuditState "Enabled"
36+
Assert-AreEqual $policy.UseServerDefault "Disabled"
37+
}
38+
finally
39+
{
40+
# Cleanup
41+
Remove-TestEnvironment $testSuffix
42+
}
43+
}
44+
1545
<#
1646
.SYNOPSIS
1747
Tests that when setting the storage account property's value in a database's auditing policy, that value is later fetched properly

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ namespace Microsoft.Azure.Commands.ScenarioTest.SqlTests
2626
{
2727
public class SqlTestsBase
2828
{
29-
private EnvironmentSetupHelper helper;
29+
protected EnvironmentSetupHelper helper;
3030

3131
protected SqlTestsBase()
3232
{
3333
helper = new EnvironmentSetupHelper();
3434
}
3535

36-
protected void SetupManagementClients()
36+
protected virtual void SetupManagementClients()
3737
{
3838
var sqlCSMClient = GetSqlClient(); // to interact with the security endpoints
3939
var storageClient = GetStorageClient();
@@ -95,7 +95,7 @@ protected ResourceManagementClient GetResourcesClient()
9595
return client;
9696
}
9797

98-
private AuthorizationManagementClient GetAuthorizationManagementClient()
98+
protected AuthorizationManagementClient GetAuthorizationManagementClient()
9999
{
100100
AuthorizationManagementClient client = TestBase.GetServiceClient<AuthorizationManagementClient>(new CSMTestEnvironmentFactory());
101101
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
@@ -104,7 +104,6 @@ private AuthorizationManagementClient GetAuthorizationManagementClient()
104104
client.LongRunningOperationRetryTimeout = 0;
105105
}
106106
return client;
107-
108107
}
109108
}
110109
}

0 commit comments

Comments
 (0)