Skip to content

set-teamsfx-env does not expand variables #15135

@jmservera

Description

@jmservera

Describe the bug
I'm using a script to gather the current user principal to send it to the bicep template like this:

  - uses: script
    name: set environment variables
    with:
      run: $AZURE_PRINCIPAL_ID=(az ad signed-in-user show --query id -o tsv);
        echo "::set-teamsfx-env
        AZURE_PRINCIPAL_ID=${AZURE_PRINCIPAL_ID}"

When I run it I can see in the output the correct ID:

*  Executing task: $AZURE_PRINCIPAL_ID=(az ad signed-in-user show --query id -o tsv); echo $AZURE_PRINCIPAL_ID; echo "::set-teamsfx-env AZURE_PRINCIPAL_ID=${AZURE_PRINCIPAL_ID}" 

::set-teamsfx-env
AZURE_PRINCIPAL_ID=ee******-****-****-****-********46e9
 *  Terminal will be reused by tasks, press any key to close it. 

But then, in the .env.dev file, the unexpanded value is stored:

AZURE_PRINCIPAL_ID=${AZURE_PRINCIPAL_ID}

To Reproduce
Steps to reproduce the behavior:

  1. Write a script
  2. Store a value inside a script variable (ex: $VAR="value")
  3. Use echo "::set-teamsfx-env ..." to write the variable to the environment
  4. See the unexpanded variable in the .env.dev file

Expected behavior
Write expanded value into the .env file

VS Code Extension Information (please complete the following information):

  • OS: Windows
  • Version 6.4.2

CLI Information (please complete the following information):

  • OS: Windows
  • Version [e.g. 22]

Additional context

Script is running on powershell

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions