Reputation: 428
I have BlobServiceAsyncClient
Used TenantID
, clientID
, ClientSecret
, ContainerName
for creating the blobContainerAsyncClient
.
Uploading file as
blobContainerAsyncClient.getBlobAsyncClient(fileName).upload(.........);
Upvotes: 1
Views: 686
Reputation: 4612
You can use the below code
creates a Shared Access Signature with Read only permission and available only for the next 10 minutes.
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;
}
Please refer this document for more information: https://tech.trailmax.info/2013/07/upload-files-to-azure-blob-storage-with-using-shared-access-keys/
Upvotes: 1