@ Renuka Prasad N P Posting the Offline discussion, For generating the SAS token, which can benefit other community member reading this thread.
using Azure.Storage.Blobs;
using Azure.Storage.Sas;
using Azure.Identity;
using System;
// Get the account name and container name.
string accountName = "<your_account_name>";
string containerName = "<your_container_name>";
// Create a new ClientSecretCredential object to authenticate with AAD using the app client ID and secret.
ClientSecretCredential credential = new ClientSecretCredential("<your_tenant_id>", "<your_client_id>", "<your_client_secret>");
// Create a new BlobServiceClient object using the account name and the credential.
BlobServiceClient blobServiceClient = new BlobServiceClient(new Uri($"https://{accountName}.blob.core.windows.net)
// Create a new BlobSasBuilder object to generate the SAS token.
BlobSasBuilder sasBuilder = new BlobSasBuilder()
{
BlobContainerName = containerName,
Resource = "c",
ExpiresOn = DateTimeOffset.UtcNow.AddHours(1)
};
// Set the permissions for the SAS token.
sasBuilder.SetPermissions(BlobSasPermissions.Read);
// Generate the SAS token using the BlobSasBuilder object and the StorageSharedKeyCredential object.
string sasToken = sasBuilder.ToSasQueryParameters(new StorageSharedKeyCredential(accountName, credential)).ToString();
// Print the SAS token.
Console.WriteLine(sasToken);
Please let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.