Form recognizer sas url

Vidhya R (external) 1 Reputation point
2022-01-19T18:27:29.917+00:00

Hi,

Im uploading file programmatically to container and generating sas token for the same file through c# code.

var ms = new MemoryStream(storageBlob.FileBytes);
var blobContentInfo = blobClient.Upload(ms, true);
}
logger.LogInformation("File upload succeeded: " + blobClient.Uri.AbsoluteUri);
var blobSasBuilder = new BlobSasBuilder(BlobSasPermissions.Read, DateTimeOffset.UtcNow.AddDays(1))
{
BlobContainerName = storageBlob.ContainerName,
BlobName = storageBlob.FileName
};

        var sasParameters =
            blobSasBuilder.ToSasQueryParameters(new StorageSharedKeyCredential(storageAccountName,
                storageAccountKey));

        var fileObjectUrl = blobClient.Uri.AbsoluteUri + STR_QUESTION_MARK;
        fileObjectUrl += sasParameters.ToString();

amI doing anything wrong? above fileObjectUrl works in local , the analysis is successfull, but not in uat envirnonment.

May I know what is the timezore formRecognizer api uses to check the expiry time.

Please guide to solve

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,138 questions
Azure Document Intelligence
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 38,646 Reputation points Microsoft Employee
    2022-01-21T08:50:36.613+00:00

    @Vidhya R (external) Irrespective of the time zone your blob's SAS URI would contain the SAS token with respect to UTC. Please see the steps to generate the steps to generate the SAS tokens for a container here. Please try to build your token for the container with appropriate permissions based on this criteria and pass the same to your form recognizer training client. The URI should look similar to this format.

    https://<storage account>.blob.core.windows.net/<container name>?<SAS value>  
    

    If this works for you for one setup and not another then I would look at the permissions on the blob to ensure the training data or file is available to use with the client.

    0 comments No comments