Skip to content

[Compute] Add HyperVGeneration parameter to New-AzImageConfig #9493

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 1 commit into from
Jun 24, 2019
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
16 changes: 9 additions & 7 deletions src/Compute/Compute.Test/ScenarioTests/ImageTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function Test-Image
# Create Image using the VM's OS disk and data disks.
$imageName = 'image' + $rgname;
$tags = @{test1 = "testval1"; test2 = "testval2" };
$imageConfig = New-AzImageConfig -Location $loc -Tag $tags;
$imageConfig = New-AzImageConfig -Location $loc -Tag $tags -HyperVGeneration "V1";
Set-AzImageOsDisk -Image $imageConfig -OsType 'Windows' -OsState 'Generalized' -BlobUri $osDiskVhdUri;
$imageConfig = Add-AzImageDataDisk -Image $imageConfig -Lun 1 -BlobUri $dataDiskVhdUri1;
$imageConfig = Add-AzImageDataDisk -Image $imageConfig -Lun 2 -BlobUri $dataDiskVhdUri2;
Expand Down Expand Up @@ -164,21 +164,23 @@ function Test-Image
Assert-AreEqual $rgname $images[0].ResourceGroupName;
Assert-AreEqual $imageName $images[0].Name;

$images = Get-AzImage -ResourceGroupName $rgname -Name $imageName;
Assert-AreEqual $rgname $images.ResourceGroupName;
Assert-AreEqual $imageName $images.Name;
$image = Get-AzImage -ResourceGroupName $rgname -Name $imageName;
Assert-AreEqual $rgname $image.ResourceGroupName;
Assert-AreEqual $imageName $image.Name;
Assert-AreEqual "V1" $image.HyperVGeneration;

# Update Image Tag
$images[0] | Update-AzImage -Tag @{test1 = "testval3"; test2 = "testval4"};
$image | Update-AzImage -Tag @{test1 = "testval3"; test2 = "testval4"};
Update-AzImage -ResourceGroupName $rgname -ImageName $imageName -Tag @{test1 = "testval3"; test2 = "testval4"};
Update-AzImage -Image $images[0] -Tag @{test1 = "testval3"; test2 = "testval4"};
Update-AzImage -ResourceId $images[0].Id -Tag @{test1 = "testval3"; test2 = "testval4"};
Update-AzImage -Image $image -Tag @{test1 = "testval3"; test2 = "testval4"};
Update-AzImage -ResourceId $image.Id -Tag @{test1 = "testval3"; test2 = "testval4"};

$image = Get-AzImage -ResourceGroupName $rgname -ImageName $imageName;
Assert-True {$image.Tags.ContainsKey("test1") }
Assert-AreEqual "testval3" $image.Tags["test1"]
Assert-True {$image.Tags.ContainsKey("test2") }
Assert-AreEqual "testval4" $image.Tags["test2"]
Assert-AreEqual "V1" $image.HyperVGeneration;

$job = Remove-AzImage -ResourceGroupName $rgname -ImageName $imageName -Force -AsJob;
$result = $job | Wait-Job;
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Add HyperVGeneration parameter to New-AzImageConfig

## Version 2.3.0
* New-AzVm and New-AzVmss simple parameter sets now accept the `ProximityPlacementGroup` parameter.
Expand Down
7 changes: 4 additions & 3 deletions src/Compute/Compute/Generated/ComputeAutomationBaseCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
9 changes: 5 additions & 4 deletions src/Compute/Compute/Generated/Disk/DiskDeleteMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public override void ExecuteCmdlet()
string resourceGroupName = this.ResourceGroupName;
string diskName = this.DiskName;
var grantAccessData = new GrantAccessData();
grantAccessData.DurationInSeconds = this.DurationInSecond;
grantAccessData.Access = this.Access;
grantAccessData.DurationInSeconds = this.DurationInSecond;

var result = DisksClient.GrantAccess(resourceGroupName, diskName, grantAccessData);
var psObject = new PSAccessUri();
Expand Down
9 changes: 5 additions & 4 deletions src/Compute/Compute/Generated/Disk/DiskRevokeAccessMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
9 changes: 5 additions & 4 deletions src/Compute/Compute/Generated/Disk/DiskUpdateMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public partial class NewAzureRmImageConfigCommand : Microsoft.Azure.Commands.Res
ValueFromPipelineByPropertyName = true)]
public ImageOSDisk OsDisk { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
[PSArgumentCompleter("V1", "V2")]
public string HyperVGeneration { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
Expand Down Expand Up @@ -120,6 +126,7 @@ private void Run()

var vImage = new PSImage
{
HyperVGeneration = this.IsParameterBound(c => c.HyperVGeneration) ? this.HyperVGeneration : "V1",
Location = this.IsParameterBound(c => c.Location) ? this.Location : null,
Tags = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast<DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
SourceVirtualMachine = vSourceVirtualMachine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public override void ExecuteCmdlet()
string imageName = this.ImageName;
Image parameters = new Image();
ComputeAutomationAutoMapperProfile.Mapper.Map<PSImage, Image>(this.Image, parameters);
parameters.HyperVGeneration = HyperVGenerationTypes.V1; // temporarily unblock create image until this parameter is added.

var result = ImagesClient.CreateOrUpdate(resourceGroupName, imageName, parameters);
var psObject = new PSImage();
Expand Down
9 changes: 5 additions & 4 deletions src/Compute/Compute/Generated/Image/ImageDeleteMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public override void ExecuteCmdlet()
string resourceGroupName = this.ResourceGroupName;
string snapshotName = this.SnapshotName;
var grantAccessData = new GrantAccessData();
grantAccessData.DurationInSeconds = this.DurationInSecond;
grantAccessData.Access = this.Access;
grantAccessData.DurationInSeconds = this.DurationInSecond;

var result = SnapshotsClient.GrantAccess(resourceGroupName, snapshotName, grantAccessData);
var psObject = new PSAccessUri();
Expand Down
Loading