New-AzureSSHKey

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

New-AzureSSHKey

Creates a SSH Key object to insert an existing certificate into new Linux-based Azure virtual machines.

Syntax

Parameter Set: keypair
New-AzureSSHKey [-KeyPair] [-Fingerprint] <String> [-Path] <String> [ <CommonParameters>]

Parameter Set: publickey
New-AzureSSHKey [-PublicKey] [-Fingerprint] <String> [-Path] <String> [ <CommonParameters>]

Detailed Description

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

The New-AzureSSHKey cmdlet creates an SSH Key object for a certificate that has already been added to Azure. This SSH Key object can then be used by the Add-AzureProvisioningConfig cmdlet when creating the configuration object for a new virtual machine using either the New-AzureVM or New-AzureQuickVM cmdlet. When included as part of a script to create a virtual machine creation, this cmdlet adds the specified SSH Public Key or Key Pair to the new virtual machine.

Parameters

-Fingerprint<String>

Specifies the fingerprint of the certificate.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-KeyPair

When specified, creates an object for inserting an SSH key pair into the new virtual machine configuration.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Path<String>

Specifies the path to store the SSH public key or key pair.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PublicKey

When specified, creates an object for inserting an SSH Public Key into the new virtual machine configuration.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1

This command creates a certificate setting object for an existing certificate and then stores the object in a variable for later use.

C:\PS> $myLxCert = New-AzureSSHKey –Fingerprint "D7BECD4D63EBAF86023BB4F1A5FBF5C2C924902A" –Path "/home/username/.ssh/authorized_keys" 

Example 2

This command adds a certificate to the Azure service, and then creates a new Linux virtual machine that uses the certificate.

C:\PS> Add-AzureCertificate –ServiceName "MySvc" –CertToDeploy "C:\temp\MyLxCert.cer"
C:\PS> $myLxCert = New-AzureSSHKey –Fingerprint "D7BECD4D63EBAF86023BB4F1A5FBF5C2C924902A" –Path "/home/username/.ssh/authorized_keys"
C:\PC>New-AzureVMConfig -Name "MyVM2" -InstanceSize Small -ImageName $LxImage `
 | Add-AzureProvisioningConfig -Linux -LinuxUser $lxUser -SSHPublicKeys $myLxCert -Password 'pass@word1' `
 | New-AzureVM -ServiceName "MySvc"

Add-AzureProvisioningConfig

New-AzureVMConfig

New-AzureVM

New-AzureQuickVM