你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Set-AzVMAccessExtension

Adds the VMAccess extension to a virtual machine.

Syntax

Set-AzVMAccessExtension
   [-Credential <PSCredential>]
   [-ResourceGroupName] <String>
   [-VMName] <String>
   -Name <String>
   [-TypeHandlerVersion <String>]
   [-Location <String>]
   [-DisableAutoUpgradeMinorVersion]
   [-ForceRerun <String>]
   [-NoWait]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-AzVMAccessExtension cmdlet adds the Virtual Machine Access (VMAccess) Virtual Machine VMAccess Extension to a virtual machine. VMAccess Extension can be used to set a temporary password and this should be immediately changed it after logging into the machine. This is not supported on Windows Domain Controllers.

Examples

Example 1: Add a VMAccess extension

Set-AzVMAccessExtension -ResourceGroupName "ResourceGroup11" -Location "Central US" -VMName "VirtualMachine07" -Name "ContosoTest" -TypeHandlerVersion "2.4"

This command adds a VMAccess extension for the virtual machine named VirtualMachine07 in ResourceGroup11. The command specifies the name and type handler version for VMAccess.

Example 2

Adds the VMAccess extension to a virtual machine. (autogenerated)

Set-AzVMAccessExtension -Credential <PSCredential> -Location 'Central US' -Name 'ContosoTest' -ResourceGroupName 'ResourceGroup11' -TypeHandlerVersion '2.4' -VMName 'VirtualMachine07'

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies the user name and password for the virtual machine as a PSCredential object. If you type a different name than the current local administrator account on your VM, the VMAccess extension will add a local administrator account with that name, and assign your specified password to that account. If the local administrator account on your VM exists, it will reset the password and if the account is disabled, the VMAccess extension enables it. To obtain a credential, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

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

-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

-DisableAutoUpgradeMinorVersion

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

-ForceRerun

Indicates that this cmdlet forces a rerun of the same extension configuration on the virtual machine without uninstalling and reinstalling the extension. The value can be any string different from the current value. If forceUpdateTag is not changed, updates to public or protected settings are still applied by the handler.

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

-Location

Specifies the location of the virtual machine.

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

-Name

Specifies the name of the extension that this cmdlet adds.

Type:String
Aliases:ExtensionName
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-NoWait

Starts the operation and returns immediately, before the operation is completed. In order to determine if the operation has successfully been completed, use some other mechanism.

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

-ResourceGroupName

Specifies the name of the resource group of the virtual machine.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TypeHandlerVersion

Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. The typeHandlerVersion must be 2.0 or greater, as version 1 is deprecated.

Type:String
Aliases:HandlerVersion, Version
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VMName

Specifies the name of a virtual machine. This cmdlet adds VMAccess for the virtual machine that this parameter specifies.

Type:String
Aliases:ResourceName
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSCredential

String

SwitchParameter

Outputs

PSAzureOperationResponse