我有BlobServiceAsyncClient
使用TenantID
, clientID
, ClientSecret
,ContainerName
来创建blobContainerAsyncClient
.
上传文件为
blobContainerAsyncClient.getBlobAsyncClient(fileName).upload(.........);
我有BlobServiceAsyncClient
使用TenantID
, clientID
, ClientSecret
,ContainerName
来创建blobContainerAsyncClient
.
上传文件为
blobContainerAsyncClient.getBlobAsyncClient(fileName).upload(.........);
您可以使用以下代码
创建具有只读权限且仅在接下来的 10 分钟内可用的共享访问签名。
public string CreateSAS(string blobName)
{
var container = blobClient.GetContainerReference(ContainerName);
// Create the container if it doesn't already exist
container.CreateIfNotExists();
var blob = container.GetBlockBlobReference(blobName);
var sas = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy()
{
Permissions = SharedAccessBlobPermissions.READ,
SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(10),
});
return sas;
}
请参阅此文档以获取更多信息:https ://tech.trailmax.info/2013/07/upload-files-to-azure-blob-storage-with-using-shared-access-keys/