Stage failing in Azure DevOps pipeline

How to avoid global.json version conflicts in Azure DevOps

Sometimes in Azure DevOps, you have a project that’s being built with certain .NET version. It’ll require that particular SDK version, and most typically that is defined in global.json file. However, if you also need to install a certain .NET tool, running dotnet tool install MyBuildTool will fail. And it’ll fail before it actually tries to install the version of the tool you wanted to! This article explains how to…Continue reading How to avoid global.json version conflicts in Azure DevOps

bash - it's even more of a mystery than PowerShell

Azure DevOps fails with “Error: The path ‘/home/vsts/work/1/s/your-repo’ does not exist” even though the repository is there for sure?

Eh, this was a weird one. This article explains how to get around an issue where your build tools fail due to weird “path does not exist” errors when you’re using bash to execute a restore to your project. Build would probably succeed nicely, but it fails due to missing dependencies – in my case, at least the whole node_modules folder was missing. And of course it is – restore…Continue reading Azure DevOps fails with “Error: The path ‘/home/vsts/work/1/s/your-repo’ does not exist” even though the repository is there for sure?

Powershell is hell

Why do you get a “Missing closing ‘)’ in expression.” error when piping a collection to a for loop in PowerShell?

Today, I’m writing about a stupid error. Yeah, I do make those every now and then. After adding a for loop to my PowerShell script, I started to get annoying ParserErrors about my for loop missing a closing bracket. But it was NOT missing one – what gives? Problem So, what I was trying to do was to concatenate a kinda random collection of strings after the first few items.…Continue reading Why do you get a “Missing closing ‘)’ in expression.” error when piping a collection to a for loop in PowerShell?

I secretly automated my whole job with PowerShell

How to use Microsoft.Online.SharePoint.PowerShell with PowerShell 7?

This article explains an annoying extra step (or a really nifty trick – depending on how you choose to look at it!) that you can take to make sure your PowerShell 7 is able to import a module that was developed for .NET Framework, instead of .NET Core. This is super helpful when you run into weirdness with some of the more, let’s call them CLASSICAL, PowerShell modules. Such as…Continue reading How to use Microsoft.Online.SharePoint.PowerShell with PowerShell 7?

SharePoint is not broken - it just does't work

How to fix “The website does not support SharePoint Online credentials. The response status code is ‘Unauthorized'”

Whilst running some SharePoint Online PowerShell commandlets, or connecting to a SharePoint Online site from your app, you get the following (or similar) error about your SharePoint Online credentials being unauthorized for something you should definitely be authorized to do: Cannot contact web site ‘https://[tenant]-admin.sharepoint.com/’ or the web site does not support SharePoint Online credentials. The response status code is ‘Unauthorized’. And that’s not all – by digging into the…Continue reading How to fix “The website does not support SharePoint Online credentials. The response status code is ‘Unauthorized’”

Microsoft Azure logo

How to refresh all Az CLI subscriptions?

This article explains how to “reactivate” all of your accounts stored in your az account by refreshing your sessions. You might need this if you suddenly run into a script that needs to iterate all of your subscriptions without you being there to sign in to each one of them. Having a recently active session for each will help, and you can run your massive script unattended overnight or something…Continue reading How to refresh all Az CLI subscriptions?

Powershell is hell

Solving “Unable to find repository ‘https://www.powershellgallery.com/api/v2’.”

So, you’re running a PowerShell command that requires a connection to PowerShell gallery, but you run into an error message, somewhat like this: “Unable to find repository ‘https://www.powershellgallery.com/api/v2’. This can happen when you’re running something like Install-Module or Update-Module. This pretty much blocks you from doing anything that would require the use of new modules – so, quite a lot. Worth fixing, then. 😁 Problem The whole error message might…Continue reading Solving “Unable to find repository ‘https://www.powershellgallery.com/api/v2’.”

Printer's misbehaving? Nothing a bit of PowerShell wouldn't fix!

How to change printer paper size using PowerShell?

This article explains (with conveniently copy-pasteable code samples) how you can query your printers using PowerShell and modify properties, such as paper size, for one or more of them. This is very useful if you have multiple printers and multiple computers that you use. AND if you frequently move between continents, you might face the same, totally typical and widespread issue: Your favorite printer might default to using “Letter” paper…Continue reading How to change printer paper size using PowerShell?

PowerShell not loading them DLLs

Listing all of the assemblies loaded in a PowerShell session?

In this article, I’ll do my best to explain how to list all loaded assemblies in a PowerShell session. You see, PowerShell is great at caching assemblies in the weirdest possible way, so ending up with all kinds of mismatches in loaded DLL versions is pretty common. Or just being plainly blocked from loading a new one as you already have a cached reference. I mean, I’ve run into all…Continue reading Listing all of the assemblies loaded in a PowerShell session?

Powershell is hell

How to fix “System.InvalidOperationException: PowerShell Gallery is currently unavailable.”

This article explains how to fix an issue when updating a module in PowerShell. The error is something along the lines of: “System.InvalidOperationException: PowerShell Gallery is currently unavailable. Please try again later.” The whole error looks something like the one below, although you can probably get it for many different commandlets. The main point is the latter part of the error: PowerShell Gallery is currently unavailable. This, quite simply, stops…Continue reading How to fix “System.InvalidOperationException: PowerShell Gallery is currently unavailable.”