This article is more than 1 year old

Microsoft flings open Azure Functions to Java workloads

TypeScript tooling tweaks too, you lucky people

The Azure Functions gang has been busy while their HoloLens counterparts have been sunning themselves in Barcelona. Java workloads are now ready for production while TypeScript tools have seen an overhaul. We took both for a spin to see how they looked.

Java in Azure goes GA

Azure Functions is Microsoft's pitch at the serverless world, with devs able to take advantage of the benefits of sending portions of their apps cloudwards without having to worry about pesky infrastructure like Virtual Machines and their ilk. Or, er, performance.

The convenience afforded by the likes of Azure Functions (and AWS's Lambda) is hard to resist, however, and Microsoft is keen to emphasise that devs can build using the languages and tools of "their choice".

So long as the language is in the supported list, of course, which, for version 2.x runtime, included C#, JavaScript and F#. Java has now been added to the safe-for-production ledger.

Testing and debugging locally is also possible, so with gritted teeth we slung a copy of the Java Developer Kit on to a handy workstation. Version 8 is supported – don't be silly and try version 11 like we did. It didn't go at all well for us and eventually required a second, shamefaced download.

We then inflicted version 3.6 of Apache Maven onto our quivering Windows 10 machine, added the Azure Command Line and the Azure Functions Core Tools (which necessitated a recent .NET Core SDK) and were good to go. After fiddling with the environment variables, of course.

After tinkering with the LocalHost version of the function, and debugging some of Microsoft's helpful "Getting Started" instructions (because, after all, working out why something broke is the best way of learning how it works), deployment of the function to Azure via Maven was straightforward thanks to the Azure Functions Maven plugin.

Once deployed to Azure Functions, the Java can be invoked via a HTTP request or scheduled as an event. Data can be written back to the calling source without the dev having to deal with the underlying Java SDK.

TypeScript in Azure Functions

TypeScript, the superset of JavaScript that does the whole static typing thing before spitting out JavaScript, hasn't really worked too well for Azure Functions up to now.

Even though JavaScript is supported, dealing with idiosyncrasies such as the TypeScript's default folder structure made this tricky, excluding all but what Microsoft describes as "motivated" users from the FaaS party.

The gang at Redmond have updated the Azure Functions Core Tools and Azure Functions Extension for Visual Studio Code to make things a little easier, effectively supporting TypeScript "out of the box".

We fired up version 1.31.1 of Visual Studio Code to take a look at how it worked.

The answer is, pretty well. After our Java experience, we were well prepared for the URI funnies that awaited us, but the implementation in Visual Studio Code does an admirable job of simplifying things. Selecting TypeScript as the language for a new Function App gives the user a number of TypeScript specific function templates, each representing one possible trigger.

Credit where credit is due, once the code is in, firing up the function for local debugging and then deploying to Azure is a simple button click, or a command line function for those not keen on the GUI delights of Visual Studio Code.

The latter will, of course, be more of interest to those looking to put together a DevOps pipeline rather than the occasional Visual Studio Code user. ®

More about

TIP US OFF

Send us news


Other stories you might like