We are using powershell to do some deployment tasks in the target environment(e.g. a VM). However, it seems the script does not have access to the system environment variables, as well as other programs run by the script. So far, it only has access to the variables defined in the pipeline.
Also, inside the .NET program run by that script, we have:
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", EnvironmentVariableTarget.Machine);
but it still does not have access to the desired environment variable.
Is there a way we can allow the pipeline script to access the system variable? Or, do we have to define a stage-scoped pipeline variable and make it consistent with the targeting machine's system variable?
Thanks.
Get-ChildItem Env:
to check out your availableenv:variables
? – Mar Tin$format = "yyyyMMdd_HHmmss"; $date = Get-Date; Write-Host "##vso[task.setvariable variable=Timestamp]$($date.ToString($format))"
inside a pipeline task? (example definition, no relation to your question) – Mar Tin