tag:help.appveyor.com,2012-11-13:/discussions/suggestions/694-encrypt-filesAppVeyor: Discussion 2018-08-25T02:33:53Ztag:help.appveyor.com,2012-11-13:Comment/370617272015-06-07T20:54:45Z2015-06-07T20:54:45ZEncrypt Files<div><p>Yeah, great suggestion. There is already an item for <a>that: https://github.com/appveyor/ci/issues/261</a></p>
<ul>
<li>Feodor</li>
</ul></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/370617272015-07-01T22:56:15Z2015-07-01T22:56:15ZEncrypt Files<div><p>It's here! I've just published this: <a href="http://www.appveyor.com/docs/how-to/secure-files">http://www.appveyor.com/docs/how-to/secure-files</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/370617272018-08-17T13:53:55Z2018-08-17T13:53:57ZEncrypt Files<div><p>Hi,</p>
<p>I've followed this guideline <a href="http://www.appveyor.com/docs/how-to/secure-files">http://www.appveyor.com/docs/how-to/secure-files</a> to store sensitive information and retrieve it during the build.<br>
I've encrypted the file on my dev machine, tested that I can decrypt and retrieve the original file locally.<br>
However, after setting up Appveyor and running my build, I get an "Error decrypting file. Command exited with code 3".To investigate, I've connected to the build machine and it seems that the environment variable I created for my secret is not present, although I have defined it in the Environment variables section of the project configuration.<br>
Note also that if I execute the command on the build machine specifying the secret (without trying to get it from the environment variable) it works fine.<br>
Therefore I am wondering if the install step maybe occurs before the environment variable was created?</p>
<p>I've attached the appveyor,yml file used for this project.</p>
<p>Regards,</p>
<p>Thomas</p></div>Thomas Fresneautag:help.appveyor.com,2012-11-13:Comment/370617272018-08-17T18:16:40Z2018-08-17T18:16:40ZEncrypt Files<div><p>Everything looks configured correctly. Environment variables are present at install stage, but they are session specific, which is why when you login and create a new session those environment variables do not show up.<br>
Do you belong to more than one AppVeyor account? I'm asking in case you are encrypting the secure variable under a different login than the project that you are building.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/370617272018-08-17T18:53:06Z2018-08-17T18:53:07ZEncrypt Files<div><p>I do have access to AppVeyor with 2 accounts (the account owner from which I created this project and another one associated with my personal email address).<br>
I have tried to encrypt the secret with these 2 different logins and I get the same encrypted secret.<br>
I have stored this encrypted secret in the Environment tab of the project settings.</p></div>Thomas Fresneautag:help.appveyor.com,2012-11-13:Comment/370617272018-08-17T20:08:23Z2018-08-17T20:08:23ZEncrypt Files<div><p>There is no way encrypted secret can be the same when created from different account. Are you sure you <a href="https://www.appveyor.com/docs/team-setup/#switching-between-accounts">switched between accounts</a>?</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/370617272018-08-17T20:13:36Z2018-08-17T20:13:37ZEncrypt Files<div><p>Sorry I was confused by the terminology here (I thought your were talking about users). I am actually using the same account when encrypting the secret and when storing it in the project.</p></div>Thomas Fresneautag:help.appveyor.com,2012-11-13:Comment/370617272018-08-18T00:13:49Z2018-08-18T00:13:49ZEncrypt Files<div><p>You use <code>%secure_file_secret%</code> in PowerShell, but this is CMD environment variable notation. If you decide to use PowerShell it should be <code>$env:secure_file_secret</code>.</p></div>Ilya Finkelshteyn