Skip to content

Instantly share code, notes, and snippets.

@GuyPaddock
Created July 28, 2020 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GuyPaddock/c2abaa978450e867e7513f5833f53fec to your computer and use it in GitHub Desktop.
Save GuyPaddock/c2abaa978450e867e7513f5833f53fec to your computer and use it in GitHub Desktop.
Azure Kubernetes Service (AKS) reset SSH key of azureuser account on nodes
#!/usr/bin/env bash
##
# Update the SSH key for the azureuser account on the specified AKS node.
#
cluster_resource_group="${1:-}"
node="${2:-}"
public_key_path="${3:-}"
AZURE_USER="azureuser"
if [[ -z "${cluster_resource_group}" || -z "${node}" || -z "${public_key_path}" ]]; then
{
echo "Usage: ${0} <cluster resource group> <node name> <public key path>"
echo ""
} >&2
exit 1
fi
az vm user update \
--resource-group "${cluster_resource_group}" \
--name "${node}" \
--username "${AZURE_USER}" \
--ssh-key-value "${public_key_path}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment