azure-devopsenvironment-variablesautomated-testsazure-pipelines

Issue with Replacing Password Variables in Azure DevOps Pipeline


I have a YAML project file that contains the configuration for my data testing tool, CAT.

Part of this configuration includes connection strings to Power BI reports, which contain the data I am testing. I use variables for many parts of the connection strings, including the user password, like this:

yaml_projecktfile

I have set up the passwords in the Azure DevOps Library for the classic pipeline and all variables are being replaced correctly except for the password variable. The error message indicates that the agent cannot find it.

Pipeline code: pipeline_code

Error message: error msg

Varibales set up: variables_setup

I’m unsure what might be causing the issue with the JUST password variable replacement.

Can anyone help me troubleshoot this problem?


Solution

  • Based on your connection strings content and the error message, the connection string is reading the Environment Variables from Pipeline and the Secret Password Variable not be read.

    The cause of the issue can be that the Secret variables are not written to the pipeline environment variables by default.

    To use the secret variable in Azure Pipeline, you need to explicitly map secret variables.

    For example: You can add the env field in the task definition to map secret variable.

    - task: PowerShell@2
      inputs:
        filePath: 'filename'
      env:
        PBIServicePrincipalPassword: $(PBIServicePrincipalPassword)
    

    For more detailed info, you can refer to the doc: Set secret variables