Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

New-AzSshKey

Create a SSH Public Key resource.

Syntax

Default (Default)

New-AzSshKey
 -ResourceGroupName <String>
 -Name <String>
 [-PublicKey <String>]
 [-SshKeyType <String>]
 [-Location <String>]
 [-Tag <Hashtable>]
 [-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.

Example 3

New-AzSshKey -ResourceGroupName "testRG" -Name "sshkey1" -Tag @{ Environment = "Production"; Owner = "TeamA" }

Creating a SSH Key resource with tags. A key pair will be generated and saved in ~.ssh. The tags will be applied to the SSH Key resource.

Example 4

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

Creating a SSH Key resource with a specific location. This allows the SSH Key to be created in a different region than the resource group.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

-Location

Specifies the location for the SSH Public Key resource.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Name

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

Parameter properties

Type:String
Default value:None
Supports wildcards:True
DontShow:False
Aliases:sshkeyName

Parameter sets

-PublicKey

Public Key value.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ResourceGroupName

Specifies the name of a resource group.

Parameter properties

Type:String
Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

-SshKeyType

Specify the type of SSH key to generate. Allowed values are 'Ed25519' and 'RSA'.

Parameter properties

Type:String
Default value:None
Accepted values:Ed25519, RSA
Supports wildcards:False
DontShow:False

Parameter sets

-Tag

Resource tags.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

CommonParameters

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

Inputs

String

Outputs

PSSshPublicKeyResource


Feedback

Was this page helpful?