Skip to content

Commit

Permalink
gallery Confidential VM feature (Azure#19359)
Browse files Browse the repository at this point in the history
* update sdk package

* implement

* suppress breaking change

* update md file and changelog

* Fix ps730previewbug (Azure#19351)

* update sdk package

* suppress breaking change

Co-authored-by: Theodore Chang <[email protected]>

* Update src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj

* suppress example issues

* fix example issues

* example and changelog

Co-authored-by: Theodore Chang <[email protected]>
Co-authored-by: Yeming Liu <[email protected]>
  • Loading branch information
3 people authored and hiaga committed Sep 2, 2022
1 parent 2f4fcfa commit fd05db8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* Improved printed output for `Get-AzComputeResourceSku`
* Updated `Update-AzVm` to give constructive error messages when empty variables are passed in parameters. [#15081]
* Added `Zone` and `IntentVMSizeList` optional parameters to the cmdlet `New-AzProximityPlacementGroup`.
* For `New-AzGalleryImageVersion`, `CVMEncryptionType` and `CVMDiskEncryptionSetID` added as keys for parameter `-Target`.

## Version 4.30.0
* Added parameters `PackageFileName`, `ConfigFileName` for `New-AzGalleryApplicationVersion`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,34 @@ public override void ExecuteCmdlet()
target.Encryption = new EncryptionImages(osDiskImageEncryption, dataDiskImageEncryption);
}

if (t["CVMEncryptionType"] != null)
{
if (target.Encryption == null)
{
target.Encryption = new EncryptionImages();
}
target.Encryption.OsDiskImage = new OSDiskImageEncryption();
target.Encryption.OsDiskImage.SecurityProfile = new OSDiskImageSecurityProfile();
target.Encryption.OsDiskImage.SecurityProfile.ConfidentialVMEncryptionType = (string)t["CVMEncryptionType"];
}

if (t["CVMDiskEncryptionSetID"] != null)
{
if (target.Encryption == null)
{
target.Encryption = new EncryptionImages();
}
if (target.Encryption.OsDiskImage == null)
{
target.Encryption.OsDiskImage = new OSDiskImageEncryption();
}
if (target.Encryption.OsDiskImage.SecurityProfile == null)
{
target.Encryption.OsDiskImage.SecurityProfile = new OSDiskImageSecurityProfile();
}
target.Encryption.OsDiskImage.SecurityProfile.SecureVMDiskEncryptionSetId = (string)t["CVMDiskEncryptionSetID"];
}

galleryImageVersion.PublishingProfile.TargetRegions.Add(target);
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/Compute/Compute/help/New-AzGalleryImageDefinition.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
---
external help file: Microsoft.Azure.PowerShell.Cmdlets.Compute.dll-Help.xml
Module Name: Az.Compute
online version: https://docs.microsoft.com/powershell/module/az.compute/new-azgalleryimagedefinition
Expand Down Expand Up @@ -91,7 +91,8 @@ $skuName = "GreatSku"
$description = "My gallery"
$IsHibernateSupported = @{Name='IsHibernateSupported';Value='True'}
$IsAcceleratedNetworkSupported = @{Name='IsAcceleratedNetworkSupported';Value='False'}
$features = @($IsHibernateSupported,$IsAcceleratedNetworkSupported)
$ConfidentialVMSupported = @{Name='SecurityType';Value='ConfidentialVMSupported'}
$features = @($IsHibernateSupported,$IsAcceleratedNetworkSupported, $ConfidentialVMSupported)
New-AzGalleryImageDefinition -ResourceGroupName $rgName -GalleryName $galleryName -Name $galleryImageDefinitionName -Location $location -Publisher $publisherName -Offer $offerName -Sku $skuName -OsState "Generalized" -OsType "Windows" -Description $description -Feature $features
```

Expand Down
3 changes: 2 additions & 1 deletion src/Compute/Compute/help/New-AzGalleryImageVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ $galleryImageDefinitionName = "myImage"
$galleryImageVersionName = "1.0.0"
$location = "eastus"
$sourceImageId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myVMRG/providers/Microsoft.Compute/virtualMachines/myVM"
$diskEncryptionSetId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myVMRG/providers/Microsoft.Compute/diskEncryptionSets/cvmDiskEncryptionSet"
$replicaCount = 1
$storageAccountType = "Standard_ZRS"
$region_eastus = @{Name = 'East US';ReplicaCount = 3;StorageAccountType = 'Standard_LRS'}
$region_eastus = @{Name = 'East US';ReplicaCount = 3;StorageAccountType = 'Standard_LRS'; CVMEncryptionType="EncryptedWithCmk"; CVMDiskEncryptionSetID=$diskEncryptionSetId}
$region_westus = @{Name = 'West US'}
$region_ukwest = @{Name = 'UK West';ReplicaCount = 2}
$region_southcentralus = @{Name = 'South Central US';StorageAccountType = 'Standard_LRS'}
Expand Down
8 changes: 8 additions & 0 deletions tools/StaticAnalysis/Exceptions/Az.Compute/ExampleIssues.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"Module","Cmdlet","Example","Line","RuleName","ProblemId","Severity","Description","Extent","Remediation"
"Compute","New-AzGalleryImageDefinition","4","11","MissingEndCurlyBrace","5200","1","Missing closing '}' in statement block or type definition.","","Unexpected Error. Please check [Trouble Shotting for Unexpected Errors in Example Issues](https://github.com/Azure/azure-powershell/blob/main/documentation/Debugging-StaticAnalysis-Errors.md#Troubleshotting-Example-Issues) for more details."
"Compute","New-AzGalleryImageDefinition","4","11","UnexpectedToken","5200","1","Unexpected token '?????Name='SecurityType'' in expression or statement.","?????Name='SecurityType'","Unexpected Error. Please check [Trouble Shotting for Unexpected Errors in Example Issues](https://github.com/Azure/azure-powershell/blob/main/documentation/Debugging-StaticAnalysis-Errors.md#Troubleshotting-Example-Issues) for more details."
"Compute","New-AzGalleryImageDefinition","4","14","UnexpectedToken","5200","1","Unexpected token '}' in expression or statement.","}","Unexpected Error. Please check [Trouble Shotting for Unexpected Errors in Example Issues](https://github.com/Azure/azure-powershell/blob/main/documentation/Debugging-StaticAnalysis-Errors.md#Troubleshotting-Example-Issues) for more details."
"Compute","New-AzGalleryImageDefinition","4","11","Invalid_Cmdlet","5000","1","????? is not a valid command name.","?????","Check the spell of ?????."
"Compute","New-AzGalleryImageDefinition","4","11","Invalid_Cmdlet","5000","1","?????Name='SecurityType' is not a valid command name.","?????Name='SecurityType'","Check the spell of ?????Name='SecurityType'."
"Compute","New-AzGalleryImageDefinition","4","11","Invalid_Cmdlet","5000","1","Value='ConfidentialVMSupported' is not a valid command name.","Value='ConfidentialVMSupported'","Check the spell of Value='ConfidentialVMSupported'."
"Compute","New-AzGalleryImageVersion","9","10","Invalid_Cmdlet","5000","1","EncryptedWithCmk is not a valid command name.","EncryptedWithCmk","Check the spell of EncryptedWithCmk."

0 comments on commit fd05db8

Please sign in to comment.