(upbeat music)
- Coming up, if you're in the middle
of your cloud migration dealing with legacy systems,
or just want a better integration
between Microsoft, third party,
and on-premises systems and services,
we're gonna take a look at how Logic Apps can help.
Including the latest updates such as our new SAP connector
with bi-directional connectivity,
and the new integration service environment
for direct, secure access to your virtual network resources.
So we're joined today by Derek Li
from the Logic Apps team at Microsoft, welcome.
- Thanks for having me.
- So we've covered Logic Apps on "Microsoft Mechanics"
as really a core enabler for serverless compute in the past,
but it's really a lot more than that.
- It is.
Logic App is a great enabler for serverless,
but at its core, Logic Apps is about integration.
Now, we live in a API-centric world,
the connectivities API provides us is great,
but writing code to talk to each
and every single API isn't fun.
With Logic Apps, we took care of which version
of the API to call, how to authenticate,
and how to pass data back and forth.
So you as a developer can then focus
on developing the core business logic,
and effortlessly integrate all the systems and services
that your business runs on together.
With Logic Apps, we provide almost 300 connectors
out-of-box, connecting to systems and services
within Azure, by Microsoft, and third parties
on the cloud or on-premises.
Plus, that list grows all the time.
Like you said, we just introduced a new SAP connector
with bi-directional connectivity.
- And I can imagine this will save a ton of time
in terms of hooking everything up as a developer.
- It does, with all the connectors that we ship out-of-box
and with the rich flow-control capabilities
in Logic Apps, such as loops, conditions,
exception handling, retry policies,
we're talking about weeks or sometimes months of work
down to days or even hours.
- Right, and these flow capabilities
make it more than just a connection
or a point-to-point integration solution, right?
- Right, with Logic Apps, we give you
a general-purpose workflow engine
on the cloud for all your integration needs.
And what sets it apart is the visual designer.
Now, in the visual designer,
we allow you to easily build integrations
connecting all the system and services together,
and make changes as your business needs evolve.
All without having to write a single line of code.
And in the designer, tokens are provided for you
so we can easily reference output from the trigger
or from your previous actions throughout your workflow.
And let me show you how that works.
- [Jeremy] Okay.
- Here I have a simple Logic App that monitors Twitter
for whenever someone posts a tweet
mentioning logicappsio, our Twitter handle.
The first thing I want to do upon receiving a new tweet
is to send that tweet to sentiment analysis
and understand people's sentiment
when writing such a tweet.
And it is as simple as popping up the dynamic content picker
and choose the original tweet text as a token
to feed into the detect sentiment action.
Now, once I have the score, the next thing I want to do
is to push both the original tweet
and the score that I just computed
into a Power BI streaming dataset
so I can visualize the results.
And you can see I built this integration
in less than a minute with just a few clicks
of a button and no code required.
- This is really great because you don't need
to define variables or things that you need
in the past basically to bring all that state
forward from all the previous steps.
- That's right.
And of course, you can extend the capabilities
by leveraging the power of Azure.
You can build an event-driven Logic App using Event Grid.
You can connect to your data source,
such SQL Azure or Cosmos DB.
Or you can add intelligence to your solution,
like I did, by leveraging Cognitive Services.
Or you can even bring in your own
machine learning models if you like.
And this is especially great
if we're talking about modernizing your legacy systems.
- So do I use Logic Apps, then, for lighter tasks,
or is this something that I can also use
with business critical or kind of larger tasks as well?
- Logic App is created for mission-critical workloads.
And by design, Logic App is highly robust,
resilient, and performant.
A lot of companies globally, in health care,
financial industries, government,
or even ourselves included,
uses Logic Apps to process HR, business transactions,
financial transactions on a daily basis.
So let me explain to you how the resiliency works.
Whenever Logic Apps starts running, behind the scene,
a background job is created
for each and every single step in the workflow.
And as each step executes,
their states are being recorded and persisted
in storage, and report back to Logic App.
The step can assume a number of different states,
pending, running, or complete,
and all these states are being logged.
So now, even in the worst-case scenario,
let's say the data center goes dark, we can still guarantee
the Logic Apps start running before it happens,
will run to completion
once the data center comes back online.
And that is because of the data persistency
which allows us to reconstruct your Logic App
with all the necessary payload,
so that it can continue from right where it was left off.
- Okay, so then Logic Apps takes care
of your system integration,
and with connectors and workflow,
it's super resilient because it will resume those tasks
right from where they left off.
But can we see this all in action?
- You bet, so let me first describe what we are gonna build.
We have an SAP system on-prem
that will receive sales orders
from our e-commerce site for software purchases.
Now, on the cloud, we also have a licensing server
to generate keys, invoicing system
that will create PDF invoices,
and an email system that will deliver
the key and the invoice to our customers.
Now, the goal is to connect them all together
using Logic Apps and its connectors
to fulfill the order once a purchase is made.
We have a VNET that allows us to securely
and bi-directionally connect
SAP and Logic Apps together.
So once a sales order is received,
it will trigger a new Logic App instance.
We'll then generate the software licensing key,
generate an invoice, and then confirm
the order via email to our customers.
So let's see how to do that with Logic Apps.
Here I have a Logic App with SAP trigger already configured
so that whenever a sales order comes in,
a new Logic App instance will be triggered.
Now, remember my SAP system lives on-prem,
yet with Integration Service Environment
and its VNET capabilities, I can easily connect
to my SAP system from Logic Apps.
- Right, so Logic Apps feel local to SAP.
- Exactly.
Now, the first thing I will do in my Logic App
is to take that sales order,
which comes from SAP as an XML format file,
into JSON to allow me to easily work with the data within.
After that, I will call into my software generation server
to generate a new key.
For it to generate me a key, the only information I have
to provide is what item has been purchased.
So I'm selecting Purchased item
from the dynamic content picker,
and you see a token is again inserted,
allowing me to reference the value.
Once I have the key, I will use the Microsoft Word connector
to populate a sales invoice template.
I will first specify where my invoice template
is located, and it is called invoice.docx.
Now, with this invoice are a few more information
I have to provide in order for it
to generate a sales template.
Now, invoice number,
so I will choose Order number as the input.
Customer name.
Total cost.
The item purchased.
And eventually, customer's address.
Once I have the invoice generated,
I will upload that to SharePoint for archival purposes.
So we'll be using the Create File action in SharePoint.
I'll be uploading it to our team's SharePoint site,
so I will select Logic Apps.
We'll use the Demo folder.
The name of the file, let's just use the order number
as the name and with a docx postfix.
The file content will be what we just generated.
So this is the invoice template filled
with customer's information.
Next, I will again use the Microsoft Word connector
to convert that Word document into PDF format
so we can send it via email.
So let me select the Logic Apps SharePoint site,
the Demo folder, and I already know the name of the file
which again, is a token allowing me
to easily reference to it.
And lastly, I will use SendGrid action
to send email to customers
with both the key and the sales invoice.
The email will come from sales@shop-contoso.com.
Subject will be thank you for your order.
We'll also add the order ID to it.
In the email body, we'll say the key for item,
purchased item, is the generated key.
We'll send that email to the customer
using the email address token.
And lastly, we'll add the attachments.
So the attachment content will be the PDF file,
and the attachment name
will be the order number .pdf.
So now, let me save the Logic App.
And, Jeremy, why don't you go ahead and make a purchase,
and we'll show you how this works.
- Okay, sounds good.
So I'm here in the e-commerce site here,
and I want to actually purchase
Visual Studio Unobtainium.
It's, of course, a fictitious name of a product.
We'll go ahead and check out there.
And now I can see that my information's
already cached from previous orders.
I'm gonna do cash on delivery just to save some time
in terms of entering credit card info.
We'll hit Complete order.
And now the order presumably is being sent to you.
- [Derek] And now let me refresh my Logic App runs,
and you see a new Logic App instance just popped up
based on the purchase you just placed.
- All right, so let me look in email,
and I just have this order confirmation here,
so I'll click into it,
and we'll see exactly my order
as well as the key that I need.
And if I click into the PDF,
we'll even see all of that conversion and formatting
that we just saw through the Logic App
appear here in the PDF file.
- Exactly.
And let me click into the run
and show you how the run history view work.
So here as a Logic App operator,
I see how each and every single step
in my Logic App executed,
their states, how long it took,
along with the input and output
it takes during runtime execution.
- So that was pretty cool.
We actually connected up three different systems,
across on-premises and the cloud and all your workflow,
and got all that up and running
just in a couple of clicks, but in the real world
I'm guessing that there are a few more checks and balances
in place before you start sending out orders.
- Exactly.
That was somewhat a simplified scenario
just to show you how to use Logic App
to build integrations.
Now, in real world, you can easily add more logic to it
depending on particular business requirements.
And in our case, we'll add some intelligence to it.
So for that we're gonna add a custom machine learning model
to check for possible fraudulent purchases
and determine a course of action to take.
The model looks for a few different things
such as if it's someone's first-time purchase
with a really large purchase amount,
if the shipping and billing address does not match.
And the Logic App will decide either
to allow the purchase to be fulfilled,
or to put it on hold and trigger a manual review.
So let me show you how to do that,
again, from within the Logic Apps Designer.
So here I'm back to the Logic App
that we just built to process the order.
I will insert an action before I generate the key
to call out to my machine learning model,
to detect whether it's fraudulent or not.
For it to work, we'll feed the order data into it.
After the action, I will use the condition action
within Logic Apps, to check for the returned value.
So I will look for this property called isFraud.
And then we'll compare it to true.
So if it is fraud, we want to put the order on hold.
Now, to put the order on hold,
I will call back into my SAP system.
And remember, I mentioned we have
a bi-directional connectivity with SAP.
So not only are we triggering the Logic App
based on a sales order appearing in SAP system,
we're also sending some message back to SAP
so we can put the order on hold.
So we'll send a message to SAP.
The SAP action will be a BAPI purchase order change.
- [Jeremy] Okay.
- And for my input message, I will simply have to reference
the purchase order that we care about.
In this case, we'll select the order number.
So again, the token is inserted into this XML message
that I'm constructing, allowing me
to put the order on hold in SAP system.
Once that is done, I will use the Terminate action
to stop the Logic App from proceeding forward.
Therefore, we're not generating a new key,
we're not sending that message to the customer.
So again, let me save my Logic App
and then we'll go back to our shopping portal
and make another purchase
that will most likely be marked as fraudulent.
So here I'm buying 100 copies of Windows Pi.
I'm gonna complete the order.
And I will switch back to my Logic App,
and if I hit Refresh, we should see again
a new instance popped up.
And in this case, we can see that
the check fraudulent order returned true.
We sent the message back to SAP putting the order on hold,
and we terminated the Logic App,
and you can see all the other actions have been skipped.
- Really cool, so with this type of integration available,
it's really gonna help in terms of having
hybrid models or maybe you're just incrementally moving
some of your on-premises systems to the cloud.
Now, we really just scratched the surface here,
but you can also bring your own logic and code
into the Logic Apps flow as well, right?
- Exactly, it is very easy for you
to add additional step with code,
and there's still a lot of areas that you can code
to bring in more capabilities.
We just freed you up from not having
to focus on the plumbing.
And you can also build custom connectors
to connect to internal systems
and allow a greater reusability
within your own organization.
- So this looks really great.
But for the folks watching at home,
how can they actually learn more
and start using this for themselves?
- The best way for you to learn is to try it out yourself.
So go to Azure Portal just like I did
and build your first Logic App today.
We also have tons of guidance available
to help you get started,
and you can check out the link shown.
- And we're gonna keep tracking the progress
with Logic Apps on Microsoft Mechanics,
and of course, keep watching our channel
and subscribe if you haven't already,
and we'll see you next time.
(upbeat music)