This cheatsheet provides essential commands for configuring SSH integration with Active Directory and performing certificate-based logins, making authentication seamless for DevOps professionals.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Example using Azure CLI for AD extension:
az ad user update --id <userPrincipalName> --set sshPublicKey="$(cat ~/.ssh/id_rsa.pub)"
Edit your SSH config file:
Host myadhost
HostName <hostname>
User <username>
IdentityFile ~/.ssh/id_rsa
ssh myadhost
ssh -i /path/to/cert.pem <username>@<hostname>
Using PuTTYgen:
puttygen cert.pem -o cert.ppk
Example (requires custom scripting or additional modules):
az ad user show --id <userPrincipalName> --query sshPublicKey
az ad user update --id <userPrincipalName> --remove sshPublicKey
ssh -vvv myadhost
Example using ssh-agent:
eval "$(ssh-agent -s)"
ssh-add /path/to/cert.pem
ssh myadhost