Skip to content

Commit 62f57ea

Browse files
EshitaDv-schhabra
andauthored
Adding the AZUREPS_HOST_ENVIRONMENT variable to telemetry. (#20898)
* Adding AZUREPS_HOST_ENVIRONMENT telemetry * Reorder parameters --------- Co-authored-by: v-schhabra <[email protected]>
1 parent 9e83b9a commit 62f57ea

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

Tasks/AzurePowerShellV5/AzurePowerShell.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ $input_pwsh = Get-VstsInput -Name pwsh -AsBool -Default $false
1414
$input_workingDirectory = Get-VstsInput -Name workingDirectory -Require
1515
$validateScriptSignature = Get-VstsInput -Name validateScriptSignature -AsBool
1616

17+
$hostEnv = "ADO/AzurePowerShell@v5`_$($env:AGENT_OS)`_$($env:AGENT_NAME)`_$($env:BUILD_DEFINITIONNAME)`_$($env:BUILD_BUILDID)`_$($env:RELEASE_DEFINITIONNAME)`_$($env:RELEASE_RELEASEID)"
18+
$env:AZUREPS_HOST_ENVIRONMENT = $hostEnv
19+
Write-Host "AZUREPS_HOST_ENVIRONMENT: $env:AZUREPS_HOST_ENVIRONMENT"
20+
1721
# Validate the script path and args do not contains new-lines. Otherwise, it will
1822
# break invoking the script via Invoke-Expression.
1923
if ($scriptType -eq "FilePath") {

Tasks/AzurePowerShellV5/azurepowershell.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ async function run() {
1515
let input_workingDirectory = tl.getPathInput('workingDirectory', /*required*/ true, /*check*/ true);
1616
let tempDirectory = tl.getVariable('agent.tempDirectory');
1717
tl.checkPath(tempDirectory, `${tempDirectory} (agent.tempDirectory)`);
18+
19+
const env = process.env;
20+
const hostEnv = `ADO/AzurePowerShell@v5_${env.AGENT_OS || ""}_${env.AGENT_NAME || ""}_${env.BUILD_DEFINITIONNAME || ""}_${env.BUILD_BUILDID || ""}_${env.RELEASE_DEFINITIONNAME || ""}_${env.RELEASE_RELEASEID || ""}`;
21+
22+
process.env.AZUREPS_HOST_ENVIRONMENT = hostEnv;
23+
console.log(`AZUREPS_HOST_ENVIRONMENT: ${hostEnv}`);
24+
1825
try {
1926
tl.setResourcePath(path.join(__dirname, 'task.json'));
2027

Tasks/AzurePowerShellV5/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"version": {
1919
"Major": 5,
2020
"Minor": 254,
21-
"Patch": 0
21+
"Patch": 1
2222
},
2323
"releaseNotes": "Added support for Az Module and cross platform agents.",
2424
"groups": [

Tasks/AzurePowerShellV5/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"version": {
1919
"Major": 5,
2020
"Minor": 254,
21-
"Patch": 0
21+
"Patch": 1
2222
},
2323
"releaseNotes": "ms-resource:loc.releaseNotes",
2424
"groups": [

0 commit comments

Comments
 (0)