Azure DevOps Pipelines: Environment Variables Not Available in dotnet test Command
I'm using Azure DevOps and have an AzureCLI task set up to run integration tests with the
dotnet test
command. I'm encountering an issue where environment variables set in the task do not seem to be available when dotnet test
is executed.
Here is the relevant part of my pipeline configuration:
The variables like TENANT_ID are set using ##vso[task.setvariable] and also attempted to be set in the script's session scope using $env: for use in the same script. However, these variables do not seem to be accessible or correctly passed to the dotnet test command.
What could be causing this issue, and how can I ensure that these environment variables are correctly passed to and accessible by the dotnet test command within the same Azure CLI task?2 Replies
Please note, I require the dotnet test to be inside of the AzureCLI@2 task, to make use of the new AzurePipelinesCredential from the Azure Identity SDK
are you sure you're passing in tenantId correctly? maybe try printing it out in the script.