Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TrustedLaunch default in for VM and VMSS creation #22974

Merged
merged 45 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3718004
dev and test
Sandido Oct 13, 2023
5e9f806
vmss dev and test
Sandido Oct 16, 2023
79fe744
initial disk play
Sandido Oct 18, 2023
401750e
disk defaulting dev and test
Sandido Oct 20, 2023
ebe31cf
test play for new vm managed disk scenario
Sandido Oct 20, 2023
84db246
tl disk testing trying
Sandido Oct 23, 2023
27a61ee
clean
Sandido Oct 23, 2023
2e209b1
disk clean test good
Sandido Oct 24, 2023
428c920
vm rerecorded tests raw success
Sandido Oct 25, 2023
983af18
clean
Sandido Oct 26, 2023
7e79157
test
Sandido Oct 26, 2023
20c2a00
trying managed disk vm scenario, vmss stuff too
Sandido Nov 1, 2023
74e064e
stuff
Sandido Nov 2, 2023
1e214e6
vmss and vm tests
Sandido Nov 2, 2023
d939427
2 rerecorded tests
Sandido Nov 2, 2023
87dcbf8
tests so far
Sandido Nov 3, 2023
045dde0
fixing most tests, enabling stnd
Sandido Nov 3, 2023
1f7a6f5
all compute tests fixed i think
Sandido Nov 5, 2023
e6c84e4
compute tests mostly fixed
Sandido Nov 5, 2023
994756b
clean
Sandido Nov 5, 2023
f7e5ed1
recovery services tests
Sandido Nov 5, 2023
9ec1b67
examples and disk standard parts and recoveryservices test fix
Sandido Nov 5, 2023
0f0beef
changelog
Sandido Nov 5, 2023
3240ca9
Merge branch 'main' into adsandor/tldefault
Sandido Nov 5, 2023
88c10a5
guestattestation removal
Sandido Nov 5, 2023
aba3f36
Merge branch 'adsandor/tldefault' of https://github.com/Azure/azure-p…
Sandido Nov 5, 2023
b165fb5
removed disableintegritymonitoring parameter
Sandido Nov 5, 2023
2d181e8
changelog clean
Sandido Nov 6, 2023
8f23b4f
Update BreakingChangeIssues.csv
Sandido Nov 6, 2023
4c37514
Update BreakingChangeIssues.csv
Sandido Nov 6, 2023
d32a179
example fix
Sandido Nov 6, 2023
64f8d18
Merge branch 'adsandor/tldefault' of https://github.com/Azure/azure-p…
Sandido Nov 6, 2023
dd2c61b
added back in guest attestation logic
Sandido Nov 6, 2023
d6decbf
Update BreakingChangeIssues.csv
Sandido Nov 6, 2023
389c9b0
put back guest attestation, fixed tests for that.
Sandido Nov 6, 2023
6174e57
Update VirtualMachineScaleSetCreateOrUpdateMethod.cs
Sandido Nov 6, 2023
0726a70
Update New-AzVM.md
Sandido Nov 6, 2023
5af0023
Update New-AzVmss.md
Sandido Nov 6, 2023
3d64f4a
Merge branch 'adsandor/tldefault' of https://github.com/Azure/azure-p…
Sandido Nov 6, 2023
40ecee1
rerecord tests
Sandido Nov 6, 2023
f564f1f
fix ssh test
Sandido Nov 6, 2023
32be162
vm test cleanup
Sandido Nov 6, 2023
c772b7b
cleanups and error safety
Sandido Nov 6, 2023
95999ad
simplify based on comments. Match VM images with vmss images
Sandido Nov 7, 2023
4e3c519
cleanup mostly
Sandido Nov 7, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,8 @@ function Create-AdvancedVM($rgname, $vmname, $loc, $vmsize, $stotype, $nicCount,
{
$zoneparams.Add("Zone", $zone)
}
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize @zoneparams;
$stnd = "Standard";
$p = New-AzVMConfig -SecurityType $stnd -VMName $vmname -VMSize $vmsize @zoneparams;
$nul = Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

Write-Verbose "Start Create-AdvancedVM - Config done"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ function Test-AvailabilitySetVM
# VM Profile & Hardware
$vmsize = 'Standard_DS1_v2';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -AvailabilitySetId $aset.Id;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd -AvailabilitySetId $aset.Id;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ function Test-VirtualMachineZone
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
$computerName = 'test';
$stnd = "Standard";

$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -Zone "1" `
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -Zone "1" -SecurityType $stnd `
| Add-AzVMNetworkInterface -Id $nicId -Primary `
| Set-AzVMOperatingSystem -Windows -ComputerName $computerName -Credential $cred;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function Test-SetChefExtensionBasic
# VM Profile & Hardware
$vmsize = 'Standard_A2';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ function Create-VirtualMachine

# VM Profile & Hardware
$vmsize = 'Standard_A2';
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down Expand Up @@ -267,7 +268,8 @@ function Create-VirtualMachineNoDataDisks

# VM Profile & Hardware
$vmsize = 'Standard_D2S_V3';
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,15 @@ function Test-DedicatedHostVirtualMachine
# VM Profile & Hardware
$vmsize = 'Standard_E2s_v3';
$vmname0 = 'v' + $rgname;
$stnd = "Standard";

# Creating a VM using simple parameter set
$username = "admin01"
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
[string]$domainNameLabel = "$vmname0-$vmname0".tolower();

New-AzVM -ResourceGroupName $rgname -Name $vmname0 -Credential $cred -Zone "2" -Size $vmsize -HostId $dedicatedHostId -DomainNameLabel $domainNameLabel;
New-AzVM -ResourceGroupName $rgname -Name $vmname0 -Credential $cred -Zone "2" -Size $vmsize -HostId $dedicatedHostId -DomainNameLabel $domainNameLabel -SecurityType $stnd;
$vm0 = Get-AzVM -ResourceGroupName $rgname -Name $vmname0;
Assert-AreEqual $dedicatedHostId $vm0.Host.Id;

Expand All @@ -177,7 +178,7 @@ function Test-DedicatedHostVirtualMachine
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
$computerName = 'test';

$p = New-AzVMConfig -VMName $vmname1 -VMSize $vmsize -Zone "2" -HostId $dedicatedHostId `
$p = New-AzVMConfig -VMName $vmname1 -VMSize $vmsize -Zone "2" -HostId $dedicatedHostId -SecurityType $stnd `
| Add-AzVMNetworkInterface -Id $nicId -Primary `
| Set-AzVMOperatingSystem -Windows -ComputerName $computerName -Credential $cred;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ function Test-VmssDiagnosticsExtension

$adminUsername = 'Foo12';
$adminPassword = Get-PasswordForVM;
$stnd = "Standard";

$imgRef = Get-DefaultCRPImage -loc $loc;
$vhdContainer = "https://" + $stoname + ".blob.core.windows.net/" + $vmssName;
Expand All @@ -252,7 +253,7 @@ function Test-VmssDiagnosticsExtension
New-AzStorageAccount -ResourceGroupName $rgname -Name $storagename -Location $loc -Type $storagetype;

$ipCfg = New-AzVmssIPConfig -Name 'test' -SubnetId $subnetId;
$vmss = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName 'Standard_A1_v2' -UpgradePolicyMode 'automatic' -NetworkInterfaceConfiguration $netCfg `
$vmss = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName 'Standard_A1_v2' -UpgradePolicyMode 'automatic' -NetworkInterfaceConfiguration $netCfg -SecurityType $stnd `
| Add-AzVmssNetworkInterfaceConfiguration -Name 'test' -Primary $true -IPConfiguration $ipCfg `
| Set-AzVmssOSProfile -ComputerNamePrefix 'test' -AdminUsername $adminUsername -AdminPassword $adminPassword `
| Set-AzVmssStorageProfile -Name 'test' -OsDiskCreateOption 'FromImage' -OsDiskCaching 'None' `
Expand Down
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 @@ -170,5 +170,12 @@ public void TestSecurityProfileStandard()
{
TestRunner.RunTestScript("Test-SecurityProfileStandard");
}

[Fact]
[Trait(Category.AcceptanceType, Category.LiveOnly)]
public void TestNewDiskSecurityTypeDefaulting()
{
TestRunner.RunTestScript("Test-NewDiskSecurityTypeDefaulting");
}
}
}
35 changes: 35 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1700,4 +1700,39 @@ function Test-DiskAcceleratedNetworkAndPublicNetworkAccess
# Cleanup
Clean-ResourceGroup $rgname;
}
}

<#
.SYNOPSIS
Disk creation defaults to TL when being created from an Image that is HyperVGeneration V2.
Feature request 1248
#>
function Test-NewDiskSecurityTypeDefaulting
{
$rgname = Get-ComputeTestResourceName;
$loc = 'eastus2';

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

$diskname = "d" + $rgname;
$securityTypeTL = "TrustedLaunch";
$hyperVGen2 = "V2";

$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;
Assert-AreEqual $disk.SecurityProfile.securityType $securityTypeTL;
Assert-AreEqual $disk.HyperVGeneration $hyperVGen2;

}
finally
{
# Cleanup
Clean-ResourceGroup $rgname;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ function Test-GetAzureRmVMDscExtension
# VM Profile & Hardware
$vmsize = 'Standard_A2';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down Expand Up @@ -116,6 +117,7 @@ function Test-DSCExtensionVMPiping
$vmsize = 'Standard_E2s_v3';
$vmname = 'v' + $rgname;
$domainNameLabel1 = "domain1" + $rgname;
$stnd = "Standard";

# Common
New-AzResourceGroup -Name $rgname -Location $loc -Force;
Expand All @@ -124,7 +126,7 @@ function Test-DSCExtensionVMPiping
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force;
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password;

$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;

# NRP
$subnet = New-AzVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
Expand Down
9 changes: 6 additions & 3 deletions src/Compute/Compute.Test/ScenarioTests/GalleryTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ function Test-Gallery
# Create a VM first
$vmsize = 'Standard_A4';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down Expand Up @@ -393,7 +394,8 @@ function Test-GalleryCrossTenant
# Create a VM first
$vmsize = 'Standard_D2_v2';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;

# NRP
$subnet = New-AzVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
Expand Down Expand Up @@ -504,7 +506,8 @@ function Test-GalleryImageVersion
# Create a VM first
$vmsize = 'Standard_A2_v2';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down
6 changes: 4 additions & 2 deletions src/Compute/Compute.Test/ScenarioTests/ImageTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function Test-Image
# Create a VM first
$vmsize = 'Standard_A4';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down Expand Up @@ -217,7 +218,8 @@ function Test-ImageCapture
# Create a VM first
$vmsize = 'Standard_A4';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down
3 changes: 2 additions & 1 deletion src/Compute/Compute.Test/ScenarioTests/NoWaitTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function Test-NoWaitParameter
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
[string]$domainNameLabel = "$vmname-$vmname".tolower();
$vmobject = New-AzVm -Name $vmname -ResourceGroupName $rgname -Credential $cred -DomainNameLabel $domainNameLabel;
$stnd = "Standard";
$vmobject = New-AzVm -Name $vmname -ResourceGroupName $rgname -Credential $cred -DomainNameLabel $domainNameLabel -SecurityType $stnd;

$response = Start-AzVm -ResourceGroupName $rgname -Name $vmname -NoWait
Assert-NotNull $response.RequestId
Expand Down
8 changes: 5 additions & 3 deletions src/Compute/Compute.Test/ScenarioTests/PPGTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ function Test-ProximityPlacementGroupVM
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);

# Create a virtual machine configuration
$p = New-AzVMConfig -VMName $vmName -VMSize Standard_A1 -ProximityPlacementGroupId $ppg.Id `
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmName -VMSize Standard_A1 -ProximityPlacementGroupId $ppg.Id -SecurityType $stnd `
| Set-AzVMOperatingSystem -Windows -ComputerName $vmName -Credential $cred `
| Add-AzVMNetworkInterface -Id $nic.Id;

Expand Down Expand Up @@ -359,6 +360,7 @@ function Test-PPGVMIntentAndZoneFeatures
$vmIntentListUpdate3 = 'Standard_DS3_v2';
$zone = '1';
$zone2 = '2';
$stnd = "Standard";

$proxgroup = New-AzProximityPlacementGroup -ResourceGroupName $rgname -Name $ppgname -Location $loc -Zone $zone -IntentVMSizeList $vmIntentList1, $vmIntentList2 ;

Expand Down Expand Up @@ -396,7 +398,7 @@ function Test-PPGVMIntentAndZoneFeatures
$vmSize = 'Standard_D4ds_v5';

# Create a virtual machine configuration
$p = New-AzVMConfig -VMName $vmName -VMSize $vmSize -ProximityPlacementGroupId $ppg.Id `
$p = New-AzVMConfig -VMName $vmName -VMSize $vmSize -ProximityPlacementGroupId $ppg.Id -SecurityType $stnd `
| Set-AzVMOperatingSystem -Windows -ComputerName $vmName -Credential $cred `
| Add-AzVMNetworkInterface -Id $nic.Id;

Expand All @@ -417,7 +419,7 @@ function Test-PPGVMIntentAndZoneFeatures

# Create a virtual machine using Simple Parameter set.
$domainNameLabel = "d" + $rgname;
New-AzVM -ResourceGroupName $rgname -Location $loc -name $vmname -credential $cred -DomainNameLabel $domainNameLabel -ProximityPlacementGroupId $ppg.Id ;
New-AzVM -ResourceGroupName $rgname -Location $loc -name $vmname -credential $cred -DomainNameLabel $domainNameLabel -ProximityPlacementGroupId $ppg.Id -SecurityType $stnd;
$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmName;
Assert-AreEqual $ppg.Id $vm.ProximityPlacementGroup.Id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ function Test-SetAzureRmVMSqlServerExtension
# VM Profile & Hardware
$vmsize = 'Standard_A2';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down Expand Up @@ -235,7 +236,8 @@ function Test-SetAzureRmVMSqlServerExtensionWith2017Image
# VM Profile & Hardware
$vmsize = 'Standard_A2';
$vmname = 'vm' + $rgname;
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
$stnd = "Standard";
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -SecurityType $stnd;
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;

# NRP
Expand Down
Loading