Set-AzVMUefi
Modifies UEFI properties of a gen 2 virtual machine
Syntax
Default (Default)
Set-AzVMUefi
[-VM] <PSVirtualMachine>
[-EnableVtpm <Boolean>]
[-EnableSecureBoot <Boolean>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Set-AzVMUefi cmdlet modifies UEFI properties of a virtual machine.
Examples
Example 1
$VM = Get-AzVM -ResourceGroupName "ResourceGroup11" -VMName "ContosoVM07"
Set-AzVMUefi -VM $VM -EnableVtpm $true -EnableSecureBoot $true
The first command gets the virtual machine named ContosoVM07 by using Get-AzVM. The command stores it in the $VM variable. The second command modifies the UEFI settings to enable SecureBoot and vTPM on the virtual machine in $VM. The command passes the result to the Update-AzVM cmdlet, which implements your changes. A change to the cashing mode causes the virtual machine to restart.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-EnableSecureBoot
Parameter to toggle secure boot on the VM
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-EnableVtpm
Parameter to toggle vTPM on the VM
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-VM
The virtual machine profile.
Parameter properties
| Type: | PSVirtualMachine |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | VMProfile |
Parameter sets
(All)
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.