Skip to content

Commit fb59bfc

Browse files
authored
Merge pull request #116681 from cynthn/patch-395
Update mac-create-ssh-keys.md
2 parents 2c0d454 + 8c2a7fc commit fb59bfc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

articles/virtual-machines/linux/mac-create-ssh-keys.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ ssh-rsa AAAAB3NzaC1yc2EAABADAQABAAACAQC1/KanayNr+Q7ogR5mKnGpKWRBQU7F3Jjhn7utdf7Z
6161

6262
If you copy and paste the contents of the public key file to use in the Azure portal or a Resource Manager template, make sure you don't copy any trailing whitespace. To copy a public key in macOS, you can pipe the public key file to `pbcopy`. Similarly in Linux, you can pipe the public key file to programs such as `xclip`.
6363

64-
The public key that you place on your Linux VM in Azure is by default stored in ~/.ssh/id_rsa.pub, unless you specified a different location when you created the key pair. To use the [Azure CLI 2.0](/cli/azure) to create your VM with an existing public key, specify the value and optionally the location of this public key using the [az vm create](/cli/azure/vm#az-vm-create) command with the `--ssh-key-values` option. In the following command, replace *VMname*, *RGname*, and *keyFile* with your own values:
64+
The public key that you place on your Linux VM in Azure is by default stored in ~/.ssh/id_rsa.pub, unless you specified a different location when you created the key pair. To use the [Azure CLI 2.0](/cli/azure) to create your VM with an existing public key, specify the value and optionally the location of this public key using the [az vm create](/cli/azure/vm#az-vm-create) command with the `--ssh-key-values` option. In the following command, replace *myVM*, *myResourceGroup*, *UbuntuLTS*, *azureuser*, and *mysshkey.pub* with your own values:
65+
6566

6667
```azurecli
67-
az vm create --name VMname --resource-group RGname --ssh-key-values mysshkey.pub
68+
az vm create \
69+
--resource-group myResourceGroup \
70+
--name myVM \
71+
--image UbuntuLTS \
72+
--admin-username azureuser \
73+
--ssh-key-values mysshkey.pub
6874
```
6975

7076
If you want to use multiple SSH keys with your VM, you can enter them in a space-separated list, like this `--ssh-key-values sshkey-desktop.pub sshkey-laptop.pub`.

0 commit comments

Comments
 (0)