https://pulumi.com logo
Title
s

some-flower-64874

05/07/2021, 12:08 PM
Getting
pulumi stack output
in a file using the Azure DevOps Pipeline task We need to do some post processing using the stack output on azure devops. I want to do this with a service connection to avoid having to worry about secrets. If I run pulumi using the azure CLI task I'm getting an error relating to connecting to the blob container that's used for the pulumi back end. This is notionally easy to fix, run
pulumi stack output --json
using the pulumi task (which I know will work because
pulumi up
works) capturing the output to a file that I can then feed into the powershell that does the things we can't currently do with pulumi. Except I can't capture the output 😢 Open to suggestions at this point (before I put a feature request in to add --output to the CLI)
q

quiet-architect-74241

05/07/2021, 12:59 PM
What error are you getting? Did you add the PULUMI_ACCESS_TOKEN as an environment variable to you Azure CLI task? This works for me:
- bash: |
    pulumi stack select $(stack) --cwd $(pulumiFolder)
    pulumi stack output -j --cwd $(pulumiFolder)
  env: 
    PULUMI_ACCESS_TOKEN: $(pulumi.access.token)
s

some-flower-64874

05/07/2021, 1:10 PM
There is no pulumi access token as I'm using an azure blob container for the back end. If I had an access token the problem wouldn't exist because there'd be no confusion between the SP settings for running the script and settings for the connection to the container.
However I do have an answer - I can do a pulumi stack export to a file and since the export contains the outputs for the stack I can pull those out of the json without much effort (powershell is a wonderful thing at times) I'm potentially sorted
pulumi stack output still needs a --file option though
👍 1