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 …

Tab Completion for Your Azure Subscriptions

If you work in Azure then there’s a good chance that you will have multiple subscriptions to manage, whether this is for various companies, various products or production & test environments.

If you do alot of interactive work in the shell for these subscriptions you’ll quickly find out how annoying it is to have to find the subscription names so that you can change between your subscriptions.

Lots of Subscriptions -eq Lots of waiting

Running Get-AzSubscription takes a while when you have lots of subscriptions

(Get-AzSubscription).count
32
 Measure-Command -Expression { Get-AzSubscription } |
    Select-Object Milliseconds, seconds

Milliseconds Seconds
------------ -------
         408       4

Read More …

Git - Reverting git Branch Changes The Easy Way

I was working on a proof of concept with colleagues which uses Azure Functions, AWS Lambda and utilises various REST API’s. One colleague had started work on the repo and created the function app, the terraform to deploy it via Azure Pipelines, another colleague had created the lambda and the cloudformation. I cloned the repo, made my own branch and started to add additional Azure Functions, CI ran and deployed the contents of the repository.

Read More …

Get DistinguishedName from CanonicalName

There was a topic came up in the Powershell Slack earlier this evening to see if there was a way to convert the CanonicalName from Active Directory to a DistinguishedName

I had a quick google figuring that something like that must have been done already but a quick google didn’t find anything that seemed to do the job.

There was a TechNet Script to go from DistinguishedName to CanonicalName but since that was removing content it was slightly simpler to do with string splitting and regex.

Crack Open The Regex ❤

I decided about 12 - 18 months ago that I was going to double down and force myself to learn Regex. This is a prime example of something you can play with so that was my first port of call.

Read More …

Microsoft Teams PowerShell Module is now Generally Available

I have been playing with the Microsoft Teams module for quite some time and undeniably, even though it wasn’t GA, it was disappointing and often required lots of wrapper functions for what I would have expected to be native functionality.

Now that it’s General Availability let’s see what changes have been made

Read More …