The az sshkey command is part of the azure-cli tool, which is the official Command-Line Interface (CLI) provided by Microsoft for managing Azure resources and services.
The az sshkey command allows you to manage SSH public keys for virtual machines in Azure. SSH (Secure Shell) keys are used for secure authentication and access to virtual machines. Here’s an overview of its functionality:
- SSH Key Creation: With the az sshkey create subcommand, you can create an SSH key pair, consisting of a public key and a private key. The public key is uploaded to Azure and associated with a specific virtual machine. The private key is retained on your local machine and used for authentication when connecting to the virtual machine.
- SSH Key Listing: The az sshkey list subcommand provides a list of SSH public keys associated with virtual machines in your Azure subscription. This allows you to view the key names, virtual machine names, and resource groups where the keys are deployed.
- SSH Key Deletion: Using the az sshkey delete subcommand, you can remove an SSH public key from a virtual machine. This disassociates the key from the virtual machine, preventing further authentication using that key.
- SSH Key Updating: The az sshkey update subcommand allows you to update the properties of an SSH public key associated with a virtual machine. You can change the key’s name, resource group, and virtual machine association.
SSH keys are widely used for secure authentication and access management in the Linux and Unix ecosystem. By managing SSH keys with the az sshkey command, you can control the authorized access to your Azure virtual machines.
az sshkey Command Examples
1. Create a new SSH key:
# az sshkey create --name name --resource-group resource_group
2. Upload an existing SSH key:
# az sshkey create --name name --resource-group resource_group --public-key "@path/to/key.pub"
3. List all SSH public keys:
# az sshkey list
4. Show information about an SSH public key:
# az sshkey show --name name --resource-group resource_group