3

How can I add a new SSH service connection using a build pipeline in Azure DevOps? I would like to specify the username ip and key and grant access to all pipelines

SSH service connection using the pipeline. Didnt get any results to do this!

1 Answer 1

0

As far as I know. It is not possible to automate creating an SSH service connection.

Normally Microsoft offers az devops service-endpoint command line to create a service connection for azure resource manager or GitHub. But does not offer SSH creation. If someone else can show something else I will remove my answer.


Original answer:

From your project setting, click on Service connections, and search for SSH

enter image description here

You can add the parameter for your ssh and then at the end check Grant access permission to all pipelines:

enter image description here

With that said there is an example of Azure pipeline connect to an ssh server and then copy files into it

Sign up to request clarification or add additional context in comments.

8 Comments

I want to automate this using a build pipeline. not from the ui
It is not possible, check my answer update. Please make your question more clear.
ok. then is there any way to build a ssh conenction and run a script directly from pipeline using the command line module? meaning run the ssh command providing the keys and required details and run a specific script on the remote machine?
you can always run a customized script either in PowerShell or Bash script, I have not tried it for SSH. So it is a matter of trying until you get it to work.
I've added a bash script module and added ssh command sudo ssh -t -t -i ~/.ssh/id_rsa ec2-user@ip sudo mkdir /home/ec2-user/test .. The pipeline is able to login as it shows last login as an output after running pipeline. After that it hangs, nothing happens further
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.