Some code is boring. There, I said it. Most developers want to work on difficult challenges, or at the very least, interesting ones. So when a tool comes along that eliminates some of the tedious code that seems to be written again and again (and again) to do the same work, I embrace it. Because time spent writing boring code is time not spent writing something really cool or interesting.
What Is An Azure Logic App?
If you are familiar with IFTTT (If This Then That), or Microsoft Flow, or Microsoft BizTalk, or just the concept of “middleware,” you are already have a leg up on understanding what Logic Apps do. If you still don’t know, I find examples are helpful. Logic Apps are great:
- If you want to update Salesforce when your order management system reports an order has been re-routed…
- If you want to send an email to the CEO when a Tweet from a competitor mentions your company…
- If you want to trigger an application to import a file in to SQL when a new .csv file has been dropped into a DropBox folder…
And the best part? There’s no need to write code.
No Code? But We Make Software!
Ultimately, our role as software developers is to make great solutions as quickly as possible. Code is just typically the way that we do it. If there’s a simpler no-code solution available, whether it involves an already-built SaaS solution, or a piece of paper, or eliminating an unnecessary process, we should recommend it. It’s important to remember that our jobs are not writing code, they are solving challenges.
That said, you probably do have some unique aspects to what you are doing. If we imagine your application as having a core functionality, it might be something like “a shopping application that enables users to find the best prices on groceries,” or “an internal application that tracks resources across the organization,” or maybe you just happen to have an application but your real mission is “making the best chocolate chip cookies on the planet.” I don’t know what you do, but if it’s the chocolate chip cookies thing, please send me some. You can reach me at @jporcenaluk on Twitter.
It’s that core focus, that mission you have, that should be driving your strategy. Time figuring out how to make entries in an Excel document whenever your web app gets a new order of cookies is time spent not making the best cookies on the planet. To that end, Logic Apps fulfill a specific, necessary role without the need to write code: middleware. It’s the tedious, boring task of translating from one system to another. Logic Apps enable organizations to focus most of their energy on generating unique and valuable core solutions, doing things that no other company can do well, and then leave all the simple auxiliary actions (like integrating between Twitter, email, Salesforce, Dynamics CRM, Excel, FTP, Freshdesk, Instagram, MailChip, Jira, Mandrill, SharePoint, OneDrive, and more) to Logic Apps. They are quick to make, easy to change, and are a truly enterprise-level solution.
If you have a more complex integration needs, if you have serious performance needs, then by all means – break out the REST APIs, break out the NuGet packages, get to writing code. Until then, my advice is when it comes to integrating with third party services either to or from your own applications, consider using a Logic App first and see how far you can get with it. You might be surprised with how far you get.
So, you might be left wondering, how do I get started?
Editing Directly In Azure Portal (Good)
Adding Logic Apps and connecting them to other things via the Portal is a great way to get started. You can look at how to add your own Logic App in the Portal in Microsoft’s documentation, so I won’t go into great detail here. At a high level, you can go into the Resources and add a new resource, pick Logic Apps, and start choosing where you want data to flow from, where you want data to flow to, and how you want to make logical decisions along the way. All with a pretty GUI.
That’s great, of course, but how do you get developers involved? If we’re integrating with other systems, including our own, we ought to make it easy for developers to start creating Logic Apps (even though they don’t have to think about code), right? Yes! And you know what, there’s a more developer-friendly way of creating and deploying Logic Apps — through Visual Studio!
Edit & Deploy Using Visual Studio (Better)
With the Azure Logic Apps Tools for Visual Studio 2017 tool from the Visual Studio Marketplace, one can easily develop Logic Apps in Visual Studio. Does that mean you are writing code? No! It’s all still through a pretty GUI. Although, admittedly, not quite as pretty as the Azure Portal experience. I’d imagine the bright minds at Microsoft are working on it.
To get started, you can open up the Cloud Explorer tab in Visual Studio 2017 and access that Logic App you created in the step above. Then, you can save the JSON file that it creates to source control, right click it and start editing. Wait, did I say JSON file? Does that mean there is code? Did you lie to me the whole time about there not being code, Jared!?!
Now, it’s in Visual Studio, great, how do I deploy to Azure? Well, you can right click on that JSON file, and click Publish, and then hook it up to your Azure account and away you go. You’ve published a Logic App from your local Visual Studio to Azure.
Of course, publishing directly from Azure from your own development machine might work well for one developer, but what if you’ve got a team? How can you make sure that old “it works on my machine” argument not crop up when it comes to deploying Logic Apps? And what about if you don’t want to deploy your Logic App until you’ve updated the rest of your application? This is where a build & release pipeline can come in and save the day.
Deploy Using Continuous Integration with VSTS (Best)
Ultimately, we’d like to treat Logic Apps as code, even though they are a GUI-centric solution, and you can leverage those ARM templates to enforce infrastructure as code. This means that you can describe the configuration of a Logic App in an ARM template, and from then on keep your ARM template (just that JSON file, don’t get scared) in your source control. Then, you can make updates to that as necessary to update your Logic App through Visual Studio, check it into source control, and deploy it to Azure through a continuous delivery pipeline.
Thankfully, there is a Release task in Visual Studio Team Services made specifically for deploying ARM templates. You can use this, point it to where you were deploying to from Visual Studio 2017, and then from now on you have a lot more control over when code gets deployed to Azure thanks to this centralized place where you can easily keep track of deployments.
I won’t pretend that making your first Logic App isn’t intimidating. It is. And as a developer, I’m often skeptical at GUI-based solutions supplanting code (heck, it seems like we’re going back to the command line more and more). That said, there’s a time and place for knowing when to write custom code and when to leverage other’s effort. I view Logic Apps as yet another tool in my toolbelt to stop reinventing the wheel and start solving unique and challenging problems.
And, with few downsides to boot. After my own experience with them, because I can treat ARM templates as code, because I can check the code into source control and integrate it into my development pipeline right alongside my other code, Logic Apps are one GUI-centric coding tool I will be using more in the future.