Skip to content
Closed
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
33 changes: 33 additions & 0 deletions src/Accounts/Authentication/Authentication - Backup.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PsModuleName>Accounts</PsModuleName>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\Az.props" />

<PropertyGroup>
<AssemblyName>Microsoft.Azure.PowerShell.Authentication</AssemblyName>
<RootNamespace>$(LegacyAssemblyPrefix)Common.Authentication</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.4.0-beta.1" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public VirtualNetworkGatewayTests(Xunit.Abstractions.ITestOutputHelper output)
{
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.brooklynft_subset2)]
public void TestVirtualNetworkLocalGatewayCRUD()
{
TestRunner.RunTestScript("Test-VirtualNetworkLocalGatewayCRUD");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,65 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Virtual network type local gateway tests
#>
function Test-VirtualNetworkLocalGatewayCRUD
{
# Setup
$rgname = Get-ResourceGroupName
$rname = Get-ResourceName
$vnetName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement "West Central US"
$resourceTypeParent = "Microsoft.Network/virtualNetworkGateways"
$location = Get-ProviderLocation $resourceTypeParent "West Central US"
$extendedLocationType = "EdgeZone"
$extendedLocationName = Get-ResourceName

try
{
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }

# Create the Virtual Network
$subnet = New-AzVirtualNetworkSubnetConfig -Name "GatewaySubnet" -AddressPrefix 10.0.0.0/24
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname

$actual = New-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $location -GatewayType LocalGateway -VirtualNetworkResourceId $vnet.Id -ExtendedLocationType $extendedLocationType -ExtendedLocationName $extendedLocationName -Force
$expected = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual $expected.Name $actual.Name
Assert-AreEqual "LocalGateway" $expected.GatewayType
Assert-AreEqual "EdgeZone" $expected.ExtendedLocationType
Assert-AreEqual $extendedLocationName $expected.ExtendedLocationName

# List virtualNetworkGateways
$list = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname
Assert-AreEqual 1 @($list).Count
Assert-AreEqual $list[0].ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual $list[0].Name $actual.Name
Assert-AreEqual $list[0].Location $actual.Location

$list = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname -Name "*"
Assert-True { $list.Count -ge 0 }

# Delete virtualNetworkGateway
$delete = Remove-AzVirtualNetworkGateway -ResourceGroupName $actual.ResourceGroupName -name $rname -PassThru -Force
Assert-AreEqual true $delete

$list = Get-AzVirtualNetworkGateway -ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual 0 @($list).Count

}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Virtual network express route gateway tests
Expand Down
3 changes: 3 additions & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
--->

## Upcoming Release
* Added warning messages for upcoming breaking change for Virtual Router Peer Routes
- `Get-AzVirtualRouterPeerLearnedRoute`
- `Get-AzVirtualRouterPeerAdvertisedRoute`
* Added new cmdlet for virtual router
- `Update-AzVirtualRouter`: to allow branch to branch traffic
* [Breaking Change] Removed parameter `HostedSubnet` and add `Subnet` instead
Expand Down
12 changes: 12 additions & 0 deletions src/Network/Network/Models/PSExtendedLocation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Azure.Commands.Network.Models
{
public class PSExtendedLocation
{
public string Name { get; set; }
public string Type { get; set; }
}
}
4 changes: 4 additions & 0 deletions src/Network/Network/Models/PSVirtualNetworkGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public class PSVirtualNetworkGateway : PSTopLevelResource

public string VpnGatewayGeneration { get; set; }

public string VirtualNetworkExtendedLocationResourceId { get; set; }

public PSExtendedLocation ExtendedLocation { get; set; }

[JsonIgnore]
public string IpConfigurationsText
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.AadAuthenticationConfiguration,
HelpMessage = "The resource name.")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration,
HelpMessage = "The resource name.")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
Expand All @@ -71,6 +76,11 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.AadAuthenticationConfiguration,
HelpMessage = "The resource group name.")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration,
HelpMessage = "The resource group name.")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
Expand All @@ -95,6 +105,11 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.AadAuthenticationConfiguration,
HelpMessage = "location.")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration,
HelpMessage = "location.")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
Expand All @@ -114,10 +129,16 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The type of this virtual network gateway: Vpn, ExoressRoute")]
HelpMessage = "The type of this virtual network gateway: Vpn, ExpressRoute, LocalGateway")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration,
HelpMessage = "The type of this virtual network gateway: Vpn, ExpressRoute, LocalGateway")]
[ValidateSet(
MNM.VirtualNetworkGatewayType.Vpn,
MNM.VirtualNetworkGatewayType.ExpressRoute,
MNM.VirtualNetworkGatewayType.LocalGateway,
IgnoreCase = true)]
public string GatewayType { get; set; }

Expand Down Expand Up @@ -307,6 +328,31 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
MNM.VpnGatewayGeneration.Generation2)]
public string VpnGatewayGeneration { get; set; }

[Alias("VirtualNetworkResourceId")]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration,
HelpMessage = "MAS FIJI customer vnet resource id.VirtualNetworkGateway of type local gateway is associated with the customer vnet.")]
public string virtualNetworkExtendedLocationResourceId { get; set; }

[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration,
HelpMessage = "The type of extended location")]
[ValidateSet(
MNM.ExtendedLocationType.EgdeZone,
IgnoreCase = true)]
public string ExtendedLocationType { get; set; }

[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration,
HelpMessage = "The name of extended location")]
public string ExtendedLocationName { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

Expand Down Expand Up @@ -339,20 +385,67 @@ public override void Execute()
Name,
() =>
{
var virtualNetworkGateway = CreateVirtualNetworkGateway();
WriteObject(virtualNetworkGateway);
var vnetGateway = new PSVirtualNetworkGateway();
vnetGateway.Name = this.Name;
vnetGateway.ResourceGroupName = this.ResourceGroupName;
vnetGateway.Location = this.Location;

if (this.ParameterSetName.Equals(VirtualNetworkGatewayParameterSets.TypeLocalGatewayConfiguration))
{
if (!this.GatewayType.Equals(MNM.VirtualNetworkGatewayType.LocalGateway))
{
throw new ArgumentException("ExtendedLocation and VirtualNetworkResourceId are required only if Virtual Network Gateway Type is " + MNM.VirtualNetworkGatewayType.LocalGateway);
}
else if (this.VpnGatewayGeneration != null || this.CustomRoute != null ||
this.IpConfigurationBgpPeeringAddresses != null || this.PeerWeight > 0 ||
this.Asn > 0 || this.VpnClientIpsecPolicy != null ||
this.VpnClientRevokedCertificates != null || this.VpnClientRootCertificates != null ||
this.VpnClientProtocol != null || this.VpnClientAddressPool != null ||
this.GatewayDefaultSite != null || this.GatewaySku != null ||
this.EnablePrivateIpAddress != null || this.EnableActiveActiveFeature != null ||
this.EnableBgp == true || this.VpnType != null ||
this.IpConfigurations != null)
{
throw new ArgumentException("Only parameters ExtendedLocation and VirtualNetworkResourceId are allowed for type " + MNM.VirtualNetworkGatewayType.LocalGateway);
}
else
{
vnetGateway.ExtendedLocation = new PSExtendedLocation();
vnetGateway.ExtendedLocation.Name = this.ExtendedLocationName;
vnetGateway.ExtendedLocation.Type = this.ExtendedLocationType;
vnetGateway.VirtualNetworkExtendedLocationResourceId = this.virtualNetworkExtendedLocationResourceId;
}
}
else
{
if (this.GatewayType.Equals(MNM.VirtualNetworkGatewayType.LocalGateway))
{
throw new ArgumentException("ExtendedLocation and VirtualNetworkResourceId are required when Virtual Network Gateway Type is " + MNM.VirtualNetworkGatewayType.LocalGateway);
}
else
{
CreateVirtualNetworkGateway(vnetGateway);
}
}

// Map to the sdk object
var vnetGatewayModel = NetworkResourceManagerProfile.Mapper.Map<MNM.VirtualNetworkGateway>(vnetGateway);

vnetGatewayModel.Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true);

// Execute the Create VirtualNetwork call
this.VirtualNetworkGatewayClient.CreateOrUpdate(this.ResourceGroupName, this.Name, vnetGatewayModel);

var getVirtualNetworkGateway = this.GetVirtualNetworkGateway(this.ResourceGroupName, this.Name);

WriteObject(getVirtualNetworkGateway);
},
() => present);
() => present);

}

private PSVirtualNetworkGateway CreateVirtualNetworkGateway()
{
var vnetGateway = new PSVirtualNetworkGateway();
vnetGateway.Name = this.Name;
vnetGateway.ResourceGroupName = this.ResourceGroupName;
vnetGateway.Location = this.Location;

private void CreateVirtualNetworkGateway(PSVirtualNetworkGateway vnetGateway)
{
if (this.GatewaySku != null)
{
vnetGateway.Sku = new PSVirtualNetworkGatewaySku();
Expand Down Expand Up @@ -546,17 +639,6 @@ private PSVirtualNetworkGateway CreateVirtualNetworkGateway()

vnetGateway.VpnGatewayGeneration = this.VpnGatewayGeneration;
}

// Map to the sdk object
var vnetGatewayModel = NetworkResourceManagerProfile.Mapper.Map<MNM.VirtualNetworkGateway>(vnetGateway);
vnetGatewayModel.Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true);

// Execute the Create VirtualNetwork call
this.VirtualNetworkGatewayClient.CreateOrUpdate(this.ResourceGroupName, this.Name, vnetGatewayModel);

var getVirtualNetworkGateway = this.GetVirtualNetworkGateway(this.ResourceGroupName, this.Name);

return getVirtualNetworkGateway;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ public class VirtualNetworkGatewayParameterSets
public const string AadAuthenticationConfiguration = @"AadAuthenticationConfiguration";

public const string UpdateResourceWithTags = @"UpdateResourceWithTags";

public const string TypeLocalGatewayConfiguration = @"TypeLocalGatewayConfiguration";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ private IAzureRestClient ServiceClient

public override void Execute()
{
WriteWarningWithTimestamp("Upcoming breaking changes in the cmdlet 'Get-AzVirtualRouterAdvertisedRoutes': "
+ "The output type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouterLearnedRoutes' is changing. "
+ "Note: Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.");

base.Execute();

context = DefaultContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ private IAzureRestClient ServiceClient

public override void Execute()
{
WriteWarningWithTimestamp("Upcoming breaking changes in the cmdlet 'Get-AzVirtualRouterLearnedRoutes': "
+ "The output type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouterLearnedRoutes' is changing. "
+ "Note: Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.");

base.Execute();

context = DefaultContext;
Expand Down
Binary file not shown.
Binary file not shown.