I have several powershell scripts that run in a build pipeline in Azure DevOps. The scripts uses variable groups and run on a self hosted agent (Windows server 2016)
I want to change the agents so that the scripts are going to run on a Linux container agent. I have setup the Linux container agent as an Container instance in Azure and changed the powershell scripts. The container agent has the powershell core module and additional modules installed. In my script I can use the files that are in my repository. Everything works except for one thing, the variable groups.
With the previous agent all I had to do in my script is use $env: to get access to the variable from the variable groups, for example:
$NewAccount = $env:Account
but this does not work with the Linux container agent. I've tried several things like:
$NewAccount = [Environment]::Account
$NewAccount = $(Account)
$($env:Account)
("##vso[task.setvariable variable=Account;]$Account")
but it doesn't work. I have to do something different for the Linux container agent but I don't know what needs to be changed or added