Question

As far as I know in Azure Storage we can delegate access to our storage to single person using SAS on CONTAINER basis.

I need to delegate access on per BLOB basis to prevent hotlinking.

We are using Asp.Net MVC. Sorry for my English:)

Edit: And how new Azure user can create CDN?

Était-ce utile?

La solution

So you can create a SAS on a blob. The approach is similar to the way you create a SAS on a blob container. Since you're using ASP.Net MVC, I'm assuming you would want to use .Net Storage Client API to create SAS on a blob. To create a SAS on a blob, just call GetSharedAccessSignature method on the blob object you have created.

For example, the code below would give you a SAS URL where user has permission to download a blob:

var sas = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy()
    {
        Permissions = SharedAccessBlobPermissions.Read,
        SharedAccessStartTime = DateTime.UtcNow.AddMinutes(-5),
        SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(15),
    });
    return string.Format(CultureInfo.InvariantCulture, "{0}{1}", blob.Uri, sas);

I wrote a blog post some time ago which describes SAS functionality on blobs and containers in more details: http://gauravmantri.com/2013/02/13/revisiting-windows-azure-shared-access-signature/

Regarding your question about CDN, I believe the functionality to create DSN nodes was taken away from the Windows Azure Portal when new portal was announced. I guess you would need to wait for the functionality to come up again on the portal.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top