< Back

Add-AzureRmVmssSshPublicKey

Tue Jan 29, 2019 9:37 pm

NAME Add-AzureRmVmssSshPublicKey



SYNOPSIS

Adds SSH public keys to the VMSS.





SYNTAX

Add-AzureRmVmssSshPublicKey [-VirtualMachineScaleSet] <PSVirtualMachineScaleSet> [[-Path] <String>] [[-KeyData] <String>] [-DefaultProfile

<IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Add-AzureRmVmssSshPublicKey cmdlet adds the public keys that you can use to connect to the Virtual Machine Scale Set (VMSS) virtual machines

over Secure Shell (SSH).





PARAMETERS

-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-KeyData <String>

Specifies a SSH RSA public key data.



Required? false

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Path <String>

Specifies the full path of a file, on the virtual machine, where this cmdlet stores the SSH public key. If the file already exists, this

cmdlet appends the key to the file.



Required? false

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VirtualMachineScaleSet <PSVirtualMachineScaleSet>

Specifies the VMSS object. You can use the New-AzureRmVmssConfig (./New-AzureRmVmssConfig.md)cmdlet to create the object.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

VirtualMachineScaleSet

Parameter 'VirtualMachineScaleSet' accepts value of type 'VirtualMachineScaleSet' from the pipeline





OUTPUTS



This cmdlet does not generate any output.





NOTES









Example 1: Add an SSH public key to the VMSS



PS C:\\> $VMSS = New-AzureRmVmssConfig

PS C:\\> Add-AzureRmVmssSshPublicKey -VirtualMachineScaleSet $VMSS -KeyData "MIIDszCCApugAwIBAgIJALBV9YJCF/tAMA0GCSq12Ib3DQEB21QUAMEUxCzAJBgNV"

-Path "/home/admin/.ssh/authorized_keys"



This example adds an SSH public key to the VMSS.



The first command uses the New-AzureRmVmssConfig cmdlet to create a VMSS configuration object and stores the result in the variable named $VMSS.

The second command adds an SSH key with the specified key data and stores the key at the specified path on the virtual machine.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... hpublickey

New-AzureRmVmssConfig