Skip to content
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
11 changes: 10 additions & 1 deletion src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,24 @@ function Test-Disk
$mockkey = 'https://myvault.vault-int.azure-int.net/keys/mockkey/00000000000000000000000000000000';
$mocksecret = 'https://myvault.vault-int.azure-int.net/secrets/mocksecret/00000000000000000000000000000000';
$access = 'Read';
$mockGalleryImageId = '/subscriptions/' + $subId + '/resourceGroups/' + $rgname + '/providers/Microsoft.Compute/galleries/swaggergallery/images/swaggerimagedef/versions/1.0.0';

# Config create test
$diskconfig = New-AzDiskConfig -Location $loc -DiskSizeGB 500 -SkuName UltraSSD_LRS -OsType Windows -CreateOption Empty `
-DiskMBpsReadWrite 8 -DiskIOPSReadWrite 500 -EncryptionType "EncryptionAtRestWithCustomerKey" -DiskEncryptionSetId $encSetId;
-DiskMBpsReadWrite 8 -DiskIOPSReadWrite 500 -EncryptionType "EncryptionAtRestWithCustomerKey" -DiskEncryptionSetId $encSetId `
-DiskIOPSReadOnly 1000 -DiskMBpsReadOnly 10 -MaxSharesCount 5 `
-GalleryImageReference @{Id=$mockGalleryImageId;Lun=2};

Assert-AreEqual "UltraSSD_LRS" $diskconfig.Sku.Name;
Assert-AreEqual 500 $diskconfig.DiskIOPSReadWrite;
Assert-AreEqual 8 $diskconfig.DiskMBpsReadWrite;
Assert-AreEqual $encSetId $diskconfig.Encryption.DiskEncryptionSetId;
Assert-AreEqual "EncryptionAtRestWithCustomerKey" $diskconfig.Encryption.Type;
Assert-AreEqual 1000 $diskconfig.DiskIOPSReadOnly;
Assert-AreEqual 10 $diskconfig.DiskMBpsReadOnly;
Assert-AreEqual 5 $diskconfig.MaxShares;
Assert-AreEqual $mockGalleryImageId $diskconfig.CreationData.GalleryImageReference.Id;
Assert-AreEqual 2 $diskconfig.CreationData.GalleryImageReference.Lun;

$diskconfig = New-AzDiskConfig -Location $loc -Zone "1" -DiskSizeGB 5 -AccountType Standard_LRS -OsType Windows -CreateOption Empty `
-EncryptionSettingsEnabled $true -HyperVGeneration "V1";
Expand Down
6 changes: 4 additions & 2 deletions src/Compute/Compute.Test/ScenarioTests/GalleryTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ function Test-Gallery
Assert-AreEqual 2 $imageConfig.StorageProfile.DataDisks.Count;

$image = New-AzImage -Image $imageConfig -ImageName $imageName -ResourceGroupName $rgname
$targetRegions = @(@{Name='South Central US';ReplicaCount=1},@{Name='East US';ReplicaCount=2},@{Name='Central US'});
$targetRegions = @(@{Name='South Central US';ReplicaCount=1},@{Name='East US';ReplicaCount=2});
$tag = @{test1 = "testval1"; test2 = "testval2" };

New-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
Expand All @@ -347,9 +347,11 @@ function Test-Gallery
Verify-GalleryImageVersion $version $rgname $galleryImageVersionName $loc `
$image.Id 1 $endOfLifeDate $targetRegions;

$targetRegions = @(@{Name='South Central US';ReplicaCount=1},@{Name='East US';ReplicaCount=2},@{Name='Central US';StorageAccountType="Standard_ZRS"});

Update-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
-GalleryImageDefinitionName $galleryImageName -Name $galleryImageVersionName `
-Tag $tag;
-TargetRegion $targetRegions -Tag $tag;

$version = Get-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
-GalleryImageDefinitionName $galleryImageName -Name $galleryImageVersionName;
Expand Down

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
- Additional information about change #1
-->
## Upcoming Release
* Add the following parameters to New-AzDiskConfig cmdlet:
- DiskIOPSReadOnly, DiskMBpsReadOnly, MaxSharesCount, GalleryImageReference
* Allow Encryption property to Target parameter of New-AzGalleryImageVersion cmdlet.
* Fix tempDisk issue for Set-AzVmss -Reimage and Invoke-AzVMReimage cmdlets.
* Set-AzVMAEMExtension, Get-AzVMAEMExtension, Remove-AzVMAEMExtension, Update-AzVMAEMExtension: Add support for new SAP Extension
* Fix errors in examples of help document
* Show the exact string value for VM PowerState in the table format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,27 @@ public partial class NewAzureRmDiskConfigCommand : Microsoft.Azure.Commands.Reso
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public int DiskIOPSReadWrite { get; set; }
public long DiskIOPSReadWrite { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public int DiskMBpsReadWrite { get; set; }
public long DiskMBpsReadWrite { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public long DiskIOPSReadOnly { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public long DiskMBpsReadOnly { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public int MaxSharesCount { get; set; }

[Parameter(
Mandatory = false,
Expand All @@ -104,6 +119,11 @@ public partial class NewAzureRmDiskConfigCommand : Microsoft.Azure.Commands.Reso
ValueFromPipelineByPropertyName = true)]
public ImageDiskReference ImageReference { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public ImageDiskReference GalleryImageReference { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
Expand Down Expand Up @@ -203,6 +223,15 @@ private void Run()
vCreationData.ImageReference = this.ImageReference;
}

if (this.IsParameterBound(c => c.GalleryImageReference))
{
if (vCreationData == null)
{
vCreationData = new CreationData();
}
vCreationData.GalleryImageReference = this.GalleryImageReference;
}

if (this.IsParameterBound(c => c.SourceUri))
{
if (vCreationData == null)
Expand Down Expand Up @@ -303,8 +332,11 @@ private void Run()
OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null,
HyperVGeneration = this.IsParameterBound(c => c.HyperVGeneration) ? this.HyperVGeneration : null,
DiskSizeGB = this.IsParameterBound(c => c.DiskSizeGB) ? this.DiskSizeGB : (int?)null,
DiskIOPSReadWrite = this.IsParameterBound(c => c.DiskIOPSReadWrite) ? this.DiskIOPSReadWrite : (int?)null,
DiskMBpsReadWrite = this.IsParameterBound(c => c.DiskMBpsReadWrite) ? this.DiskMBpsReadWrite : (int?)null,
DiskIOPSReadWrite = this.IsParameterBound(c => c.DiskIOPSReadWrite) ? this.DiskIOPSReadWrite : (long?)null,
DiskMBpsReadWrite = this.IsParameterBound(c => c.DiskMBpsReadWrite) ? this.DiskMBpsReadWrite : (long?)null,
DiskIOPSReadOnly = this.IsParameterBound(c => c.DiskIOPSReadOnly) ? this.DiskIOPSReadOnly : (long?)null,
DiskMBpsReadOnly = this.IsParameterBound(c => c.DiskMBpsReadOnly) ? this.DiskMBpsReadOnly : (long?)null,
MaxShares = this.IsParameterBound(c => c.MaxSharesCount) ? this.MaxSharesCount : (int?)null,
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,
Sku = vSku,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public override void ExecuteCmdlet()
Position = 1,
Mandatory = true,
ValueFromPipelineByPropertyName = true)]
[ResourceNameCompleter("Microsoft.Compute/galleries", "ResourceGroupName")]
public string Name { get; set; }

[Parameter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ public override void ExecuteCmdlet()
{
string resourceGroupName;
string galleryName;
string galleryImageName;
string galleryImageDefinitionName;
switch (this.ParameterSetName)
{
case "ResourceIdParameter":
resourceGroupName = GetResourceGroupName(this.ResourceId);
galleryName = GetResourceName(this.ResourceId, "Microsoft.Compute/Galleries", "Images");
galleryImageName = GetInstanceId(this.ResourceId, "Microsoft.Compute/Galleries", "Images");
galleryName = GetResourceName(this.ResourceId, "Microsoft.Compute/galleries", "images");
galleryImageDefinitionName = GetInstanceId(this.ResourceId, "Microsoft.Compute/galleries", "images");
break;
case "ObjectParameter":
resourceGroupName = GetResourceGroupName(this.InputObject.Id);
galleryName = GetResourceName(this.InputObject.Id, "Microsoft.Compute/Galleries", "Images");
galleryImageName = GetInstanceId(this.InputObject.Id, "Microsoft.Compute/Galleries", "Images");
galleryName = GetResourceName(this.InputObject.Id, "Microsoft.Compute/galleries", "images");
galleryImageDefinitionName = GetInstanceId(this.InputObject.Id, "Microsoft.Compute/galleries", "images");
break;
default:
resourceGroupName = this.ResourceGroupName;
galleryName = this.GalleryName;
galleryImageName = this.Name;
galleryImageDefinitionName = this.Name;
break;
}

var result = GalleryImagesClient.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName).GetAwaiter().GetResult();
var result = GalleryImagesClient.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageDefinitionName).GetAwaiter().GetResult();
PSOperationStatusResponse output = new PSOperationStatusResponse
{
StartTime = this.StartTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ public override void ExecuteCmdlet()
galleryImageVersion.PublishingProfile.TargetRegions = new List<TargetRegion>();
foreach (var t in this.TargetRegion)
{
galleryImageVersion.PublishingProfile.TargetRegions.Add(new TargetRegion((string)t["Name"], (int?)t["ReplicaCount"], (string)t["StorageAccountType"]));
var target = new TargetRegion()
{
Name = (string)t["Name"],
RegionalReplicaCount = (int?)t["ReplicaCount"],
StorageAccountType = (string)t["StorageAccountType"],
Encryption = (t["Encryption"] == null) ? (EncryptionImages)t["Encryption"] : null
};

galleryImageVersion.PublishingProfile.TargetRegions.Add(target);
}
}

Expand Down Expand Up @@ -319,7 +327,15 @@ public override void ExecuteCmdlet()
galleryImageVersion.PublishingProfile.TargetRegions = new List<TargetRegion>();
foreach (var t in this.TargetRegion)
{
galleryImageVersion.PublishingProfile.TargetRegions.Add(new TargetRegion((string)t["Name"], (int?)t["ReplicaCount"]));
var target = new TargetRegion()
{
Name = (string)t["Name"],
RegionalReplicaCount = (int?)t["ReplicaCount"],
StorageAccountType = (string)t["StorageAccountType"],
Encryption = (t["Encryption"] == null) ? (EncryptionImages)t["Encryption"] : null
};

galleryImageVersion.PublishingProfile.TargetRegions.Add(target);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ public override void ExecuteCmdlet()
{
string resourceGroupName;
string galleryName;
string galleryImageName;
string galleryImageDefinitionName;
string galleryImageVersionName;
switch (this.ParameterSetName)
{
case "ResourceIdParameter":
resourceGroupName = GetResourceGroupName(this.ResourceId);
galleryName = GetResourceName(this.ResourceId, "Microsoft.Compute/Galleries", "Images", "Versions");
galleryImageName = GetInstanceId(this.ResourceId, "Microsoft.Compute/Galleries", "Images", "Versions");
galleryImageVersionName = GetVersion(this.ResourceId, "Microsoft.Compute/Galleries", "Images", "Versions");
galleryName = GetResourceName(this.ResourceId, "Microsoft.Compute/galleries", "images", "versions");
galleryImageDefinitionName = GetInstanceId(this.ResourceId, "Microsoft.Compute/galleries", "images", "versions");
galleryImageVersionName = GetVersion(this.ResourceId, "Microsoft.Compute/galleries", "images", "versions");
break;
case "ObjectParameter":
resourceGroupName = GetResourceGroupName(this.InputObject.Id);
galleryName = GetResourceName(this.InputObject.Id, "Microsoft.Compute/Galleries", "Images", "Versions");
galleryImageName = GetInstanceId(this.InputObject.Id, "Microsoft.Compute/Galleries", "Images", "Versions");
galleryImageVersionName = GetVersion(this.InputObject.Id, "Microsoft.Compute/Galleries", "Images", "Versions");
galleryName = GetResourceName(this.InputObject.Id, "Microsoft.Compute/galleries", "images", "versions");
galleryImageDefinitionName = GetInstanceId(this.InputObject.Id, "Microsoft.Compute/galleries", "images", "versions");
galleryImageVersionName = GetVersion(this.InputObject.Id, "Microsoft.Compute/galleries", "images", "versions");
break;
default:
resourceGroupName = this.ResourceGroupName;
galleryName = this.GalleryName;
galleryImageName = this.GalleryImageDefinitionName;
galleryImageDefinitionName = this.GalleryImageDefinitionName;
galleryImageVersionName = this.Name;
break;
}

var result = GalleryImageVersionsClient.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName).GetAwaiter().GetResult();
var result = GalleryImageVersionsClient.DeleteWithHttpMessagesAsync(resourceGroupName, galleryName, galleryImageDefinitionName, galleryImageVersionName).GetAwaiter().GetResult();
PSOperationStatusResponse output = new PSOperationStatusResponse
{
StartTime = this.StartTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ private static void Initialize()
cfg.CreateMap<FROM.Snapshot, TO.PSSnapshotList>();
cfg.CreateMap<TO.PSSnapshotList, TO.PSSnapshot>();
cfg.CreateMap<TO.PSSnapshot, TO.PSSnapshotList>();
cfg.CreateMap<FROM.VirtualMachineScaleSet, TO.PSVirtualMachineScaleSetList>()
.ForMember(c => c.Zones, o => o.Condition(r => (r.Zones != null)));
cfg.CreateMap<TO.PSVirtualMachineScaleSetList, TO.PSVirtualMachineScaleSet>()
.ForMember(c => c.Zones, o => o.Condition(r => (r.Zones != null)));
cfg.CreateMap<TO.PSVirtualMachineScaleSet, TO.PSVirtualMachineScaleSetList>()
.ForMember(c => c.Zones, o => o.Condition(r => (r.Zones != null)));
cfg.CreateMap<FROM.VirtualMachineScaleSet, TO.PSVirtualMachineScaleSetList>()
.ForMember(c => c.Zones, o => o.Condition(r => (r.Zones != null)));
cfg.CreateMap<TO.PSVirtualMachineScaleSetList, TO.PSVirtualMachineScaleSet>()
Expand Down Expand Up @@ -194,7 +188,6 @@ private static void Initialize()
.ForMember(c => c.Type, o => o.MapFrom(r => r.Type1));
cfg.CreateMap<TO.PSVirtualMachineScaleSetExtension, FROM.VirtualMachineScaleSetExtension>()
.ForMember(c => c.Type1, o => o.MapFrom(r => r.Type));

});
_mapper = config.CreateMapper();
}
Expand Down
9 changes: 7 additions & 2 deletions src/Compute/Compute/Generated/Models/PSDisk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public string ResourceGroupName
}

public string ManagedBy { get; set; }
public IList<string> ManagedByExtended { get; set; }
public DiskSku Sku { get; set; }
public System.Collections.Generic.IList<string> Zones { get; set; }
public IList<string> Zones { get; set; }
public DateTime? TimeCreated { get; set; }
public OperatingSystemTypes? OsType { get; set; }
public string HyperVGeneration { get; set; }
Expand All @@ -53,9 +54,13 @@ public string ResourceGroupName
public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; }
public string ProvisioningState { get; set; }
public long? DiskIOPSReadWrite { get; set; }
public int? DiskMBpsReadWrite { get; set; }
public long? DiskMBpsReadWrite { get; set; }
public long? DiskIOPSReadOnly { get; set; }
public long? DiskMBpsReadOnly { get; set; }
public string DiskState { get; set; }
public Encryption Encryption { get; set; }
public int? MaxShares { get; set; }
public IList<ShareInfoElement> ShareInfo { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string Type { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/Compute/Compute/Generated/Models/PSDiskUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public partial class PSDiskUpdate
public int? DiskSizeGB { get; set; }
public EncryptionSettingsCollection EncryptionSettingsCollection { get; set; }
public long? DiskIOPSReadWrite { get; set; }
public int? DiskMBpsReadWrite { get; set; }
public long? DiskMBpsReadWrite { get; set; }
public long? DiskIOPSReadOnly { get; set; }
public long? DiskMBpsReadOnly { get; set; }
public int? MaxShares { get; set; }
public Encryption Encryption { get; set; }
public IDictionary<string, string> Tags { get; set; }
public DiskSku Sku { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Compute/Compute/Generated/Models/PSHostGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public string ResourceGroupName

public int PlatformFaultDomainCount { get; set; }
public IList<SubResourceReadOnly> Hosts { get; set; }
public System.Collections.Generic.IList<string> Zones { get; set; }
public IList<string> Zones { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string Type { get; set; }
Expand Down
Loading