LinuxCommandLibrary

az-sshkey

Manage SSH keys for Azure resources

TLDR

Create a new SSH key

$ az sshkey create --name [name] [[-g|--resource-group]] [resource_group]
copy

Upload an existing SSH key
$ az sshkey create --name [name] [[-g|--resource-group]] [resource_group] --public-key "[@path/to/key.pub]"
copy

List all SSH public keys
$ az sshkey list
copy

Show information about an SSH public key
$ az sshkey show --name [name] [[-g|--resource-group]] [resource_group]
copy

SYNOPSIS

az-sshkey [--resource-group <RG>] {create|list|show|delete} [--name <keyname>] [--public-key <path>] [--subscription <ID>] [--output <json|table>]

PARAMETERS

--resource-group, -g
    Name of the resource group containing the SSH key resource

--name, -n
    Name of the SSH key

--public-key, --ssh-key-value
    Path or content of the public SSH key

--subscription
    Subscription ID to operate on

--location
    Azure region for key storage

--output, -o
    Output format (json, table, tsv, yaml)

--query
    JMESPath query string for output filtering

create|list|show|delete
    Subcommands for CRUD operations on SSH keys

DESCRIPTION

The az-sshkey command is not a standard core Linux utility but appears associated with the Azure Command-Line Interface (CLI), potentially from extensions or custom tooling for managing SSH public keys in Azure environments. It facilitates creating, retrieving, updating, or deleting SSH keys used for secure access to Azure Virtual Machines (VMs), Kubernetes clusters (AKS), or other resources. Unlike native Linux tools like ssh-keygen, it integrates with Azure Resource Manager (ARM) for cloud-native key storage and retrieval, often linking to Key Vault or VM configurations. Usage typically requires authentication via az login. Common workflows include generating keys during VM provisioning or listing keys for troubleshooting access issues. Note that core Azure CLI handles SSH keys via parameters in commands like az vm create --ssh-key-values, suggesting az-sshkey may be deprecated, experimental, or third-party. Verify with az --version and extensions list.

CAVEATS

Not a core Linux command; requires Azure CLI installation (>=2.0). May not exist in all versions or require extensions like az extension add --name ssh. Keys managed here are Azure-specific and not local filesystem. Use ssh-keygen for local keys.

AUTHENTICATION

Requires az login or service principal. Use --service-principal for automation.

EXAMPLES

az-sshkey create -g myRG -n myKey --public-key ~/.ssh/id_rsa.pub --location eastus
az-sshkey list -g myRG

HISTORY

Introduced in Azure CLI evolutions post-2018 for streamlined IaC; tied to ARM templates and Terraform integrations. Usage peaked with AKS and VM scale sets adoption.

SEE ALSO

ssh-keygen(1), ssh-add(1), ssh-copy-id(1), az(1), az-vm(1)

Copied to clipboard