Skip to content

kolosovpetro/azure-pipelines-ssh-playground

Repository files navigation

Azure SSH Playground

Virtual machine SSH connection testing out including run of ansible playbooks

Infra diagram

SSH connect CLI commands

  • ssh -i id_rsa razumovsky_r@74.234.112.155
  • sudo ssh -i id_rsa razumovsky_r@74.234.112.155
  • ssh -i id_rsa pkolosov@74.234.112.155
  • ssh -o StrictHostKeyChecking=no -i id_rsa razumovsky_r@74.234.112.155
  • sudo ssh -o StrictHostKeyChecking=no -i id_rsa razumovsky_r@74.234.112.155

Config paths

  • SSH WSL config is under path: /root/.ssh/config
  • SSH Windows Client config is under path: C:\Users\pkolosov\.ssh

Windows Azure pipelines agent looks for ssh config in folders:

  • debug3: Failed to open file:C:/Users/VssAdministrator/.ssh/config error:2
  • debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2

Windows Github actions agent looks for ssh config in folders:

  • debug3: Failed to open file:C:/Users/runneradmin/.ssh/config error:2
  • debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2

SCP commands

  • sudo scp -i id_rsa_windows ansible_config.yml razumovsky_r@74.234.112.155:C: /Users/razumovsky_r/Desktop/ansible_hotel360_azdo_copy.yml
  • scp -i id_rsa_windows ansible_config.yml razumovsky_r@74.234.112.155:C: /Users/razumovsky_r/Desktop/ansible_hotel360_azdo_copy.yml
  • scp -F "C:/Users/pkolosov/.ssh/config" -i "C:/Users/pkolosov/.ssh/id_rsa_windows" ansible_hotel360.yml razumovsky_r@74.234.112.155:C:/Users/razumovsky_r/Desktop/ansible_hotel360_ssh_windows_copy.yml

Generate SSH keys for Azure Pipelines

  • ssh-keygen -m PEM -t rsa -b 2048
  • ssh-keygen -m PEM -t rsa -b 2048 -f "id_rsa"

Windows Server SSH setup

  • Install OpenSSH server
  • Launch OpenSSH service
  • Make OpenSSH service to startup Automatic
  • Make OpenSSH Authentication Agent start Automatic
  • Launch OpenSSH Authentication Agent service
  • Open NSG port 22 in Azure
  • Open Port 22 in Windows firewall
  • Execute windows_ssh_deploy_key_admin.ps1 script
  • Connect using ssh -o StrictHostKeyChecking=no -i id_rsa razumovsky_r@4.231.216.105

Trello tasks

Windows OpenSSH Reading