Skip to content

Download blob as triggered by Event Grid routed storage event

License

Notifications You must be signed in to change notification settings

rivms/blobtriggerdownload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample - Trigger Blob Download

This sample demonstrates a C# Windows Service (Topshelf) that launches a Powershell script using Azcopy to download a blob. The download process is triggered when a new file is added to blob storage, Event Grid is used to route the event to a service bus queue that is consumed by the C# app.

Blob Trigger Demo

Blob Storage Events

For details on setting up Event Grid please review the following documentation page, Reacting to Blob storage events. It provides guidance on:

  • Publishing events from blob storage
  • Filtering events to ensure events are raised only once the blob is fully committed

Configuration

The appsettings.json provides the following:

  • Powershell script to run, must be located in same folder as dll/executable
  • Service bus queue name Event Grid is routing blob storage events to
  • Folder to download the blob to
  • Service bus connection string
  • SaS token for blob storage, this is the query string component (can be generated using Azure Storage Explorer)

Here is a sample appsettings.json:

{
  "BlobEventConfig": {
    "PowershellScript": "download_blob.ps1",
    "QueueName": "filearrived",
    "DestinationFolder": "c:\\temp\\blobdestination\\"
  },
  "ConnectionStrings": {
    "ServiceBus": "Endpoint=sb://<sb name>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<sas key>",
    "BlobSaSTokenQueryString": "?sv=2019-02-02&si=files-1724F37AF21&sr=c&sig=nx94H7WcoA1%2BTcLuaAjgKrJicnSTR97jEGPPzkEkDa4%3D"
  }
}

Limitations

This sample is provided as-is to demonstrate concepts, error handling, security, performance and other essential attributes are not explicitly included.

About

Download blob as triggered by Event Grid routed storage event

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published