Retrieve environment variable values dynamically in pipeline

I have the following code in a bash script running through a bitbucket pipeline that is not being set to the correct secure value. 

declare -n -x -g AZURE_STORAGE_ACCESS_KEY="AZURE_STORAGE_ACCESS_KEY_${__ENVIRONMENT^^}"

When I later run the azure CLI that uses the AZURE_STORAGE_ACCESS_KEY env, variable I get an error:

az storage blob upload: error: Storage account 'AZURE_STORAGE_ACCOUNT_QA' not found.

It appears that atlassian has code that strips secured env. variable values for security reasons and is doing so in this case.

Our setup is that we will have env. vars setup on a per environment basis and we need to dynamically grab the correct one during execution of the pipeline, however the value is being stripped by atlassian.

AZURE_STORAGE_ACCESS_KEY_DEV

AZURE_STORAGE_ACCESS_KEY_QA

AZURE_STORAGE_ACCESS_KEY_PROD

 

What linux command will allow me to accomplish this task without the secure value being stripped?

0 answers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,621 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you