About Me

A career professional with 19 years of experiences with in application development, solution architecture, management and strategy. Architected, planned, and executed, many programs, projects and solutions delivering valued results to business clients and customers. Able to provide creative solutions to solve problems and articulate the value proposition to upper management and technical design to IT staff. Collaborates across teams and other facet of IT (i.e. operations, infrastructure, security) to validate solutions for completeness. Interface with clients to gather feedback, advise, and solution in the business language.

Monday, December 19, 2016

Going All Cloud Solution - Know the Formula of Serverless


Going All Cloud Solution - Know the Formula of Serverless

Currency Conversion Sample Solution
{All Cloud Solution = SPO + Flow + AzFn}

STILL in DRAFT mode but it has been published so others can get info they need.

Solution - SharePoint Online, Microsoft Flow, and Azure Functions

Recently I wrote an article on LinkedIn about building an All Cloud Solution
The solution uses SharePoint Online, Microsoft Flow, and Azure Functions. Using these solutions together can greatly increase your solution capabilities without having to deploy on-premise technologies.

Please see the details of the article here:

https://www.linkedin.com/pulse/going-all-cloud-solution-sharepoint-flow-azure-functions-cooper?trk=mp-author-card

Putting the solution together:

SharePoint Online (SPO) - Data Entry Form

Doing simple data capture is light weight and simple to get started.

1. Create a custom SharePoint List called Sales
Field Name Type
Rename Title field to Short Sales Description
ProductSingle Line
ItemSkuMultiple Choice [0001, 0002, 0005]
SalesAmtNumber
LegalTenderMultiple Choice [Data goes here]


Microsoft Flow - Workflow Engine "The Glue"

Sign up for a Flow account (https://flow.microsoft.com/en-us/)


Create a new Flow


New step - Add Action > SharePoint - When a new item is created
 Fill in SharePoint site and select list name

Add a New step - Add an action


Type in HTTP (*Note this is a Custom API feature that gives you a lot more power).

Select SharePoint action to update list item.
Azure Function
Register for an Azure Function service. The Azure Function are WebJobs underneath and they will create an App Service on your Azure portal.

Provisioning the Azure Function App Service. If you already have an Azure subscription the second image shows you how to get to Azure Functions via Azure portal.








Rewrite the code
To make sure that everything is functioning we will augument the code with enhanced functionality as I go on

--- Note the #r is a way of pulling external libraries into your Azure Function
#r "Newtonsoft.Json"

using System;
using System.Net;
using Newtonsoft.Json;

public static async Task Run(HttpRequestMessage req, TraceWriter log)
{
    log.Info($"Webhook was triggered!");

    string jsonContent = await req.Content.ReadAsStringAsync();
    dynamic data = JsonConvert.DeserializeObject(jsonContent);

    if (data.Amount == null || data.LegalTender == null) {
        return req.CreateResponse(HttpStatusCode.BadRequest, new {
            error = "Please pass Amount/LegalTender properties in the input object"
        });
    }

   double factor = 2.0;
    return req.CreateResponse(HttpStatusCode.OK, new {
        conversion = data.Amount * factor
    });

}