Last active
June 17, 2022 07:14
-
-
Save shinkathe/dc437944c795a483fbf6475e385f49ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ##### READ EVENT GRID EVENT FROM REQUEST ##### | |
log.LogInformation("Begin handling request. {EventGridEvent}", eventGridEvent.Data); | |
if (!TryGetEventData<string>(eventGridEvent, CREATED_EVENT_URL, out var url)) | |
{ | |
log.LogError("EventData could not be parsed. UrlFound check failed."); | |
return; | |
} | |
// ##### READ FILE NAME AND STORAGE ACCOUNT CONTAINER NAME FROM EVENT GRID EVENT | |
if (!TryGetFileNameAndContainerFromUrl(url, out var fileName, out var container)) | |
{ | |
log.LogError("Invalid file URI, could not process. Url value: {Url}", url); | |
return; | |
} | |
// ##### DOWNLOAD FILE FROM AZURE STORAGE ##### | |
log.LogInformation("Downloading {FileName} from container {Container}...", fileName, container); | |
var blobClient = new BlobClient(ConnectionString, container, fileName); | |
// ##### DOWNLOAD FILE ##### | |
using var ms = new MemoryStream(); | |
await blobClient.DownloadToAsync(ms); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment