且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从阅读的Azure Blob存储文件

更新时间:2023-02-14 22:39:30

只要将BLOB的公共的,你可以完全通过BLOB网址。例如,你可以将它嵌入在HTML图像或链接:

As long as the blob is public, you can absolutely pass the blob url. For instance, you can embed it in an html image or link:

<a href="https://myaccount.blob.core.windows.net/pdf/1001_12_Jun_2012_18_39_05_594.pdf">click here</a>

在默认情况下,BLOB容器的私人的。为了让公共读取权限,你只需要创建容器时改变容器的权限。例如:

By default, blob containers are private. To enable public read access, you just have to change the container permissions when creating the container. For instance:

var blobStorageClient = storageAccount.CreateCloudBlobClient();
var container = blobStorageClient.GetContainerReference("pdf");
container.CreateIfNotExist();

var permissions = container.GetPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
container.SetPermissions(permissions);