Skip to content

Commit 31e9a8c

Browse files
Sandidogrizzlytheodorepavanrachapudy90Pavan Rachapudy
authored
Trusted Launch Test (#18562)
* Delete test json files (#18003) * Delete TestVMExtensionOperations.json * Delete TestVMScaleSetExtensions.json * Resolve conflicts for -updated merge (#18015) * Update SdkInfo_ComputeManagementClient.cs * Update VirtualMachineRunCommandsOperations.cs * Update VirtualMachineScaleSetVMRunCommandsOperations.cs * Create TestVMExtensionOperations.json * Delete TestVMExtensionOperations.json * Create TestVMExtensionOperations.json * Create TestVMScaleSetExtensions.json * Compute 2020 12 updated (#17975) * adding 2020-12-01 compute generated files * update default sku * update tests * test updates * records * tests fixes * all the recorded tests * more update * more update * more update * last test fixes * Updated TestVMIdentitySystemAssignedUserAssigned SDK Test to create User Assigned Identity using SDK (#17861) * Updated TestVMIdentitySystemAssignedUserAssigned SDK Test to create User Assigned MI using MSI SDK * Resolved Merge Conflicts and updated the test Co-authored-by: Pavan Rachapudy <vrachapu@microsoft.com> * Delete AppGW tests (#17977) * Delete VMScaleSetAppGwWithAS.json * Delete VMScaleSetAppGwWithAS_A1V2.json * Delete VMScaleSetAppGwWithAS_SPG_False.json * Delete VMScaleSetAppGwWithAS_Spot.json * Delete VMScaleSetAppGWTests.cs * Delete deprecated ContainerService tests (#17976) * Delete ContainerServiceOperationalTests.cs * Delete ContainerServiceTestsBase.cs * Delete ContainerServiceUpdateTests.cs * Delete TestDCOSOperations.json * Delete TestSwarmOperations.json * Delete TestContainerServiceUpdateOperations.json * test * remove test text Co-authored-by: pavanrachapudy <pavanrachapudy@gmail.com> Co-authored-by: Pavan Rachapudy <vrachapu@microsoft.com> Co-authored-by: Adam Sandor <adsandor@microsoft.com> * new recording files * 2020-12 release features generated, tests pass * Update DiskRPTestsBase.cs (#18355) * Remove CloudService tests (#18423) * Delete CloudServiceExtensionTests.cs * Delete CloudServiceOperationTests.cs * Delete CloudServiceRoleInstanceTests.cs * Delete CloudServiceScenarioTests.cs * Delete CloudServiceTestsBase.cs * Delete CloudServiceUpdateTests.cs * Delete MultiRole_CreateUpdateGetAndDeleteWithExtension_WorkerAndWebRole.json * Delete MultiRole_CreateUpdateGetAndDeleteWithExtension_WorkerAndWebRole_MultiRoleExtension.json * Delete Test_Create_PowerOff_Start_CloudServiceOperation.json * Delete Test_ListCloudServicesOperation.json * Delete Test_CloudServiceRoleInstanceOperations.json * Delete TestCloudServiceScenarioOperations.json * Delete TestCloudServiceScenarioOperations_DeleteCloudService.json * Delete TestCloudServiceScenarioOperations_ExtensionProfile.json * Delete TestCloudServiceScenarioOperations_InstanceView.json * Delete TestCloudServiceOperations_ScaleIn_ScaleOut.json * Delete TestCloudServiceUpdateOperations.json * Update AzSdk.RP.props * Update AzSdk.RP.props remove containerService * Delete ServiceConfigurationHelpers.cs * regenerate on released 2020-12-01 swagger * re-recorded test jsons * test fixes * Update VMScenarioTests.cs * Update VMTestBase.cs * Create TestVMScenarioOperations_TrustedLaunch.json * Update OrchestrationMode.cs Co-authored-by: Theodore Chang <thchan@microsoft.com> Co-authored-by: pavanrachapudy <pavanrachapudy@gmail.com> Co-authored-by: Pavan Rachapudy <vrachapu@microsoft.com>
1 parent da9e91b commit 31e9a8c

File tree

4 files changed

+1776
-3
lines changed

4 files changed

+1776
-3
lines changed

sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMInstanceViewPatchStatusTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using Compute.Tests;

sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMScenarioTests.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,27 @@ public void TestVMScenarioOperations_EncryptionAtHost()
105105
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", originalTestLocation);
106106
}
107107
}
108+
109+
/// <summary>
110+
/// To record this test case, you need to run it in region which support Encryption at host
111+
/// </summary>
112+
[Fact]
113+
[Trait("Name", "TestVMScenarioOperations_TrustedLaunch")]
114+
public void TestVMScenarioOperations_TrustedLaunch()
115+
{
116+
string originalTestLocation = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION");
117+
try
118+
{
119+
ImageReference image = new ImageReference(publisher: "MicrosoftWindowsServer", offer: "windowsserver-gen2preview-preview", version: "18363.592.2001092016", sku: "windows10-tvm");
120+
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", "eastus2euap");
121+
TestVMScenarioOperationsInternal("TestVMScenarioOperations_TrustedLaunch", vmSize: VirtualMachineSizeTypes.StandardD2sV3, hasManagedDisks: true,
122+
osDiskStorageAccountType: StorageAccountTypes.StandardSSDLRS, securityType: "TrustedLaunch", imageReference: image, validateListAvailableSize: false);
123+
}
124+
finally
125+
{
126+
Environment.SetEnvironmentVariable("AZURE_VM_TEST_LOCATION", originalTestLocation);
127+
}
128+
}
108129

109130
/// <summary>
110131
/// To record this test case, you need to run it in region which support DiskEncryptionSet resource for the Disks
@@ -241,7 +262,7 @@ public void TestVMScenarioOperations_PpgScenario()
241262
private void TestVMScenarioOperationsInternal(string methodName, bool hasManagedDisks = false, IList<string> zones = null, string vmSize = "Standard_A1_v2",
242263
string osDiskStorageAccountType = "Standard_LRS", string dataDiskStorageAccountType = "Standard_LRS", bool? writeAcceleratorEnabled = null,
243264
bool hasDiffDisks = false, bool callUpdateVM = false, bool isPpgScenario = false, string diskEncryptionSetId = null, bool? encryptionAtHostEnabled = null,
244-
bool isAutomaticPlacementOnDedicatedHostGroupScenario = false, ImageReference imageReference = null, bool validateListAvailableSize = true)
265+
string securityType = null, bool isAutomaticPlacementOnDedicatedHostGroupScenario = false, ImageReference imageReference = null, bool validateListAvailableSize = true)
245266
{
246267
using (MockContext context = MockContext.Start(this.GetType(), methodName))
247268
{
@@ -280,7 +301,7 @@ private void TestVMScenarioOperationsInternal(string methodName, bool hasManaged
280301

281302
CreateVM(rgName, asName, storageAccountName, imageRef, out inputVM, hasManagedDisks: hasManagedDisks,hasDiffDisks: hasDiffDisks, vmSize: vmSize, osDiskStorageAccountType: osDiskStorageAccountType,
282303
dataDiskStorageAccountType: dataDiskStorageAccountType, writeAcceleratorEnabled: writeAcceleratorEnabled, zones: zones, ppgName: ppgName,
283-
diskEncryptionSetId: diskEncryptionSetId, encryptionAtHostEnabled: encryptionAtHostEnabled, dedicatedHostGroupReferenceId: dedicatedHostGroupReferenceId,
304+
diskEncryptionSetId: diskEncryptionSetId, encryptionAtHostEnabled: encryptionAtHostEnabled, securityType: securityType, dedicatedHostGroupReferenceId: dedicatedHostGroupReferenceId,
284305
dedicatedHostGroupName: dedicatedHostGroupName, dedicatedHostName: dedicatedHostName);
285306

286307
// Instance view is not completely populated just after VM is provisioned. So we wait here for a few minutes to
@@ -326,6 +347,12 @@ private void TestVMScenarioOperationsInternal(string methodName, bool hasManaged
326347
listVMSizesResponse = m_CrpClient.AvailabilitySets.ListAvailableSizes(rgName, asName);
327348
Helpers.ValidateVirtualMachineSizeListResponse(listVMSizesResponse, hasAZ: zones != null, writeAcceleratorEnabled: writeAcceleratorEnabled, hasDiffDisks: hasDiffDisks);
328349
}
350+
351+
if(securityType != null && securityType.Equals("TrustedLaunch"))
352+
{
353+
Assert.True(inputVM.SecurityProfile.UefiSettings.VTpmEnabled);
354+
Assert.True(inputVM.SecurityProfile.UefiSettings.SecureBootEnabled);
355+
}
329356

330357
if(isPpgScenario)
331358
{

sdk/compute/Microsoft.Azure.Management.Compute/tests/ScenarioTests/VMTestBase.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ protected VirtualMachine CreateVM(
235235
string ppgName = null,
236236
string diskEncryptionSetId = null,
237237
bool? encryptionAtHostEnabled = null,
238+
string securityType = null,
238239
string dedicatedHostGroupReferenceId = null,
239240
string dedicatedHostGroupName = null,
240241
string dedicatedHostName = null)
@@ -296,6 +297,30 @@ protected VirtualMachine CreateVM(
296297
EncryptionAtHost = encryptionAtHostEnabled.Value
297298
};
298299
}
300+
301+
if (securityType != null && securityType.Equals("TrustedLaunch"))
302+
{
303+
if(inputVM.SecurityProfile != null)
304+
{
305+
inputVM.SecurityProfile.UefiSettings = new UefiSettings
306+
{
307+
VTpmEnabled = true,
308+
SecureBootEnabled = true
309+
};
310+
}
311+
else
312+
{
313+
inputVM.SecurityProfile = new SecurityProfile
314+
{
315+
UefiSettings = new UefiSettings
316+
{
317+
VTpmEnabled = true,
318+
SecureBootEnabled = true
319+
}
320+
};
321+
}
322+
323+
}
299324

300325
if (zones != null)
301326
{

0 commit comments

Comments
 (0)