custom-script-extension-linux: Getting HTTP 403 when attempting to download fileUris with user-assigned managed identity
Using v2.1.3 of this extension with a user-assigned managed identity, it fails when attempting to download the files defined in fileUris with the following errors:
time=2020-03-23T23:22:23Z version=v2.1.3/git@4cd2b9f-clean operation=enable seq=6 file=0 event="download start"
time=2020-03-23T23:22:23Z version=v2.1.3/git@4cd2b9f-clean operation=enable seq=6 file=0 retry=0 error="unexpected status code: actual=404 expected=200"
time=2020-03-23T23:22:23Z version=v2.1.3/git@4cd2b9f-clean operation=enable seq=6 file=0 retry=0 info="downloader download.urlDownload returned 404, skipping retries"
time=2020-03-23T23:22:23Z version=v2.1.3/git@4cd2b9f-clean operation=enable seq=6 file=0 retry=0 error="unexpected status code: actual=403 expected=200"
time=2020-03-23T23:22:23Z version=v2.1.3/git@4cd2b9f-clean operation=enable seq=6 file=0 retry=0 info="downloader *download.blobWithMsiToken returned 403, skipping retries"
time=2020-03-23T23:22:23Z version=v2.1.3/git@4cd2b9f-clean operation=enable seq=6 file=0 event="download failed" error="failed to download file: unexpected status code: actual=403 expected=200"
time=2020-03-23T23:22:23Z version=v2.1.3/git@4cd2b9f-clean operation=enable seq=6 event="failed to handle" error="processing file downloads failed: failed to download file[0]: failed to download file: unexpected status code: actual=403 expected=200"
I’ve double checked that the user-assigned identity has the proper role assignments for both the VM and the Storage Account (Contributor role in both cases).
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 2
- Comments: 15
Finally found a solution for me. The user assigned identity needs at least “Storage Blob Data Contributor” (Reader is not enough!) Role on Storage Account. Below my template for reference:
Hope this helps anyone.