Using Azure File Copy from DevOps yaml pipeline
I learned that it's not enough to authorize Azure Resource Manager access from DevOps
Oh boy, did I waste time on this one :(. So I had my pipeline pretty naively doing an upload to blob storage:
2
displayName: Upload Vsix
3
inputs:
4
SourcePath: '$(Pipeline.Workspace)\vsix\RoslynDeployment.$(Build.BuildId).vsix'
5
azureSubscription: 'roslyn-Azure'
6
Destination: 'AzureBlob'
7
storage: 'roslyn'
8
ContainerName: 'vsix'
9
BlobPrefix: '$(Build.SourceBranchName)/RoslynDeployment.$(Build.BuildId).vsix'
Copied!
I used a service principal managed by DevOps which is the recommended approach. The blob storage account was under the same subscription, where the automatically created app properly showed up in IAM:
Access control (IAM) pane for storage account
as a contributor:
DevOps-managed app as contributor to the storage account
I kept getting a 403 response when the task run, with the message This request is not authorized to perform this operation using this permission.
Turns out being a Contributor is not enough. I tried changing guest user permissions, but in the end the only thing that worked was manually adding the Storage Blob Data Contributor role, which I found mentioned in a blog post.
In the process I learned how DevOps creates the app registration and what-not, but still, not fun.
Submitted a doc fix for the AzureFileCopy task docs so this is more easily discoverable.
Last modified 1mo ago
Copy link