<p>i'm trying to use Velero to backup an AKS cluster but for some reason i'm unable to set the backup location in velero.</p>
<p>i'm getting the error below
<a href="https://i.stack.imgur.com/uLakt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uLakt.png" alt="Error no storage account key found in env var" /></a></p>
<p>I can confirm the credentials-velero file I have obtains the correct storage access key, and the secret (cloud-credentials) reflects it as well.</p>
<p>Kind of at a lost as to why it's throwing me this error. Never used Velero before.</p>
<p>EDIT:</p>
<p>So I used the following commands to get the credential file:</p>
<p>Obtain the Azure Storage account access key</p>
<pre><code>AZURE_STORAGE_ACCOUNT_ACCESS_KEY=`az storage account keys list --account-name storsmaxdv --query &quot;[?keyName == 'key1'].value&quot; -o tsv`
</code></pre>
<p>then I create the credential file</p>
<pre><code>cat &lt;&lt; EOF  &gt; ./credentials-velero
AZURE_STORAGE_ACCOUNT_ACCESS_KEY=${AZURE_STORAGE_ACCOUNT_ACCESS_KEY}
AZURE_CLOUD_NAME=AzurePublicCloud
EOF
</code></pre>
<p>then my install command is:</p>
<pre><code>./velero install \
    --provider azure 
    --plugins velero/velero-plugin-for-microsoft-azure:v1.3.0 \
    --bucket velero \
    --secret-file ./credentials-velero \
    --backup-location-config resourceGroup=resourcegroupname,storageAccount=storageAccount,storageAccountKeyEnvVar=AZURE_STORAGE_ACCOUNT_ACCESS_KEY[,subscriptionId=numbersandlettersandstuff] \
    --use-volume-snapshots=false
</code></pre>
<p>I can verify Velero created a secret called cloud-credentials, and when I decrypt it with base64 I'm able to see what looks like the contents of my credentials-velero file. for example:</p>
<pre><code>AZURE_STORAGE_ACCOUNT_ACCESS_KEY=MYAZURESTORAGEACCOUNTKEY
AZURE_CLOUD_NAME=AzurePublicCloud
</code></pre>

<p>turns out it was the brackets in the install command that was causing the issue</p>
<pre><code>--backup-location-config resourceGroup=resourcegroupname,storageAccount=storageAccount,storageAccountKeyEnvVar=AZURE_STORAGE_ACCOUNT_ACCESS_KEY[,subscriptionId=numbersandlettersandstuff] \
</code></pre>
<p>removed the brackets to this:</p>
<pre><code>--backup-location-config resourceGroup=resourcegroupname,storageAccount=storageAccount,storageAccountKeyEnvVar=AZURE_STORAGE_ACCOUNT_ACCESS_KEY,subscriptionId=numbersandlettersandstuff \
</code></pre>
<p>and now it works</p>
