$resourceGroup = "Susheel-Test-RG" $location = "West US" $vmName = "Trusted-Test-VM" $vmSize = Standard_B2s $publisher = "MicrosoftWindowsServer" $offer = "WindowsServer" $sku = "2019-datacenter-gensecond" $version = latest $cred = Get-Credential ` -Message "Enter a username and password for the virtual machine." $vm = New-AzVMConfig -VMName $vmName -VMSize $vmSize $vm = Set-AzVMOperatingSystem ` -VM $vm -Windows ` -ComputerName $vmName ` -Credential $cred ` -ProvisionVMAgent ` -EnableAutoUpdate $vm = Add-AzVMNetworkInterface -VM $vm ` -Id $NIC.Id $vm = Set-AzVMSourceImage -VM $vm ` -PublisherName $publisher ` -Offer $offer ` -Skus $sku ` -Version $version $vm = Set-AzVMOSDisk -VM $vm ` -StorageAccountType "StandardSSD_LRS" ` -CreateOption "FromImage" $vm = Set-AzVmSecurityType -VM $vm ` -SecurityType "TrustedLaunch" $vm = Set-AzVmUefi -VM $vm ` -EnableVtpm $true ` -EnableSecureBoot $true New-AzVM -ResourceGroupName $resourceGroup -Location $location -VM $vm