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 …

PowerShell Core & Docker Test Environment

So I recently had a requirement to run some scripts in an isolated environment where I didn’t want to test on my machine but throwing up an entire pipeline was overkill and frankly not needed for the basic testing that I wanted to do.

I had used docker before but not for a long time and I didn’t really grasp it properly the last time I tried and reality did not meet expectations. Now that I predominently live in the console in one way or another I figured why not!

Read More …

Setting up VsCode For Productivity

WARNING! - LONG POST ALERT

Visual Studio code has quickly become the tool of choice amongst developers and system admins due to it’s flexibility of dealing with most scripting/programming languages you can throw at it. The fact that it is cross platform and is now being actively developed in preference to Powershell ISE means that it’s hard to ignore such a brilliant editor.

I have posted a few things on Twitter in the past showing some tips or techniques and they always seem to be very well received so I thought I would outline some of the more detailed things I use which benefit me when writing Powershell.

Read More …

Building a Test Lab with Lability

Any system administrator that has dabbled with PowerShell will have likely started by running commands against a production Active Directory domain. This is generally because the production AD domain is all that is available to them. I have worked places where a replica test AD forest was configured but it was laborious to maintain and in most cases was more peace of mind than actually replicating production.

So you tell yourself:

You’re fine just running Get commands as you can’t break anything

Read More …

Split a SubFolder into a New Repository

So I recently encountered an issue where I needed to extract a number of subfolders out of a Git repository so I could move them into their own repository/project.

I am no git expert and easily and quite frequently end up in a git mess so I took to the Powershell Slack to ask the more knowledgable folk there to see if anyone had already done it. I figured it was possible as most things are possible with git but easily achievable is another thing

Read More …

GitOps - Git For Ops People

I want to show you that even as someone who works solely in Ops or Support, embracing Git as a tool will save you time, effort and it doesn’t have to be as complicated as it first seems.

If you answer Yes to any of the following then this blog post is for you:

Git seems daunting, why do I need to learn new software when what I currently do works?

I’m not a developer so why do I need developer tools?

I’m the only one that uses these scripts, so is there any point?

My scripts are only 20 lines long, why do I need source/version control?

Read More …