Azure Blob Commands

Photo generated with AI by https://stablediffusion.fr/
Photo generated with AI by https://stablediffusion.fr/

I run a few of my workloads on VMs in Azure. Some of them deal with data and content that changes over time, and accordingly I like to have the data backed up periodically. Microsoft provides the AzCopy tool for uploading files to Azure blob storage alright, and it works very well with managed identities assigned to VMs (and other services in Azure).

But some of the same properties that apply to data also apply to the backups of that data: their value diminishes over time, so keeping backups for an extended amount of time is pointless. Accordingly, I always want to delete old backups after some time.

read more →

Generate Code with NSwag

Photo by Markus Spiske: https://www.pexels.com/photo/coding-script-965345/
Photo by Markus Spiske: https://www.pexels.com/photo/coding-script-965345/

First, let me state this more precisely: this is a post about generating c# code for ASP.Net Core from an Open API definition at build time using NSwag. If you’re looking for steps to generate code by using the NSwag toolchain manually, you won’t find that here. If you’re looking for a way to generate an Open API definition from an existing ASP.Net Core app using the NSwag toolchain, you won’t find that here either. In that latter case though you’ll get a statement from me telling you that for a professional service you probably shouldn’t do that: you wouldn’t define your interfaces after making the implementation either, right?

read more →

Copy files with PowerShell Remoting

Recently at work, I found myself in the situation where I needed to copy some file from my workstation to a jump box. Now of course, on Linux I’d just use rsync or scp. But our IT doesn’t like provisioning Linux boxes and therefore uses Windows for jump servers too, so no luck here. Luckily, I could convince them to turn on and allow PowerShell Remoting, so with some simple scripts I can still easily copy files over without using SMB. Here’s how.

read more →