Created
July 28, 2020 16:05
-
-
Save GuyPaddock/c2abaa978450e867e7513f5833f53fec to your computer and use it in GitHub Desktop.
Azure Kubernetes Service (AKS) reset SSH key of azureuser account on nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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