Making Sense of Azure Functions Routes

When you initialise a new HTTP trigger function using the Azure Functions CLI, you are prompted for the name for your function. This name is used for the folder within your project but also the name of the function itself. There are also some default configuration settings for the URI that will be used when you publish your FunctionApp.

Route Prefixes

When you create Azure Functions project which has HTTP endpoints all function routes by default are prefixed with api e.g. myFunctionProject/api/<functionName>. This is fine for most cases, but it can be confusing as it is not very descriptive.

You can however customise this URI route within your Azure Functions project so that it can be more useful.

Read More …

Multiple GitHub Account Management

If you have multiple github accounts then you will very quickly become aware of an annoyance of having to manage your git config for each repository. If you don’t want to commit as the account configured in your global .gitconfig then you have to remember to set your username and email on each repository that you clone or create.

If you don’t become aware of this then you will quickly be searching StackOverflow for how to amend the last commit author.

Read More …

Secret Santa Generator

This year I was designated to organise secret santa for the family 🎅

Naturally I opted to be a total nerd about it and use PowerShell to randomly generate who would be gifting presents.

Ho Ho Ho

I started out knowing the list of people taking part, even if they didn’t know they were participating at the time and I would just randomly assign them someone to buy a present for……simple right?!

Read More …

Parsing Docker Output with jq

There was a question that came up in the PowerShell discord last week which was an interesting question which ended up with 3 entirely different answers from different people which is interesting to see how different people approach a problem.

Goal!

The goal is to get a list of images from docker images command and delete them with docker rmi
Read More …

git add --patch - Selectively track changes within a file

If there is one thing I have learned whilst using git is that you never really stop learning git!

Scenario

I am working on fixing something in a project and whilst doing so I notice something else which needs to be fixed. Now I could go and raise an issue against the repo to remind myself that it needs to be fixed, alternatively I could add a TODO in the code and there are extensions which track that for you.

Or if you’re really clever you can fix it straight away and utilise git to selectively track changes within the file.

Read More …

Making The Switch to MacOS

WARNING! - Long Post Alert…..Again.

I previously wrote a post on this which was very popular as I tried to document all of my productivity hacks and shortcuts that I use on a daily basis to assist in writing PowerShell. That post is My VSCode Setup.

I have since moved from a Windows laptop to MacOS so I wanted to make a note of customisations and changes so I had a place to track all of them but other people may also find some of them handy.

Some stuff won’t have changed too much because, well…..there was no need but my way of working has shifted slightly and I spend more time with a split terminal between bash and PowerShell.

Read More …

Azure CLI vs Azure PowerShell - Why not both?

I see quite a bit of conversation about whether people prefer Azure CLI or PowerShell for managing their Azure resources and if like me, you have come from managing on-premises workloads before moving over to managing cloud magic, you will likely want to use the tools that are familiar to you. So naturally I tend to lean towards PowerShell but I have been using the CLI more frequently so I wanted to highlight that it doesn’t have to be one or the other.

The Azure PowerShell module is now on it’s 3rd iteration. You had the original Azure module followed by AzureRM and now you have the cross platform Az module.

The Azure CLI, if you’re used to powershell, is not very familiar syntax wise, it has very limited tab completion and the more in depth you go you have to start referencing the docs for things like JMESPath query language.

Read More …

PowerShell & Azure Functions - Part 1

I have been using Azure Functions for a little while and I published my initial thoughts on Azure Functions and their use cases here.

In this post I want to cover how to get started with Functions and a few lessons learned and I wanted to collect together the documentation I used to get up and running which at present lives in various places on the Microsoft Docs site.

What are Azure Functions

Simply put they are a serverless solution in Azure which allow you to run code without having to worry about where it is running or maintaining the underlying infrastructure.

Read More …

Developing PowerShell Azure Functions Locally in a Container

I have recently just switched work machines from a Windows laptop to a Macbook. I’ve not had much exposure to anything other than Windows but I live on the command line most of the time and 'mac' -eq 'linux' anyway right?

Keeping My Machine Tidy

Part of this switch I made it my mission to try and keep my machine as tidy as possible and with that I didn’t want to immediately go and install a load of stuff that I was then going to have to manage and update…..especially when i only needed some of it for specific projects.

I have been spending a considerable amount of my down time watching people do live coding on twitch and in particular Michael Jolley (Twitter) and I was particularly intrigued by him showing how he develops inside of docker containers so I decided to give it a try.

Read More …

Azure Functions - Event Driven, Serverless Functions

I’ve been spending a signficant amount of time developing and playing with PowerShell for Azure Functions since they were V1 and they were not as good as they could have been.

Fortunately they have been in V2 for quite some time and went to General Availability as of Ignite in November ‘19. This means that they can “officially” be used for production workloads with official support.

Drawing a distinction between other Azure Offerings

So my initial reaction when I started playing with PowerShell in Azure Functions was that they were so much nicer to work with than Azure Automation but the more I played with them, the more I realisd that they were NOT a direct replacement but an accompaniment.

Azure Automation is still very useful for automation and long running tasks such as reports and Azure Functions really shine when you want event driven actions.

Read More …