Skip to content

Rethrow exception in Set-AzureNetworkSecurityGroupToSubnet #28

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 5, 2014
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -78,9 +78,9 @@
<Reference Include="Microsoft.WindowsAzure.Common.NetFramework">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.1\lib\net45\Microsoft.WindowsAzure.Common.NetFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="Microsoft.WindowsAzure.Management, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify that this package is updated for all projects in AzurePowerShell solution

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other packages.config had been updated to 2.1.0 already and this one was missed.

image

<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.2.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.2.1.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Creates a Security Group.
#>
function New-NetworkSecurityGroup
{
param([string] $securityGroupName)
param([string] $securityGroupName, [string] $location = $location)

New-AzureNetworkSecurityGroup -Name $securityGroupName -Location $location -Label $NSGLabel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ public void TestRemoveNSGFromSubnet()
this.RunPowerShellTest("Test-RemoveNetworkSecurityGroupFromSubnet");
}

[Fact]
[Trait(Category.Service, Category.Network)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetNSGToSubnetInDiffRegion()
{
this.RunPowerShellTest("Test-SetNetworkSecurityGroupToSubnetInDifferentRegion");
}

#region Test setup
protected void SetupManagementClients()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ function Test-SetAndGetNetworkSecurityGroupForSubnet
Assert-AreEqual $securityGroupFromSubnet.Name $securityGroupName
}

<#
.SYNOPSIS
Tests Set and Get-AzureNetworkSecurityGroupForSubnet
#>
function Test-SetNetworkSecurityGroupToSubnetInDifferentRegion
{
# Setup
$securityGroupName = Get-SecurityGroupName
$securityRuleName = Get-SecurityRuleName
$securityGroupLocation = $locations[1].Name
$createdSecurityGroup = New-NetworkSecurityGroup $securityGroupName $securityGroupLocation
Set-AzureVNetConfig ($(Get-Location).Path + "\TestData\SimpleNetworkConfiguration.xml")

# Assert
$expectedMessage = "BadRequest : The region europewest specified for the Network Security Group $securityGroupName is different than the region europenorth that Virtual Network $VirtualNetworkName belongs to, they need to belong to the same region."
Assert-Throws { Set-AzureNetworkSecurityGroupToSubnet -Name $securityGroupName -VirtualNetwork $VirtualNetworkName -Subnet $SubnetName -Force } $expectedMessage
}

########################## Remove Network Security Group for Subnet Tests #############################

<#
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<DnsServers />
</Dns>
<VirtualNetworkSites>
<VirtualNetworkSite name="VirtualNetworkSiteName" Location="North Central US">
<VirtualNetworkSite name="VirtualNetworkSiteName" Location="North Europe">
<AddressSpace>
<AddressPrefix>192.168.100.0/24</AddressPrefix>
</AddressSpace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Common" version="1.4.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Common.Dependencies" version="1.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="2.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Libraries" version="2.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.MediaServices" version="2.0.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public override void ExecuteCmdlet()
}
});
}
else
{
throw;
}
}
}
}
Expand Down