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
7 changes: 7 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DiskRPTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,12 @@ public void TestDiskCreateImportSecure()
TestRunner.RunTestScript("Test-ConfVMImportSecure");
}

[Fact]
[Trait(Category.AcceptanceType, Category.LiveOnly)]
public void TestDiskSnapshotInstantAccess()
{
TestRunner.RunTestScript("Test-DiskSnapshotInstantAccess");
}

}
}
46 changes: 46 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1905,3 +1905,49 @@ function Test-ConfVMImportSecure
Clean-ResourceGroup $rgname;
}
}


<#
.SYNOPSIS
Test confidential vm securityMetadataUri during confidential VM OS disk creation from an unmanaged storage account.
#>
function Test-DiskSnapshotInstantAccess
{
# Setup
$rgname = Get-ComputeTestResourceName;
$location = "eastus2euap";

try
{
$diskName = "haagha-premiumv2test"
$snapshotName = "snapshotTest"

New-AzResourceGroup -Name $rgname -Location $location -Force;

$diskConfig = New-AzDiskConfig `
-Location $location `
-DiskSizeGB 1024 `
-DiskIOPSReadWrite 10000 `
-DiskMBpsReadWrite 500 `
-AccountType PremiumV2_LRS `
-CreateOption Empty `
-Zone $zone

New-AzDisk -ResourceGroupName $rgname -DiskName $diskName -Disk $diskConfig

$disk = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskName
$snapshotConfig = New-AzSnapshotConfig -SourceUri $disk.Id -Location $location -CreateOption Copy -InstantAccessDurationMinutes 300 -Incremental Premium_LRS

New-AzSnapshot -Snapshot $snapshotConfig -SnapshotName $snapshotName -ResourceGroupName $rgname

$snapshotGet = Get-AzSnapshot -ResourceGroupName $rgname -SnapshotName $snapshotName

Asset-NotNull = $snapshotGet.CreationData.InstantAccessDurationMinutes
Asset-NotNull = $snapshotGet.SnapshotAccessState
}
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 @@ -20,6 +20,7 @@

-->
## Upcoming Release
* Added `-InstantAccessDurationMinutes` parameter to New-AzSnapshotConfig.
* Added `SecureVMGuestStateSAS` parameter to `Grant-AzSnapshotAccess`.

## Version 10.3.0
Expand Down
8 changes: 8 additions & 0 deletions src/Compute/Compute/Generated/Models/PSSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,13 @@ public string ResourceGroupName
// via the CopyStart operation.
public double? CompletionPercent { get; set; }
public string DataAccessAuthMode { get; set; }

/// <summary>
/// Gets the state of snapshot which determines the access availability
/// of the snapshot. Possible values include: 'Unknown', 'Pending',
/// 'Available', 'InstantAccess', 'AvailableWithInstantAccess'
/// </summary>
public string SnapshotAccessState { get; private set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ public partial class NewAzureRmSnapshotConfigCommand : Microsoft.Azure.Commands.
[PSArgumentCompleter("Enhanced", "None")]
public string TierOption { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained for instant access to enable faster restore.")]
public int InstantAccessDurationMinutes { get; set; }

protected override void ProcessRecord()
{
if (ShouldProcess("Snapshot", "New"))
Expand Down Expand Up @@ -299,6 +305,15 @@ private void Run()
vCreationData.ProvisionedBandwidthCopySpeed = this.TierOption;
}

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

if (this.IsParameterBound(c => c.EncryptionSettingsEnabled))
{
if (vEncryptionSettingsCollection == null)
Expand Down
19 changes: 17 additions & 2 deletions src/Compute/Compute/help/New-AzSnapshotConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ New-AzSnapshotConfig [[-SkuName] <String>] [[-OsType] <OperatingSystemTypes>] [[
[-DiskEncryptionSetId <String>] [-EncryptionType <String>] [-DiskAccessId <String>]
[-NetworkAccessPolicy <String>] [-PublicNetworkAccess <String>] [-AcceleratedNetwork <Boolean>]
[-DataAccessAuthMode <String>] [-Architecture <String>] [-ElasticSanResourceId <String>]
[-TierOption <String>] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
[-TierOption <String>] [-InstantAccessDurationMinutes <Int32>] [-DefaultProfile <IAzureContextContainer>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

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

### -InstantAccessDurationMinutes
For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained for instant access to enable faster restore.

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

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

### -KeyEncryptionKey
Specifies the Key encryption key on a snapshot.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,5 @@
"Az.Compute","Microsoft.Azure.Commands.Compute.Automation.NewAzureRmGalleryInVMAccessControlProfileVersionConfig","New-AzGalleryInVMAccessControlProfileVersionConfig","1","8100","New-AzGalleryInVMAccessControlProfileVersionConfig Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
"Az.Compute","Microsoft.Azure.Commands.Compute.SetAzureVMProxySetting","Set-AzVMProxyAgentSetting","1","8100","Set-AzVMProxyAgentSetting Does not support ShouldProcess but the cmdlet verb Set indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
"Az.Compute","Microsoft.Azure.Commands.Compute.SetAzureVmssProxySetting","Set-AzVmssProxyAgentSetting","1","8100","Set-AzVmssProxyAgentSetting Does not support ShouldProcess but the cmdlet verb Set indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
"Az.Compute","Microsoft.Azure.Commands.Compute.Automation.NewAzureRmSnapshotConfigCommand","New-AzSnapshotConfig","1","8410","Parameter InstantAccessDurationMinutes of cmdlet New-AzSnapshotConfig does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name."