New-AzSshKey

Create a SSH Public Key resource.

Syntax

New-AzSshKey
   -ResourceGroupName <String>
   -Name <String>
   [-PublicKey <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Create a SSH Public Key resource.

Examples

Example 1

New-AzSshKey -ResourceGroupName "testRG" -Name "sshkey1" -PublicKey $publicKey

Creating a SSH Key resource with provided a public key.

Example 2

New-AzSshKey -ResourceGroupName "testRG" -Name "sshkey1"

Creating a SSH Key resource without providing a public key. A key pair will be generated and saved in ~.ssh. The public key will also be saved in the SSH Key resource.

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

-Name

Specifies the name of the Ssh Public Key resource to get.

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

-PublicKey

Public Key value.

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

-ResourceGroupName

Specifies the name of a resource group.

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

-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

String

Outputs

PSSshPublicKeyResource