In Linux and MacOS, the following environment variables are available to scripts executed in an AzurePowerShell task:
AZURESUBSCRIPTION_SERVICE_CONNECTION_ID
AZURESUBSCRIPTION_CLIENT_ID
AZURESUBSCRIPTION_TENANT_ID
However, on a Windows agent executing the exact same script, only one variable is available:
AZURESUBSCRIPTION_SERVICE_CONNECTION_ID
I would expect to have the client and tenant id also available given that they are available in the Linux/MacOS agents.
This appears to be caused by the fact that the tasks execute differently depending on the platform and the Windows-specific code does not set those environment variables the way that the Linux/MacOS code does.
The Windows-specific code does clear the environment variables (which aren't set) at the end of execution.
Environment type (Please select at least one enviroment where you face this issue)
New issue checklist
Task name
AzurePowerShell@5
Task version
5.241.0
Issue Description
In Linux and MacOS, the following environment variables are available to scripts executed in an
AzurePowerShell
task:However, on a Windows agent executing the exact same script, only one variable is available:
I would expect to have the client and tenant id also available given that they are available in the Linux/MacOS agents.
This appears to be caused by the fact that the tasks execute differently depending on the platform and the Windows-specific code does not set those environment variables the way that the Linux/MacOS code does.
The Windows-specific code does clear the environment variables (which aren't set) at the end of execution.
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows 2022, Windows 2019
Relevant log output
Linux (expected output):
Windows 2019 (note empty strings where valid values are expected):
Windows 2022 (note empty strings where valid values are expected):