In Azure DevOps, trying to copy a file to Azure Storage using the Azure file copy task.
Initially we were using v3 and it had an error in a "Pre-job" task (but the task itself succeeded) with this error:
Unable to fetch storage account key. Error: '{0}' Error: Input required: ConnectedServiceNameSelector
In v2 of the task the error is:
Unable to fetch storage account key. Error: '{0}' TypeError: Cannot read property 'retrieveSecret' of undefined
The Fix
Under the hood the task must be creating a SAS token and then trying to upload to the blob storage. To fix the problem you need to ensure the Service Principal being used has these two roles on the Azure Storage Account:
Storage Account Contributor
- "Lets you manage storage accounts, including accessing storage account keys which provide full access to storage account data."
Storage Blob Data Contributor
- "Allows for read, write and delete access to Azure Storage blob containers and data"
Top comments (0)