Editar

Compartilhar via


Set-AzVMUefi

Modifies UEFI properties of a gen 2 virtual machine

Syntax

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.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableSecureBoot

Parameter to toggle secure boot on the VM

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-EnableVtpm

Parameter to toggle vTPM on the VM

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VM

The virtual machine profile.

Type:PSVirtualMachine
Aliases:VMProfile
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

PSVirtualMachine

Boolean

Outputs

PSVirtualMachine