I want to create a Virtual Machine in Azure with security Type as Trusted Launch where security profile has UEFI settings like SecureBoot and vTPM enabled.
Now, Once VM is deployed I want to turn off the UEFI settings, and Vice Versa using PowerShell command. Is it possible?
You can make use of below Az
PowerShell commands to turn UEFI settings ON
in Azure virtual machine.
$VM = Get-AzVM -ResourceGroupName "rg_name" -VMName "vm_name"
Set-AzVMUefi -VM $VM -EnableVtpm $true -EnableSecureBoot $true
Update-AzVM -VM $VM -ResourceGroupName "rg_name"
While creating virtual machine, these settings will be enabled by default like below:
To turn above UEFI settings OFF
in Azure virtual machine, you can make use of below Az
PowerShell command by including $false in it like this:
$VM = Get-AzVM -ResourceGroupName "rg_name" -VMName "vm_name"
Set-AzVMUefi -VM $VM -EnableVtpm $false -EnableSecureBoot $false
Update-AzVM -VM $VM -ResourceGroupName "rg_name"
Response:
When I checked the same in Portal, settings are disabled successfully like below:
Reference: