Skip to content

Commit 1416254

Browse files
selzocragaskar
andcommitted
Use SAS token for copying from unpublishedstemcells
Apparently, with newer versions of the Azure CLI, the blob copying command will not work unless you grant the Azure storage service explicit access to read the source blob. Co-authored-by: Rajan Agaskar <[email protected]>
1 parent 27d022d commit 1416254

File tree

1 file changed

+13
-4
lines changed
  • ci/tasks/azure-image-upload-and-start-publishing

1 file changed

+13
-4
lines changed

ci/tasks/azure-image-upload-and-start-publishing/run

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,20 @@ update_offer() {
8585

8686

8787
copy_blob_to_premiumstore() {
88+
# Generate SAS token for source blob
89+
source_sas=$(az storage blob generate-sas \
90+
--account-name "${AZURE_STORAGE_ACCOUNT}" \
91+
--account-key "${AZURE_STORAGE_ACCESS_KEY}" \
92+
--container-name "${AZURE_CONTAINER_NAME}" \
93+
--name "${vhd_path}" \
94+
--permissions r \
95+
--expiry $(date -u -d "+1 hour" '+%Y-%m-%dT%H:%M:%SZ') \
96+
--output tsv)
97+
98+
source_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${AZURE_CONTAINER_NAME}/${vhd_path}?${source_sas}"
99+
88100
az storage blob copy start \
89-
--source-account-key "${AZURE_STORAGE_ACCESS_KEY}" \
90-
--source-account-name "${AZURE_STORAGE_ACCOUNT}" \
91-
--source-container "${AZURE_CONTAINER_NAME}" \
92-
--source-blob "${vhd_path}" \
101+
--source-uri "${source_url}" \
93102
--account-name "${AZURE_PUBLISHED_STORAGE_ACCOUNT}" \
94103
--account-key "${AZURE_PUBLISHED_STORAGE_ACCESS_KEY}" \
95104
--destination-container "${AZURE_CONTAINER_NAME}" \

0 commit comments

Comments
 (0)