开发者

How can I use URLLOader to read a blob from a private container?

开发者 https://www.devze.com 2023-03-04 03:13 出处:网络
I have a flex application which is hosted on Azure. I have some data stored in a blob in a private container.

I have a flex application which is hosted on Azure.

I have some data stored in a blob in a private container.

How can I use URLLoader to display the data? If I use a public container , then I am able to read from the blob in my application. However, 开发者_如何学Pythonif the type of the container is private URLLoader fails.

Any ideas on this?


Azure provides a SharedAccessSignature method to allow you to temporarily allow third parties to access blobs via HTTP.

This sample code from SetPermissions on MSDN shows you how to create a shared access policy - http://msdn.microsoft.com/en-us/library/ee758387.aspx

// Get the shared access signature to share with users, specifying a signature-level access policy.
string sas = container.GetSharedAccessSignature(new SharedAccessPolicy()
{
    SharedAccessStartTime = DateTime.Now,
    SharedAccessExpiryTime = DateTime.Now.AddHours(10),
    Permissions = SharedAccessPermissions.Write | SharedAccessPermissions.Read
});

Once you have a shared access policy then it is basically a query string to add on to the end of your normal HTTP GET URL


You may need to look at Blob Container Access Policies and Signed Blob URL. You can define a time range to container access policies (can have upto 5 container access policies) for a time period you want to allow access. Windows Azure allows to generate signed blob url using container access policies. You can also create a signed blob url without using container access policy, but that url will be valid for a maximum of one hour. Generated signed blob url allows access to the blob even if blob container is private. Please find more information from here and here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号