# Complying with azurepipelines:S8263 when env vars aren't transmitted

**URL:** <https://community.sonarsource.com/t/complying-with-azurepipelines-s8263-when-env-vars-arent-transmitted/183380>\
**Category:** Report False-positive / False-negative...\
**Created:** [June 9, 2026, 8:46am UTC](https://community.sonarsource.com/t/complying-with-azurepipelines-s8263-when-env-vars-arent-transmitted/183380 "2026-06-09T08:46:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kckmzx](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/kckmzx/32/76526_2.png) [@kckmzx](https://community.sonarsource.com/u/kckmzx)\
**Post date:** [June 9, 2026, 8:46am UTC](https://community.sonarsource.com/t/complying-with-azurepipelines-s8263-when-env-vars-arent-transmitted/183380/1 "2026-06-09T08:46:15Z")

</div>

Hi

I try to comply with the rule **azurepipelines:S8263**. Here is my task:

```yaml
variables:
- name: system.debug
  value: $(SystemDebug)
- template: /.azuredevops/azure-pipelines/variables/deployment.yaml

- task: PowerShellOnTargetMachines@3
  displayName: 'Stop App scheduled task and process'
  inputs:
    Machines: 'MyMachineName'
    InlineScript: |
      $taskName = '${{ variables.scheduledTaskName }}'
      $processName = '${{ variables.deploymentProcessName }}'
      
      Stop-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue | Out-Null
      
      $processes = Get-Process -Name $processName -ErrorAction SilentlyContinue     
      Write-Host "Stopping process '$processName'..."
      $processes | Stop-Process -Force
      
      Write-Host "Process stop completed."
    CommunicationProtocol: 'Http'

```

In a template file, I have my variables:

```yaml
variables:
- name: deploymentProcessName
  value: 'MyProcess'
- name: scheduledTaskName
  value: 'MySchedTask'

```

According to the rule, I should use environment variables with `env`, but it doesn’t work. The environment variables do not seem to be transmitted on another machine with the `PowerShellOnTargetMachines` task.

What can I do to fix this ?

* * *

Version : SonarQube Server Developer Edition (2026.3.1)  
Deployment : Docker

---

<div class="post-metadata">

**Author:** ![daniel\_teuchert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/daniel_teuchert/32/49255_2.png) [@daniel\_teuchert](https://community.sonarsource.com/u/daniel_teuchert)\
**Post date:** [June 16, 2026, 9:16am UTC](https://community.sonarsource.com/t/complying-with-azurepipelines-s8263-when-env-vars-arent-transmitted/183380/4 "2026-06-16T09:16:56Z")

</div>

Hi!  
Thank you for your feedback.  
Indeed, for the `PowerShellOnTargetMachines@3` task, the suggested `env` approach won’t work. The `env` block only affects the host agent starting the task, not the remote target machine where the PowerShell script actually executes.

For remote or non-shell tasks like this, we recommend using an **allowlist of permitted values** instead.

I will create a ticket to improve the rules description so that it is more clear that `PowerShellOnTargetMachines@3` needs to be treated different than other shell tasks.

Thanks again for helping us improve!

---

<div class="post-metadata">

**Author:** ![daniel\_teuchert](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/daniel_teuchert/32/49255_2.png) [@daniel\_teuchert](https://community.sonarsource.com/u/daniel_teuchert)\
**Post date:** [June 16, 2026, 11:33am UTC](https://community.sonarsource.com/t/complying-with-azurepipelines-s8263-when-env-vars-arent-transmitted/183380/6 "2026-06-16T11:33:18Z")

</div>

One more follow up:  
I only noticed now that in your template file you are actually using hard-coded values so in this case there is actually no risk and the issue raised is a false positive.

Currently we are not processing these template files correctly. I will create a separate ticket to prevent such false positives in the future.

Best,  
Daniel

---

<div class="post-metadata">

**Author:** ![kckmzx](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/kckmzx/32/76526_2.png) [@kckmzx](https://community.sonarsource.com/u/kckmzx)\
**Post date:** [June 18, 2026, 10:04am UTC](https://community.sonarsource.com/t/complying-with-azurepipelines-s8263-when-env-vars-arent-transmitted/183380/9 "2026-06-18T10:04:55Z")

</div>

Thank you for your response, it confirms my suspicions.

Best,

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/78532_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [June 26, 2026, 12:18pm UTC](https://community.sonarsource.com/t/complying-with-azurepipelines-s8263-when-env-vars-arent-transmitted/183380/11 "2026-06-26T12:18:30Z")

</div>

Closed on June 26, 2026, 12:18pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
