1

I have BlobServiceAsyncClient

Used TenantID, clientID, ClientSecret, ContainerName for creating the blobContainerAsyncClient.

Uploading file as

blobContainerAsyncClient.getBlobAsyncClient(fileName).upload(.........);
piyush
  • 418
  • 1
  • 4
  • 13

1 Answers1

1

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/

RahulKumarShaw
  • 4,192
  • 2
  • 5
  • 11