@@ -105,6 +105,27 @@ public void TestVMScenarioOperations_EncryptionAtHost()
105
105
Environment . SetEnvironmentVariable ( "AZURE_VM_TEST_LOCATION" , originalTestLocation ) ;
106
106
}
107
107
}
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
+ }
108
129
109
130
/// <summary>
110
131
/// 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()
241
262
private void TestVMScenarioOperationsInternal ( string methodName , bool hasManagedDisks = false , IList < string > zones = null , string vmSize = "Standard_A1_v2" ,
242
263
string osDiskStorageAccountType = "Standard_LRS" , string dataDiskStorageAccountType = "Standard_LRS" , bool ? writeAcceleratorEnabled = null ,
243
264
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 )
245
266
{
246
267
using ( MockContext context = MockContext . Start ( this . GetType ( ) , methodName ) )
247
268
{
@@ -280,7 +301,7 @@ private void TestVMScenarioOperationsInternal(string methodName, bool hasManaged
280
301
281
302
CreateVM ( rgName , asName , storageAccountName , imageRef , out inputVM , hasManagedDisks : hasManagedDisks , hasDiffDisks : hasDiffDisks , vmSize : vmSize , osDiskStorageAccountType : osDiskStorageAccountType ,
282
303
dataDiskStorageAccountType : dataDiskStorageAccountType , writeAcceleratorEnabled : writeAcceleratorEnabled , zones : zones , ppgName : ppgName ,
283
- diskEncryptionSetId : diskEncryptionSetId , encryptionAtHostEnabled : encryptionAtHostEnabled , dedicatedHostGroupReferenceId : dedicatedHostGroupReferenceId ,
304
+ diskEncryptionSetId : diskEncryptionSetId , encryptionAtHostEnabled : encryptionAtHostEnabled , securityType : securityType , dedicatedHostGroupReferenceId : dedicatedHostGroupReferenceId ,
284
305
dedicatedHostGroupName : dedicatedHostGroupName , dedicatedHostName : dedicatedHostName ) ;
285
306
286
307
// 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
326
347
listVMSizesResponse = m_CrpClient . AvailabilitySets . ListAvailableSizes ( rgName , asName ) ;
327
348
Helpers . ValidateVirtualMachineSizeListResponse ( listVMSizesResponse , hasAZ : zones != null , writeAcceleratorEnabled : writeAcceleratorEnabled , hasDiffDisks : hasDiffDisks ) ;
328
349
}
350
+
351
+ if ( securityType != null && securityType . Equals ( "TrustedLaunch" ) )
352
+ {
353
+ Assert . True ( inputVM . SecurityProfile . UefiSettings . VTpmEnabled ) ;
354
+ Assert . True ( inputVM . SecurityProfile . UefiSettings . SecureBootEnabled ) ;
355
+ }
329
356
330
357
if ( isPpgScenario )
331
358
{
0 commit comments