Skip to content

Commit 115f920

Browse files
authored
Merge pull request #9493 from hyonholee/june
[Compute] Add HyperVGeneration parameter to New-AzImageConfig
2 parents 146c409 + 50cdd06 commit 115f920

File tree

37 files changed

+1596
-1202
lines changed

37 files changed

+1596
-1202
lines changed

src/Compute/Compute.Test/ScenarioTests/ImageTests.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function Test-Image
9595
# Create Image using the VM's OS disk and data disks.
9696
$imageName = 'image' + $rgname;
9797
$tags = @{test1 = "testval1"; test2 = "testval2" };
98-
$imageConfig = New-AzImageConfig -Location $loc -Tag $tags;
98+
$imageConfig = New-AzImageConfig -Location $loc -Tag $tags -HyperVGeneration "V1";
9999
Set-AzImageOsDisk -Image $imageConfig -OsType 'Windows' -OsState 'Generalized' -BlobUri $osDiskVhdUri;
100100
$imageConfig = Add-AzImageDataDisk -Image $imageConfig -Lun 1 -BlobUri $dataDiskVhdUri1;
101101
$imageConfig = Add-AzImageDataDisk -Image $imageConfig -Lun 2 -BlobUri $dataDiskVhdUri2;
@@ -164,21 +164,23 @@ function Test-Image
164164
Assert-AreEqual $rgname $images[0].ResourceGroupName;
165165
Assert-AreEqual $imageName $images[0].Name;
166166

167-
$images = Get-AzImage -ResourceGroupName $rgname -Name $imageName;
168-
Assert-AreEqual $rgname $images.ResourceGroupName;
169-
Assert-AreEqual $imageName $images.Name;
167+
$image = Get-AzImage -ResourceGroupName $rgname -Name $imageName;
168+
Assert-AreEqual $rgname $image.ResourceGroupName;
169+
Assert-AreEqual $imageName $image.Name;
170+
Assert-AreEqual "V1" $image.HyperVGeneration;
170171

171172
# Update Image Tag
172-
$images[0] | Update-AzImage -Tag @{test1 = "testval3"; test2 = "testval4"};
173+
$image | Update-AzImage -Tag @{test1 = "testval3"; test2 = "testval4"};
173174
Update-AzImage -ResourceGroupName $rgname -ImageName $imageName -Tag @{test1 = "testval3"; test2 = "testval4"};
174-
Update-AzImage -Image $images[0] -Tag @{test1 = "testval3"; test2 = "testval4"};
175-
Update-AzImage -ResourceId $images[0].Id -Tag @{test1 = "testval3"; test2 = "testval4"};
175+
Update-AzImage -Image $image -Tag @{test1 = "testval3"; test2 = "testval4"};
176+
Update-AzImage -ResourceId $image.Id -Tag @{test1 = "testval3"; test2 = "testval4"};
176177

177178
$image = Get-AzImage -ResourceGroupName $rgname -ImageName $imageName;
178179
Assert-True {$image.Tags.ContainsKey("test1") }
179180
Assert-AreEqual "testval3" $image.Tags["test1"]
180181
Assert-True {$image.Tags.ContainsKey("test2") }
181182
Assert-AreEqual "testval4" $image.Tags["test2"]
183+
Assert-AreEqual "V1" $image.HyperVGeneration;
182184

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

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ImageTests/TestImage.json

Lines changed: 1420 additions & 1079 deletions
Large diffs are not rendered by default.

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Additional information about change #1
2020
-->
2121
## Upcoming Release
22+
* Add HyperVGeneration parameter to New-AzImageConfig
2223

2324
## Version 2.3.0
2425
* New-AzVm and New-AzVmss simple parameter sets now accept the `ProximityPlacementGroup` parameter.

src/Compute/Compute/Generated/ComputeAutomationBaseCmdlet.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Management.Compute;
24-
using Microsoft.Azure.Management.Compute.Models;
2522
using System;
2623
using System.Collections;
2724
using System.Collections.Generic;
2825
using System.Linq;
2926
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Management.Compute;
29+
using Microsoft.Azure.Management.Compute.Models;
30+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3031
using System.Reflection;
3132
using System.Text;
3233
using System.Text.RegularExpressions;

src/Compute/Compute/Generated/ContainerService/Config/RemoveAzureRmContainerServiceAgentPoolProfileCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Management.Compute.Models;
2422
using System;
2523
using System.Collections;
2624
using System.Collections.Generic;
2725
using System.Linq;
2826
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Management.Compute.Models;
29+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2930

3031
namespace Microsoft.Azure.Commands.Compute.Automation
3132
{

src/Compute/Compute/Generated/ContainerService/ContainerServiceCreateOrUpdateMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/ContainerService/ContainerServiceDeleteMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/ContainerService/ContainerServiceGetMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Disk/DiskCreateOrUpdateMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Disk/DiskDeleteMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Disk/DiskGrantAccessMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public override void ExecuteCmdlet()
4646
string resourceGroupName = this.ResourceGroupName;
4747
string diskName = this.DiskName;
4848
var grantAccessData = new GrantAccessData();
49-
grantAccessData.DurationInSeconds = this.DurationInSecond;
5049
grantAccessData.Access = this.Access;
50+
grantAccessData.DurationInSeconds = this.DurationInSecond;
5151

5252
var result = DisksClient.GrantAccess(resourceGroupName, diskName, grantAccessData);
5353
var psObject = new PSAccessUri();

src/Compute/Compute/Generated/Disk/DiskRevokeAccessMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Disk/DiskUpdateMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Image/Config/NewAzureRmImageConfigCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public partial class NewAzureRmImageConfigCommand : Microsoft.Azure.Commands.Res
6060
ValueFromPipelineByPropertyName = true)]
6161
public ImageOSDisk OsDisk { get; set; }
6262

63+
[Parameter(
64+
Mandatory = false,
65+
ValueFromPipelineByPropertyName = true)]
66+
[PSArgumentCompleter("V1", "V2")]
67+
public string HyperVGeneration { get; set; }
68+
6369
[Parameter(
6470
Mandatory = false,
6571
ValueFromPipelineByPropertyName = true)]
@@ -120,6 +126,7 @@ private void Run()
120126

121127
var vImage = new PSImage
122128
{
129+
HyperVGeneration = this.IsParameterBound(c => c.HyperVGeneration) ? this.HyperVGeneration : "V1",
123130
Location = this.IsParameterBound(c => c.Location) ? this.Location : null,
124131
Tags = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast<DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
125132
SourceVirtualMachine = vSourceVirtualMachine,

src/Compute/Compute/Generated/Image/Config/RemoveAzureRmImageDataDiskCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Management.Compute.Models;
2422
using System;
2523
using System.Collections;
2624
using System.Collections.Generic;
2725
using System.Linq;
2826
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Management.Compute.Models;
29+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2930

3031
namespace Microsoft.Azure.Commands.Compute.Automation
3132
{

src/Compute/Compute/Generated/Image/ImageCreateOrUpdateMethod.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public override void ExecuteCmdlet()
4747
string imageName = this.ImageName;
4848
Image parameters = new Image();
4949
ComputeAutomationAutoMapperProfile.Mapper.Map<PSImage, Image>(this.Image, parameters);
50-
parameters.HyperVGeneration = HyperVGenerationTypes.V1; // temporarily unblock create image until this parameter is added.
5150

5251
var result = ImagesClient.CreateOrUpdate(resourceGroupName, imageName, parameters);
5352
var psObject = new PSImage();

src/Compute/Compute/Generated/Image/ImageDeleteMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/ResourceSku/ResourceSkuListMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Snapshot/SnapshotCreateOrUpdateMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Snapshot/SnapshotDeleteMethod.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
// Changes to this file may cause incorrect behavior and will be lost if the
2020
// code is regenerated.
2121

22-
using Microsoft.Azure.Commands.Compute.Automation.Models;
23-
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
24-
using Microsoft.Azure.Management.Compute;
25-
using Microsoft.Azure.Management.Compute.Models;
2622
using System;
2723
using System.Collections;
2824
using System.Collections.Generic;
2925
using System.Linq;
3026
using System.Management.Automation;
27+
using Microsoft.Azure.Commands.Compute.Automation.Models;
28+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
29+
using Microsoft.Azure.Management.Compute;
30+
using Microsoft.Azure.Management.Compute.Models;
31+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3132

3233
namespace Microsoft.Azure.Commands.Compute.Automation
3334
{

src/Compute/Compute/Generated/Snapshot/SnapshotGrantAccessMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public override void ExecuteCmdlet()
4646
string resourceGroupName = this.ResourceGroupName;
4747
string snapshotName = this.SnapshotName;
4848
var grantAccessData = new GrantAccessData();
49-
grantAccessData.DurationInSeconds = this.DurationInSecond;
5049
grantAccessData.Access = this.Access;
50+
grantAccessData.DurationInSeconds = this.DurationInSecond;
5151

5252
var result = SnapshotsClient.GrantAccess(resourceGroupName, snapshotName, grantAccessData);
5353
var psObject = new PSAccessUri();

0 commit comments

Comments
 (0)