Skip to content

Commit bfe3899

Browse files
audreytttCopilot
andauthored
Adding SupportedSecurityOption for Trusted Launch as Default (#28677)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0466ffe commit bfe3899

File tree

7 files changed

+1196
-2
lines changed

7 files changed

+1196
-2
lines changed

src/Compute/Compute.Test/ScenarioTests/DiskRPTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,5 +213,11 @@ public void TestDiskSnapshotInstantAccess()
213213
TestRunner.RunTestScript("Test-DiskSnapshotInstantAccess");
214214
}
215215

216+
[Fact]
217+
[Trait(Category.AcceptanceType, Category.LiveOnly)]
218+
public void TestDiskSupportedSecurityOption()
219+
{
220+
TestRunner.RunTestScript("Test-SupportedSecurityOption");
221+
}
216222
}
217223
}

src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,3 +1951,35 @@ function Test-DiskSnapshotInstantAccess
19511951
Clean-ResourceGroup $rgname;
19521952
}
19531953
}
1954+
1955+
<#
1956+
.SYNOPSIS
1957+
Test SupportedSecurityOption Parameter during creation and update of disk
1958+
#>
1959+
function Test-SupportedSecurityOption
1960+
{
1961+
$rgname = Get-ComputeTestResourceName;
1962+
$loc = "eastus2euap";
1963+
1964+
try{
1965+
New-AzResourceGroup -Name $rgname -Location $loc -Force;
1966+
1967+
$diskConfig = New-AzDiskConfig -Location $loc -SkuName 'PremiumV2_LRS' -DiskSizeGB 2 -CreateOption Empty -SupportedSecurityOption 'TrustedLaunchSupported';
1968+
$diskname = "disk" + $rgname;
1969+
New-AzDisk -ResourceGroupName $rgname -DiskName $diskname -Disk $diskConfig;
1970+
$disk = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskname;
1971+
1972+
Assert-NotNull $disk.SupportedCapabilities;
1973+
Assert-AreEqual "TrustedLaunchSupported" $disk.SupportedCapabilities.SupportedSecurityOption;
1974+
1975+
$updateconfig = New-AzDiskUpdateConfig -SupportedSecurityOption "TrustedLaunchAndConfidentialVMSupported";
1976+
$disk = Update-AzDisk -ResourceGroupName $rgname -DiskName $diskname -DiskUpdate $updateconfig;
1977+
Assert-AreEqual "TrustedLaunchAndConfidentialVMSupported" $disk.SupportedCapabilities.SupportedSecurityOption;
1978+
}
1979+
1980+
finally
1981+
{
1982+
# Cleanup
1983+
Clean-ResourceGroup $rgname
1984+
}
1985+
}

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DiskRPTests/TestDiskSupportedSecurityOption.json

Lines changed: 1098 additions & 0 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
@@ -21,6 +21,7 @@
2121
-->
2222
## Upcoming Release
2323
* Added `-Redeploy` switch parameter for `Update-AzHost` cmdlet to enable dedicated host redeployment.
24+
* Added `-SupportedSecurityOption` parameter to `New-AzDiskConfig` cmdlet.
2425
* ComputeRP related cmdlets will now use 2025-04-01 version of the ComputeRP API.
2526
* Added `-AddProxyAgentExtension` parameter (Switch) to `New-AzVmss` and `New-AzVM`
2627
* Added `-AddProxyAgentExtension` parameter (Bool) to `Set-AzVMProxyAgentSetting` and `Set-AzVmssProxyAgentSetting`

src/Compute/Compute/Generated/Disk/Config/NewAzureRmDiskConfigCommand.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
2929
using Microsoft.Azure.Management.Compute.Models;
3030
using Microsoft.WindowsAzure.Commands.Utilities.Common;
31-
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
3231

3332
namespace Microsoft.Azure.Commands.Compute.Automation
3433
{
@@ -266,6 +265,13 @@ public partial class NewAzureRmDiskConfigCommand : Microsoft.Azure.Commands.Reso
266265
HelpMessage = "If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state.")]
267266
public string SecurityDataUri { get; set; }
268267

268+
[Parameter(
269+
Mandatory = false,
270+
ValueFromPipelineByPropertyName = true,
271+
HelpMessage = "Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM.")]
272+
[PSArgumentCompleter("TrustedLaunchSupported", "TrustedLaunchAndConfidentialVMSupported")]
273+
public string SupportedSecurityOption { get; set; }
274+
269275
protected override void ProcessRecord()
270276
{
271277
if (ShouldProcess("Disk", "New"))
@@ -492,6 +498,15 @@ private void Run()
492498
vSupportedCapabilities.Architecture = this.Architecture;
493499
}
494500

501+
if (this.IsParameterBound(c => c.SupportedSecurityOption))
502+
{
503+
if (vSupportedCapabilities == null)
504+
{
505+
vSupportedCapabilities = new SupportedCapabilities();
506+
}
507+
vSupportedCapabilities.SupportedSecurityOption = this.SupportedSecurityOption;
508+
}
509+
495510
var vDisk = new PSDisk
496511
{
497512
Zones = this.IsParameterBound(c => c.Zone) ? this.Zone : null,

src/Compute/Compute/Generated/Disk/Config/NewAzureRmDiskUpdateConfigCommand.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ public partial class NewAzureRmDiskUpdateConfigCommand : Microsoft.Azure.Command
179179
[PSArgumentCompleter("X64", "Arm64")]
180180
public string Architecture { get; set; }
181181

182+
[Parameter(
183+
Mandatory = false,
184+
ValueFromPipelineByPropertyName = true,
185+
HelpMessage = "Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM.")]
186+
[PSArgumentCompleter("TrustedLaunchSupported", "TrustedLaunchAndConfidentialVMSupported")]
187+
public string SupportedSecurityOption { get; set; }
182188

183189
protected override void ProcessRecord()
184190
{
@@ -301,6 +307,15 @@ private void Run()
301307
vSupportedCapabilities.Architecture = this.Architecture;
302308
}
303309

310+
if (this.IsParameterBound(c => c.SupportedSecurityOption))
311+
{
312+
if (vSupportedCapabilities == null)
313+
{
314+
vSupportedCapabilities = new SupportedCapabilities();
315+
}
316+
vSupportedCapabilities.SupportedSecurityOption = this.SupportedSecurityOption;
317+
}
318+
304319
var vDiskUpdate = new PSDiskUpdate
305320
{
306321
OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null,

src/Compute/Compute/help/New-AzDiskConfig.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ New-AzDiskConfig [[-SkuName] <String>] [-Tier <String>] [-LogicalSectorSize <Int
2626
[-NetworkAccessPolicy <String>] [-BurstingEnabled <Boolean>] [-PublicNetworkAccess <String>]
2727
[-AcceleratedNetwork <Boolean>] [-DataAccessAuthMode <String>] [-Architecture <String>]
2828
[-PerformancePlus <Boolean>] [-OptimizedForFrequentAttach <Boolean>] [-SecurityMetadataUri <String>]
29-
[-SecurityDataUri <String>] [-DefaultProfile <IAzureContextContainer>]
29+
[-SecurityDataUri <String>] [-SupportedSecurityOption <String>] [-DefaultProfile <IAzureContextContainer>]
3030
[-WhatIf] [-Confirm] [<CommonParameters>]
3131
```
3232

@@ -93,6 +93,17 @@ New-AzDisk -ResourceGroupName 'ResourceGroup01' -DiskName 'Disk01' -Disk $diskCo
9393

9494
Create a disk with OptimizedForFrequentAttach as true, to improves reliability and performance of the data disks that will be frequently (more than 5 times a day) detached from one virtual machine and attached to another.
9595

96+
### Example 5
97+
```powershell
98+
$accountType = <Account Type>
99+
$sourceUri = <Source URI of the blob>
100+
$storageAccountId = <Storage Account ID>
101+
$diskConfig = New-AzDiskConfig -AccountType $accountType -CreateOption Import -SourceUri $sourceUri -StorageAccountId $storageAccountId -SupportedSecurityOption 'TrustedLaunchSupported'
102+
New-AzDisk -ResourceGroupName 'ResourceGroup01' -DiskName 'Disk01' -Disk $diskConfig
103+
```
104+
105+
Creation of managed disk using CreateOption of Import, with SupportedSecurityOption as TrustedLaunchSupported
106+
96107
## PARAMETERS
97108

98109
### -AcceleratedNetwork
@@ -644,6 +655,22 @@ Accept pipeline input: True (ByPropertyName)
644655
Accept wildcard characters: False
645656
```
646657
658+
### -SupportedSecurityOption
659+
Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM.
660+
Possible values include: 'TrustedLaunchSupported', 'TrustedLaunchAndConfidentialVMSupported'
661+
662+
```yaml
663+
Type: System.String
664+
Parameter Sets: (All)
665+
Aliases:
666+
667+
Required: False
668+
Position: Named
669+
Default value: None
670+
Accept pipeline input: True (ByPropertyName)
671+
Accept wildcard characters: False
672+
```
673+
647674
### -SupportsHibernation
648675
Customers can set the SupportsHibernation flag on the Disk.
649676

0 commit comments

Comments
 (0)