Add-PASPublicSSHKey

Add-PASPublicSSHKey

SYNOPSIS

Adds an authorised public SSH key for a specific user in the Vault.

SYNTAX

Add-PASPublicSSHKey [-UserName] <String> [-PublicSSHKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Adding an authorised public SSH key to a vault user allows the user to authenticate to the Vault through PSMP using a corresponding private SSH key.

The “Reset User Passwords” Permission is required in the vault to manage public SSH keys.

The user account used to add the key MUST be in the same Vault Location or higher then the user whose public SSH keys are added.

A user cannot manage their own public SSH keys.

EXAMPLES

EXAMPLE 1

Add-PASPublicSSHKey -UserName keyUser -PublicSSHKey AAAAB3NzaC1kc3MAAACBAJ3hB5SAF6mBXPlZlRoJEZi0KSIN+NU2iGiaXZXi9CDrgVxp6/andonandonandOON==

Adds SSH Key to vault user keyUser

EXAMPLE 2

$Key = Get-Content .\bob_rsa.pub
Add-PASPublicSSHKey -UserName Bob -PublicSSHKey $Key

Reads the contents of a public key file and adds it as an authorized SSH key for vault user Bob.

EXAMPLE 3

Get-PASUser -Search Bob | Add-PASPublicSSHKey -PublicSSHKey "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC..."

Adds a public SSH key for the vault user found by Get-PASUser, with the UserName value supplied via the pipeline.

EXAMPLE 4

Import-Csv .\ssh-keys.csv | Add-PASPublicSSHKey

Adds an authorized public SSH key for each vault user listed in ssh-keys.csv, matching column names to parameters.

PARAMETERS

-UserName

The username of the Vault user whose public SSH keys will be added

A username cannot contain the following characters: “%”, “&”, “+” or “.”.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-PublicSSHKey

The content of the public SSH key as it appears in the authorized_keys file.

The key must not include new lines (‘\n’).

Do not include options such as “command”, as they are not supported when authenticating through PSMP.

This key can only include comments in English.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-WhatIf

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

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

https://pspas.pspete.dev/commands/Add-PASPublicSSHKey

https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/Latest/en/Content/WebServices/Add%20Public%20SSH%20Keys.htm