Skip to content

Commit 8c14480

Browse files
authored
Merge pull request #127 from cloudfoundry/add-sas-token-blob-copy
Use SAS token for copying from unpublishedstemcells
2 parents 27d022d + 1416254 commit 8c14480

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)