Add-AzVmssSshPublicKey
Adds SSH public keys to the VMSS.
Syntax
Add-AzVmssSshPublicKey
[-VirtualMachineScaleSet] <PSVirtualMachineScaleSet>
[[-Path] <String>]
[[-KeyData] <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Add-AzVmssSshPublicKey cmdlet adds the public keys that you can use to connect to the Virtual Machine Scale Set (VMSS) virtual machines over Secure Shell (SSH).
Examples
Example 1: Add an SSH public key to the VMSS
$VMSS = New-AzVmssConfig
Add-AzVmssSshPublicKey -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-AzVmssConfig 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.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
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 |
-KeyData
Specifies a SSH RSA public key data.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Path
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.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VirtualMachineScaleSet
Specifies the VMSS object. You can use the New-AzVmssConfig cmdlet to create the object.
Type: | PSVirtualMachineScaleSet |
Position: | 0 |
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: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Outputs
Related Links
Azure PowerShell