My Love/Hate Relationship with Azure Functions
I want to put this right up front at the start, I love Azure Functions. I love that they can be written in different languages. I love how easy it is to get started with them. I love how flexible they are.
I also hate them a little bit too. I'm pretty sure I've only scratched the surface of Azure Functions so far. I started off writing my function in the Azure Functions Portal. I did one as a proof of concept to make sure they solved the problem I had and it worked brilliantly. I had some problems with the practicalities of using the portal UI to write my functions though:
- There was no intellisense (lazy I know but after 10 years of having it, it's difficult to get used to not having it)
- Referencing other assemblies, while possible, felt a bit awkward
- It's not part of my CI pipeline. I could source control a file, but I would just be copying & pasting it from the portal UI & deployments through environments would be a pain
- I had no local development environment for the functions
I really wanted to add Azure Functions to my stack. I was already thinking of beneficial ways they could help me with architecting the system. My first step towards properly adding Azure Functions to my stack had to be for me to move away from using the portal UI and integrating them with my CI, with the ability to better control deployment and having the functions fully source controlled. I followed the blog post here on Publishing a .NET class library as a Function App to help me achieve this. It took me about 2 days to get everything working and I had various problems along the way. The problems were mostly related to the specifics of what I was doing in my function than anything to do with the function itself. So I could tick off my biggest issue on my list. My Azure Function was in source control, and I had builds on my build server for CI. As a side effect of how I'd achieved this, I'd also solved the other 2 problems I had so I could tick those off too. My Azure Function was now technically just a class library so I had my intellisense back and it was easy to reference other assemblies again.
My final hurdle was a better local development environment. Up until this point I had been making changes to my local API, which was putting a message on my service bus queue that was on my development environment, so that my function could pick it up and process it. It was not ideal, pretty far from it! So I sat down with this post to help me Develop and run Azure functions locally. This probably took me approximately a day due to some teething issues getting things working, but I'm finally there! I can now use the Azure Functions Core Tools to host the function locally so I can develop and test everything locally before I push any changes.
So you're probably wondering where the hate is in this relationship. I hate that I'm not more familiar with them! They're pretty new anyway, so that on top of the fact they're also pretty new to me and I'm only using them a little bit at the moment means that I get somewhere with them, then don't need to look at them again for a while. When I get around to looking at them again, I get frustrated at the hurdles I hit. I tweeted about it a few days ago after my first hour of being back in functions world...
Back on #AzureFunctions today after not doing anything with them for a while. I'm looking forward to when I feel comfortable with them 😄— Sarah Williams (@ff0brickcode) June 2, 2017
I guess the hate in this relationship isn't for Azure Functions themselves, but more for working with a part of technology that is so new and rapidly changing. It's something that we really should be used to in our industry. I actually love how it challenges me and the fact that I'm learning something new. But damn, it frustrates me too!