Skip to content
46 changes: 38 additions & 8 deletions src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,13 @@ function Test-SnapshotConfigDiskAccessNetworkPolicy
Testing the new parameters
Tier
LogicalSectorSize
in the New-AzDiskConfig cmdlet.
in the New-AzDiskConfig cmdlet.

Testing the new parameters
Tier
DiskIOPSReadOnly
DiskMBpsReadOnly
in the New-AzDiskUpdateCOnfig cmdlet.
#>
function Test-DiskConfigTierSectorSizeReadOnly
{
Expand All @@ -1189,26 +1195,50 @@ function Test-DiskConfigTierSectorSizeReadOnly
$diskNameTier = "datadisktier";
$diskNameSector = "datadisksector";
$tier3 = "P3";
$tier5 = "P5";
$tier40 = "P40";
$tier30 = "P30";
$sectorSize = 512;
$IoPS1 = 100;
$IoPS2 = 120;
$MbPS1 = 3;
$MbPS2 = 20;
$maxShares = 2;


$diskTier = New-AzDiskConfig -Location $loc -DiskSizeGB 5 `
-SkuName Premium_LRS -OsType Windows -CreateOption Empty -Tier $tier3 `
$diskTier = New-AzDiskConfig -Location $loc -DiskSizeGB 1024 `
-SkuName Premium_LRS -OsType Windows -CreateOption Empty -Tier $tier30 -MaxSharesCount $maxShares `
| New-AzDisk -ResourceGroupName $rgname -DiskName $diskNameTier;

Assert-AreEqual $diskTier.Tier $tier3;

Assert-AreEqual $tier30 $diskTier.Tier;
Assert-AreEqual $maxShares $diskTier.MaxShares;

$diskSector = New-AzDiskConfig -Location $loc -DiskSizeGB 5 `
-SkuName UltraSSD_LRS -OsType Windows -CreateOption Empty -LogicalSectorSize $sectorSize `
-SkuName UltraSSD_LRS -OsType Windows -CreateOption Empty -LogicalSectorSize $sectorSize -DiskIOPSReadOnly $IoPS1 -DiskMBpsReadOnly $MbPS1 `
| New-AzDisk -ResourceGroupName $rgname -DiskName $diskNameSector;

Assert-AreEqual $diskSector.CreationData.LogicalSectorSize $sectorSize;

# New-AzDiskUpdateConfig
# Tier
$diskUpdateTierConfig = New-AzDiskUpdateConfig -Tier $tier40;
$diskUp = Update-AzDisk -ResourceGroupName $rgname -DiskName $diskNameTier -DiskUpdate $diskUpdateTierConfig;

$diskUpdated = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskNameTier;

Assert-AreEqual $tier40 $diskUpdated.Tier;

# DiskIOPSReadOnly and DiskMBpsReadOnly
$diskUpdateReadOnlyConfig = New-AzDiskUpdateConfig -DiskIOPSReadOnly $IoPS2 -DiskMBpsReadOnly $MbPS2;
$diskUp = Update-AzDisk -ResourceGroupName $rgname -DiskName $diskNameSector -DiskUpdate $diskUpdateReadOnlyConfig;

$diskUpdated = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskNameSector;
Assert-AreEqual $IoPS2 $diskUpdated.DiskIOPSReadOnly;
Assert-AreEqual $MbPS2 $diskUpdated.DiskMBpsReadOnly;
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}

}
}

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 @@ -23,6 +23,7 @@
* Added `-VmssId` parameter to `New-AzVm`
* Added `PlatformFaultDomainCount` parameter to the `New-AzVmss` cmdlet.
* Added `Tier` and `LogicalSectorSize` optional parameters to the New-AzDiskConfig cmdlet.
* Added `Tier`, `DiskIOPSReadOnly`, and `DiskMBpsReadOnly` optional parameters to the `New-AzDiskUpdateConfig` cmdlet.

## Version 4.5.0
* Fixed issue in `Update-ASRRecoveryPlan` by populating FailoverTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,15 @@ private void Run()
vEncryption.Type = this.EncryptionType;
}

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

var vDisk = new PSDisk
{
Zones = this.IsParameterBound(c => c.Zone) ? this.Zone : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ public partial class NewAzureRmDiskUpdateConfigCommand : Microsoft.Azure.Command
[PSArgumentCompleter("Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS")]
public string SkuName { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
[PSArgumentCompleter("P1", "P2", "P3", "P4", "P5", "P6", "P10", "P15", "P20", "P30",
"P40", "P50", "P60", "P70", "P80")]
public string Tier { 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)]
Expand Down Expand Up @@ -213,12 +230,15 @@ private void Run()
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,
DiskIOPSReadOnly = this.IsParameterBound(c => c.DiskIOPSReadOnly) ? this.DiskIOPSReadOnly : null,
DiskMBpsReadOnly = this.IsParameterBound(c => c.DiskMBpsReadOnly) ? this.DiskMBpsReadOnly : null,
Tags = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast<DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
NetworkAccessPolicy = this.IsParameterBound(c => c.NetworkAccessPolicy) ? this.NetworkAccessPolicy: null,
DiskAccessId = this.IsParameterBound(c => c.DiskAccessId) ? this.DiskAccessId: null,
EncryptionSettingsCollection = vEncryptionSettingsCollection,
Encryption = vEncryption,
Sku = vSku,
Tier = this.IsParameterBound(c => c.Tier) ? this.Tier : null,
};

WriteObject(vDiskUpdate);
Expand Down
2 changes: 2 additions & 0 deletions src/Compute/Compute/Generated/Models/PSDiskUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ public partial class PSDiskUpdate
public string NetworkAccessPolicy { get; set; }
public string DiskAccessId { get; set; }

public string Tier { get; set; }

}
}
48 changes: 47 additions & 1 deletion src/Compute/Compute/help/New-AzDiskUpdateConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Creates a configurable disk update object.
## SYNTAX

```
New-AzDiskUpdateConfig [[-SkuName] <String>] [-NetworkAccessPolicy <String>] [-DiskAccessId <String>]
New-AzDiskUpdateConfig [[-SkuName] <String>] [-Tier <String>] [-DiskIOPSReadOnly <Int64>]
[-DiskMBpsReadOnly <Int64>] [-NetworkAccessPolicy <String>] [-DiskAccessId <String>]
[[-OsType] <OperatingSystemTypes>] [[-DiskSizeGB] <Int32>] [[-Tag] <Hashtable>] [-DiskIOPSReadWrite <Int32>]
[-DiskMBpsReadWrite <Int32>] [-EncryptionSettingsEnabled <Boolean>]
[-DiskEncryptionKey <KeyVaultAndSecretReference>] [-KeyEncryptionKey <KeyVaultAndKeyReference>]
Expand Down Expand Up @@ -113,6 +114,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -DiskIOPSReadOnly
The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.

```yaml
Type: System.Nullable`1[System.Int64]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -DiskIOPSReadWrite
The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.

Expand All @@ -128,6 +144,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -DiskMBpsReadOnly
The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.

```yaml
Type: System.Nullable`1[System.Int64]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -DiskMBpsReadWrite
The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.

Expand Down Expand Up @@ -265,6 +296,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Tier
Performance tier of the disk.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

Expand Down