Azure-pipelines-tasks: Using Generic Service Connection from Bash task

Created on 25 Oct 2019  路  6Comments  路  Source: microsoft/azure-pipelines-tasks

Question, Bug, or Feature?
Type: Question

Enter Task Name: Bash

Environment

  • Server - Azure Pipelines

  • Agent - Hosted (Azure Pipelines)

Issue Description

I'm looking for documenation on how to use a Generic Service Connection from within a Bash script. I want to connect to web services managed by my own organization and integrate with them during pipelines. It seems like Generic Service Connection could be perfect for just storing simple URL and credentials and would allow me to safely secure and control access to our internal services from pipeline jobs. However, I can't seem to locate any documentation or information on how to use a Generic Service Connection" from my own bash script. Essentially, I want to access the URL and credentials so I can issue requests.

Can you point me in the right direction or offer any advice?

Core question

All 6 comments

Just wondering if there is any examples or documentation you could point me to. Or let me know if my understanding and expectations are off.

Is there anyway to use a service connection as a pipeline variable? Trying to wrap a taskgroup with a deploy database and deploy service fabric service that takes in a variable for the service connection.

Any ideas?

@camp-007 - Sorry for the delay in responding to you. In order to use a service connection in a task, a task has to have an input that is defined as a "generic service connection" type. The bash task does not have such an input.

If you want to do this, you would have to write a custom task (https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops).

Closing this issue after answering question and no follow up questions.

Hi! I tried create task extension. Defined type as 'generic service connection', but it is not worked.

  "inputs": [
    {
      "name": "credentials",
      "type": "generic service connection",
      "label": "generic service connection",
      "defaultValue": "",
      "required": true,
      "helpMarkDown": "generic service connection"
    }
  ],

I could not retrieve list of generic service connections in my pipeline

I found solution
Need use
"type":"connectedService:Generic"
I've created simple extension:
https://github.com/flamencist/GenericConnectionViewer

Was this page helpful?
0 / 5 - 0 ratings