Hello Friends!
We are excited to announce #25DaysOfServerless, a 25-day event to create a 25 new serverless workloads leveraging Azure Functions.
Rules
Solve the daily challenge in the programming language of your choice. Then submit your solution via GitHub (and share it on Twitter), and we'll showcase the best solutions every week!
If you're new to serverless, we'll have hints to help you! All you need is a GitHub account to post your solution and a sense of adventure.
Example
'Tis the season for gift giving, and we need a solution to share images of our gifts! One problem though: we can only share png files.
For this challenge, create an Azure Function triggered by Azure Blob Storage that will verify that each photo uploaded to our Azure Blob Storage container is a png; if it is not, delete the photo from the container.
We can create a simple BlobTrigger in Azure Functions to solve this one in C#!
[FunctionName(nameof(GiftPhotoValidationFunction))]
public static async Task Run([BlobTrigger(_containerName)] CloudBlockBlob blockBlob, ILogger log)
{
log.LogInformation("Validating Gift Image is a PNG");
if (blockBlob.Name.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
{
log.LogInformation("Confirmed PNG");
}
else
{
log.LogInformation($"Photo {blockBlob.Name} is not a PNG");
log.LogInformation($"Deleting {blockBlob.Name} from container");
await blockBlob.DeleteAsync().ConfigureAwait(false);
log.LogInformation($"Deleted {blockBlob.Name}");
}
}
Get Started
Starting December 1st, visit https://www.25daysofserverless.com to find the daily challenge, and follow both @AzureAdvocates and #25DaysOfServerless on Twitter.
If you're new to Azure, sign up for a Free Azure Account before #25DaysOfServerless kicks off on December 1st!
Top comments (1)
Can't wait for this!