New-AzureSSHKey
Syntax
New-AzureSSHKey
[-KeyPair]
[-Fingerprint] <String>
[-Path] <String>
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
New-AzureSSHKey
[-PublicKey]
[-Fingerprint] <String>
[-Path] <String>
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Description
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 New-AzureProvisioningConfig when creating the configuration object for a new virtual machine using New-AzureVM, or when creating a new virtual machine with New-AzureQuickVM. When included as part of a virtual machine creation script, this adds the specified SSH Public Key or Key Pair to the new virtual machine.
Examples
Example 1: Create a certificate setting object
PS C:\> $myLxCert = New-AzureSSHKey -Fingerprint "D7BECD4D63EBAF86023BB4F1A5FBF5C2C924902A" -Path "/home/username/.ssh/authorized_keys"
This command creates a certificate setting object for an existing certificate and then stores the object in a variable for later use.
Example 2: Add a certificate to a service
PS C:\> Add-AzureCertificate -ServiceName "MySvc" -CertToDeploy "C:\temp\MyLxCert.cer"
$myLxCert = New-AzureSSHKey ?Fingerprint "D7BECD4D63EBAF86023BB4F1A5FBF5C2C924902A" -Path "/home/username/.ssh/authorized_keys"
New-AzureVMConfig -Name "MyVM2" -InstanceSize Small -ImageName $LxImage `
| Add-AzureProvisioningConfig -Linux -LinuxUser $lxUser -SSHPublicKeys $myLxCert -Password 'pass@word1' `
| New-AzureVM -ServiceName "MySvc"
This command adds a certificate to an Azure service, and then creates a new Linux virtual machine that uses the certificate.
Required Parameters
Specifies the fingerprint of the certificate.
| Type: | String |
| Position: | 1 |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies that this cmdlet creates an object for inserting an SSH Key Pair into the new virtual machine configuration.
| Type: | SwitchParameter |
| Position: | 0 |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies the path to store the SSH Public Key or Key Pair.
| Type: | String |
| Position: | 2 |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies that this cmdlet creates an object for inserting an SSH Public Key into the new virtual machine configuration.
| Type: | SwitchParameter |
| Position: | 0 |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Optional Parameters
Specifies how this cmdlet responds to an information event.
The acceptable values for this parameter are:
- Continue
- Ignore
- Inquire
- SilentlyContinue
- Stop
- Suspend
| Type: | ActionPreference |
| Aliases: | infa |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies an information variable.
| Type: | String |
| Aliases: | iv |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |