Build | Beta | Live |
---|---|---|
An Azure DevOps Extension that allows scripts to use a Service Connection! Currently supports Bash and PowerShell.
See the Overview document
An Azure DevOps extension that lets you use a Service Connection with a shell script!
Home Page: https://marketplace.visualstudio.com/items?itemName=cloudpup.authenticated-scripts
License: Other
Build | Beta | Live |
---|---|---|
An Azure DevOps Extension that allows scripts to use a Service Connection! Currently supports Bash and PowerShell.
See the Overview document
i can only adopt a task that has a changelog per policy, i'd probably make use of this if i could sync the rss of github releases to our system
I'm trying to figure out how to pass in environment variables in a similar fashion to the official pwsh/bash tasks available in Azure DevOps. For example:
- pwsh: Write-Host $env:SOMEVAR
env:
SOMEVAR: example
I was looking at the task.json
of the official tasks and they don't explicitly have an input for the environment variable mapping, there's simply "showEnvironmentVariables": true
, which is what this repo appears to use as well.
I tried to do this with the authenticated scripts task and got the "mapping was not expected error" where I tried to define the env
mapping.
- task: AuthenticatedPowerShell@1
inputs:
serviceConnection: generic-service-connection
targetType: inline
script: |
Write-Host $env:SOMEVAR
env:
SOMEVAR: example
My use case here is that I'm trying to use the AuthenticatedPowerShell
task in a YAML template that would be consumed by many pipelines, but I'd like to have a parameter available in the template that would allow pipelines to pass in custom environment variables for the script on an as-needed basis. I might be able to parse the parameter and set environment vars within the pwsh script it self, but though this would be cleaner and easier.
I'd be happy to make a PR but I can't quite figure out what is needed. Any thoughts? Love the extension otherwise, thanks for putting it together ❤️
Does this extension make use of the existing Azure DevOps script tasks or does it duplicate the code?
I really like this extension and think it would be very useful. My only concern is if it is duplicating the existing Azure DevOps tasks.
If the existing Azure DevOps PowerShell and Script tasks get updated will this extension get those updates or will we have to wait for this extension to update it's code to match what the Azure DevOps tasks are?
While playing around with my fork, I noticed that the task for Powershell scripts executes them with Powershell 7 (pwsh.exe) on a Windows runner.
The following implicates that this should only happen when the pwsh
parameter is true.
authenticated-scripts/tasks/powershell/task.json
Lines 121 to 129 in 86b99c2
I believe this is a bug that was copied over from https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/PowerShellV2/powershell.ts, since both that logic and https://github.com/cloudpups/authenticated-scripts/blob/main/tasks/powershell/execute-cli.ts do not make use of the pwsh
parameter. The Microsoft task is not affected by that bug, because it uses https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/PowerShellV2/powershell.ps1 when the task is executed on a Windows runner. That script considers the pwsh
parameter.
I made a change on my fork to address that issue, but it would require some additional work to bring it over to this repo (mainly to add logic to check if the task is running on Windows or not).
If there is interest for that, I can try creating a pull request.
I have found this task extremely useful - thanks so much for developing it!
I did have a question though. As I am using on-prem build agents, not all of the servers have NPM installed. This causes the task to fail on those servers. I was wondering if NPM is actually necessary demand for this task to execute? I'm definitely no expert, but thought it might be more of a design time thing as don't these sorts of tasks ultimately produced javascript at the end of the day?
Anyway, it would be great if the NPM dependency could be removed from the following powershell task (and I spose from the bash task as well):
https://github.com/cloudpups/authenticated-scripts/blob/main/tasks/powershell/task.json#:~:text=%22-,npm,-%22
Hi there,
I've just installed this extension (Azure DevOps Services), and when using both "Authenticated Powershell" and "Authenticated Bash", the Service Connection select input is empty ("No results found"). I've tried refreshing the input, and can confirm that other tasks in the job are able to access the list of Service Connections from their equivalent menus. Am I doing something wrong here?
Thanks!
Chris.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.