Created
April 20, 2017 18:13
-
-
Save gregjhogan/ef37c38371193c8e9d08d867c05ad210 to your computer and use it in GitHub Desktop.
Push a file to a blob in an Azure storage account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X PUT -T ./{file.dat} -H "x-ms-date: $(date -u)" -H "x-ms-blob-type: BlockBlob" "https://{storageaccount}.blob.core.windows.net/backups/{file.dat}?{sas-token}" |
Had to use the following to get a x-ms-date header matching https://learn.microsoft.com/en-us/rest/api/storageservices/representation-of-date-time-values-in-headers
-H "x-ms-date: $(TZ=GMT LC_TIME=C date '+%a, %d %h %Y %H:%M:%S %Z')"
Not works: 'The value for one of the HTTP headers is not in the correct format'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sometimes,
date -u
will output invalid format on different timezone or country, an alternative way is-H "x-ms-date: $(TZ=GMT date '+%a, %d %h %Y %H:%M:%S %Z')"