New-AzSshKey
Create a SSH Public Key resource.
Syntax
Default (Default)
New-AzSshKey
-ResourceGroupName <String>
-Name <String>
[-PublicKey <String>]
[-SshKeyType <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.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-PublicKey
Public Key value.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ResourceGroupName
Specifies the name of a resource group.
Parameter properties
Type: String
Default value: None
Supports wildcards: True
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
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 .
Outputs