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 @@ -192,5 +192,12 @@ public void TestSnapshotConfigTierOptionEnhancedSpeed()
TestRunner.RunTestScript("Test-SnapshotConfigTierOptionEnhancedSpeed");
}

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

}
}
38 changes: 38 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1825,4 +1825,42 @@ function Test-SnapshotConfigTierOptionEnhancedSpeed
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Using a TL disk, use the SecureVmGuestStateSas parameter to get the securityDataAccessSAS value.
#>
function Test-DiskGrantAccessGetSASWithTL
{
$rgname = Get-ComputeTestResourceName;
$loc = Get-ComputeVMLocation;

try
{
New-AzResourceGroup -Name $rgname -Location $loc -Force;

$diskname = "d" + $rgname;

$image = Get-AzVMImage -Skus 2022-datacenter-azure-edition -Offer WindowsServer -PublisherName MicrosoftWindowsServer -Location $loc -Version latest;
$diskconfig = New-AzDiskConfig -DiskSizeGB 127 -AccountType Premium_LRS -OsType Windows -CreateOption FromImage -Location $loc;

$diskconfig = Set-AzDiskImageReference -Disk $diskconfig -Id $image.Id;

$disk = New-AzDisk -ResourceGroupName $rgname -DiskName $diskname -Disk $diskconfig;

$grantAccess = Grant-AzDiskAccess -ResourceGroupName $rgname -DiskName $diskname -Access 'Read' -DurationInSecond 60 -SecureVMGuestStateSAS;
Assert-NotNull $grantAccess.securityDataAccessSAS;
Assert-NotNull $grantAccess.AccessSAS;

$grantAccess = Grant-AzDiskAccess -ResourceGroupName $rgname -DiskName $diskname -Access 'Read' -DurationInSecond 60;
Assert-NotNull $grantAccess.AccessSAS;
Assert-Null $grantAccess.securityDataAccessSAS;

}
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 @@ -22,6 +22,7 @@
## Upcoming Release
* Added cmdlet `Invoke-AzSpotPlacementRecommender`.
* Fixed `Update-AzCapacityReservationGroup` to remove Subscriptions from SharingProfile.
* Added new optional parameter `SecureVMGuestStateSAS` to cmdlet `Grant-AzDiskAccess`.

## Version 7.2.0
* Added parameters `-scriptUriManagedIdentity`, `-outputBlobManagedIdentity`, `-errorBlobMangedIdentity`, and `-TreatFailureAsDeploymentFailure` to cmdlets `Set-AzVmRunCommand` and `Set-AzVmssRunCommand`.
Expand Down
8 changes: 8 additions & 0 deletions src/Compute/Compute/Generated/Disk/DiskGrantAccessMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public override void ExecuteCmdlet()
var grantAccessData = new GrantAccessData();
grantAccessData.Access = this.Access;
grantAccessData.DurationInSeconds = this.DurationInSecond;
grantAccessData.GetSecureVMGuestStateSAS = this.SecureVMGuestStateSAS;

var result = DisksClient.GrantAccess(resourceGroupName, diskName, grantAccessData);
var psObject = new PSAccessUri();
Expand Down Expand Up @@ -88,5 +89,12 @@ public override void ExecuteCmdlet()

[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

[Parameter(
ParameterSetName = "DefaultParameter",
HelpMessage = "Set this flag to true to get additional SAS for VM guest state.",
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
public SwitchParameter SecureVMGuestStateSAS { get; set; }
}
}
2 changes: 2 additions & 0 deletions src/Compute/Compute/Generated/Models/PSAccessUri.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ public partial class PSAccessUri
{
public string AccessSAS { get; set; }

public string SecurityDataAccessSAS { get; set; }

}
}
17 changes: 16 additions & 1 deletion src/Compute/Compute/help/Grant-AzDiskAccess.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Grants an access to a disk.

```
Grant-AzDiskAccess [-ResourceGroupName] <String> [-DiskName] <String> [-Access] <String>
[[-DurationInSecond] <Int32>] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[[-DurationInSecond] <Int32>] [-AsJob] [-SecureVMGuestStateSAS] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

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

### -SecureVMGuestStateSAS
Set this flag to true to get additional SAS for VM guest state.

```yaml
Type: System.Management.Automation.SwitchParameter
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