Giter Club home page Giter Club logo

matjazbravc / backupfolder-azurefunction-demo Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.39 MB

Azure Durable Functions and Azure WebJobs lets you write stateful functions in a serverless environment. The primary use case for Durable Functions is simplifying complex, stateful coordination problems in serverless applications.

C# 100.00%
azure azure-functions azure-durable-functions csharp csharp-code backup-folder dependency-injection autofac webjobs serverless-architectures

backupfolder-azurefunction-demo's Introduction

Backup folder with usage of Azure Durable Function

Durable Functions is an extension of Azure Functions and Azure WebJobs that lets you write stateful functions in a serverless environment. The primary use case for Durable Functions is simplifying complex, stateful coordination problems in serverless applications.

This application demonstrate following functionalities:

  • usage of Azure durable functions,
  • dependency injection with Autofac (inspired by Holger Leichsenring Blog Post),
  • logging with Serilog sink to Azure Table storage,
  • using Table storage as an temporary repository,
  • copying files to blobs

Because of cross function communication limitations I've used Table Storage as an temporary repository for list of all files to be backed up. Sure, there is a number of ways to do this but I've choose Table Storage.

Prerequisites

To create and deploy functions, you also need:

  • An active Azure subscription. If you don't have an Azure subscription, free accounts are available.
  • An Azure Storage account. To create a storage account, see Create a storage account.

Let's get started!

First, you have to enter your Azure storage account connection string (and other settings) into local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
    "Logging.Storage.TableName": "BackupFolderLog",
    "BackupFolder.TableName": "BackupFolder",
    "BackupFolder.ContainerName": "backupfolder",
    "StorageAccount.ConnectionString": "UseDevelopmentStorage=true"
  }
}

P.S. More about how to test Azure functions locally you can read here.

Second, if you use development storage you have to setup Azure Storage Emulator. See Use the Azure storage emulator for development and testing and Configuring and Using the Storage Emulator with Visual Studio.

Third, build solution and run it with local Azure Functions runtime:

And when function is finished, you should receive succeed status:

Finally test it with Postman:

Results you can check easy with excellent Azure Storage Explorer (you can download it for free):

Enjoy!

Licence

Licenced under MIT. Contact me on LinkedIn.

backupfolder-azurefunction-demo's People

Contributors

matjazbravc avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.