Create an Azure storage SAS token Access Azure blob file using PowerShell

Source: Internet
Author: User

Azure storage contains storage account, Container, blob, and so on, with the following specific relationships:

Our commonly used blob storage is stored in the container of the storage account.

There are currently three ways to share the contents of a BLOB with other users, in three ways:

1. Set the Container property as a public container

2. Set the Blob property to public public blob

Once set, the BLOB can be downloaded by wget.

3. File sharing over a certain period of time via SAS token

SAS is a shared access signature (SAS) that enables file sharing.

SAS Provider Service generates a SAS token by way of a bypass, through which the customer accesses the SAS token for a certain period of time.

The following will use PowerShell to generate SAS tokens to give customers access to the permissions.

There is a file:

Get-azurestorageblob-container Hengweisoft-blob GOOGLECHROME.DMG

Container Uri:

Name blobtype Length ContentType lastmodified snapshottime

---- -------- ------ ----------- ------------ ------------

GOOGLECHROME.DMG blockblob 65936251 application/octet-stream 2015/7/6 8:09:00 +00:00

Among them hengweisoft This container is the private container.

$startTime = Get-date

$endTime = $startTime. AddHours (2.0)

New-azurestorageblobsastoken-container Hengweisoft-blob googlechrome.dmg-permission rwd-starttime $startTime- Expirytime $endTime

This command allows you to generate a bunch of SAS tokens:

? sv=2015-02-21&sr=b&sig=ifn6jfoinalqpygkcksyiuieq58wdexxv2z52nx%2fdjs%3d&st=2016-02-05t09%3a36% 3a57z&se=2016-02-05t11%3a36%3a57z&sp=rwd

Connect this token to the URL of the blob:

Https:// &sig=ifn6jfoinalqpygkcksyiuieq58wdexxv2z52nx%2fdjs%3d&st=2016-02-05t09%3a36%3a57z&se=2016-02-05t11 %3a36%3a57z&sp=rwd

This file can be accessed within 2 hours without requiring authentication.

You can do this by:

wget Sr=b&sig=ifn6jfoinalqpygkcksyiuieq58wdexxv2z52nx%2fdjs%3d&st=2016-02-05t09%3a36%3a57z&se= 2016-02-05t11%3a36%3a57z&sp=rwd

Get this file directly.

Create an Azure storage SAS token Access Azure blob file using PowerShell

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.