Docker

Accessing raw dd images in a Docker Linux container

I was backing up a Linux server of mine the other day and I wanted to have a full backup (along with regular tar.gz backups) of the main disk mounted on the /dev/sda partition. You can backup your partition using dd with a command such as dd if=/dev/sda | dd of=/home/archive/disk.img If everything works, you will get an output similar to below:

I was then looking to mount that backup raw image in order to check if everything was OK. You can do that by using the loop device in Linux. A loop device is a pseudo (“fake”) device (actually just a file) that acts as a block-based device1. My main OS is Windows and I did not have access to a Linux…

Read more
Azure

Live notifications from an Azure Keyvault to your Slack

In a world where monitoring is key for sensitive information, or even for alerts that can put your system down (such as an expired certificate), it is necessary sometimes to be alerted “right away”. Azure Alerts are great, but they have a delay, as the data needs to get ingested into your analytics and then need to run with the alert frequency you have set for you to be aware that something is going on. In this post I will show a way where you can be alerted somewhat instantly. We will consume 2 types of event data from a keyvault, that is the diagnostics AuditEvent and the events that Azure provides us out of the box. Once consumed, we…

Read more
AzureFunctions, Personal

Introducting Azure Functions Slack binding

I am proud to announce the first version of my Slack Azure WebJobs Extension. The binding extension eases out the integration with Slack for sending messages. It also includes an easy way to create rich messages using Slack’s Block Kit. The blocks and its related elements also have implement validation to adhere to Slack’s API validation rules. This helps to have a first level validation before sending the requests to Slack and get a response of type 400: invalid_blocks. You can find the extension here. So for the ones who care a little bit more, here’s a of bit of context as to why I spent some time creating the binding extension. I was looking for an easy way to…

Read more
Debugging, Tools

Changing requests status codes to test your front-end behaviors

A developer I work with came across an interesting problem where he needed to test the error handling on the front-end side of a SPA without adding extra “hacks” in the APIs that were consumed by the front-end. I helped him with this task, without adding “hacks”, by using Fiddler. Setup Download yourself a copy of Fiddler. Once installed, you need to configure Fiddler to intercept and decrypt HTTPS requests (as I hope your APIs are chatting on HTTPS). To do so, go in Tools -> Options and under the HTTPS tab, check Capture HTTPS CONNECTs and Decrypt HTTPS traffic and select …from browsers only. Accept all the dialogs that come after checking all of those. You will see that…

Read more
Azure, DevOps

Automating your OpenAPI updates to API Management through your CI/CD pipeline

Microservices are the trend in today’s day and age, even if you may have read that some are going back the monolith way. Most microservices architectures are built to communicate through REST: each service is an API that shares a contract for other services to consume. Since your product ecosystem will (hopefully) evolve over time, your contracts are to evolve overtime as well. If you decided to consolidate your contracts consumption into one point of entry (using the API Gateway pattern), how do you actually make sure that those contracts are properly updated in your gateway for each of your environments up to your production environment? In this post, I will show you how you can update your APIs contracts…

Read more
Azure, SQL Server

Backing up SQL Server databases to Blob Storage using Impersonation

One of the main goals I’m trying to achieve when developing solutions is giving as much autonomy to individuals and teams while still keeping the boat tight. I had an interesting challenge that came up recently where a developer was doing massive changes in the data and needed to take incremental backups of the database, as he was working, to give himself a safety net in case he screwed up. We can say this is the source control way, database style. The physical hardware space of the server is limited. Taking backups often can become expensive in terms of size. Thanks to the SQL Server team, we can backup (and restore) a database to (or from) an Azure Blob Storage….

Read more
Server administration

Connecting to Windows Server 2019 core through WinRM and Windows Admin Center

If you’re familiar with the Microsoft offering, Windows Server 2019 Datacenter Core does not have a UI. My goal was to be able to connect to it remotely, without having to remote desktop on it (the remote desktop is only a command line prompt). There’s plenty of articles around the internet about WinRM, but I wanted demonstrate here a quick way of getting started without researching too much. Thanks to Scott Sutherland WinRM cheatsheet and Matt Wrock post on understand and troubleshooting WinRM. For this demo I provisioned a VM on Azure, using the Windows Server 2019 Datacenter Core Image. I also installed the Windows Admin Center, which you can download from here. TL;DR Open PowerShell Enable WinRM: Enable-PsRemoting -Force Make…

Read more
Azure, DevOps

Migrating your applications to Azure using Virtual Machine Scale Sets, Packer and Virtual Machine extensions – Part 3

This is a continuation of the previous post about migrating your not ready cloud application to the Azure cloud. The last post discussed about creating a managed image to be able to be used by a virtual machine scale set for provisioning. What will we do in this series I decided to do a series of posts about this topic as it touches a variety of aspects. I will use a concrete example that may or may not have happened to you and I plan to cover Building a managed image from an Ubuntu image as base, and setting up a web server (Tomcat for instance) to host an application Creating a Virtual Machine Scale Set using ARM templates Adding…

Read more
Azure

Migrating your applications to Azure using Virtual Machine Scale Sets, Packer and Virtual Machine extensions – Part 2

This is a continuation of the previous post about migrating your not ready cloud application to the Azure cloud. The last post discussed about creating a managed image to be able to be used by a virtual machine scale set for provisioning. What will we do in this series I decided to do a series of posts about this topic as it touches a variety of aspects. I will use a concrete example that may or may not have happened to you and I plan to cover Building a managed image from an Ubuntu image as base, and setting up a web server to host an application Creating a Virtual Machine Scale Set using ARM templates (this post) Adding a…

Read more
Azure

Migrating your applications to Azure using Virtual Machine Scale Sets, Packer and Virtual Machine extensions – Part 1

So you are ready to move your application to Azure but it is not fully optimized for the cloud. You looked into App Services (web apps), but to be able to really get the best of them, it would need some definitive improvements in the code. You go back to your team and management and propose them a lift and shift that would make everyone happy. You then plan your improvements in your timeline and estimates. How can you effectively lift and shift your application so that it can be highly available (within one region) and scalable? In this series of posts, I will show you how you can package your application in an image and have it ready for…

Read more
C#

Getting feedback from EntityFramework Core through diagnostics

Have you ever wanted to get some diagnostics information about Entity Framework Core when it comes to the actions it’s doing such as when a command is executing or executed, when it’s opening a connection to the database or even when there’s an error, to name just a few? I was searching for a way to be able to get the duration of the query it was executing. I was glad to find out that Entity Framework Core hooks itself into DiagnosticSource, a simple module that allows code to be instrumented for production-time logging of rich data payloads for consumption within the process that was instrumented.1 Getting hooked into the diagnostic pipeline DiagnosticSource uses the observer pattern to notify its observers. If you…

Read more
Azure, PowerShell

SSL certificates management using Lets Encrypt, Azure Automation and Web Apps

I’ve been doing a lot of automation lately in regards to SSL certificates and Lets Encrypt. As you know, and I’m sure you are the same, I do not like redoing stuff over and over when I can just automate the process. Azure Az PowerShell modules gives us a lot of flexibility for that and I like to take advantage of it. In this post, I would like to guide you on how you can achieve Automating the generation of Lets Encrypt certificate to your Key Vault using Azure Automation Updating the certificate on your App services so that you can rebind it to your Web Apps Automation of generation of Lets Encrypt certificate(s) Lets Encrypt has a way of…

Read more
Azure, PowerShell

Finding the SKUs of Azure VMs images with Powershell

I always struggle to know what to put in the imageReference node of the storageProfile node for an Azure VM when I want to automate the creation process through ARM (Azure Resource Manager) templates. We can find all of those using the Azure PowerShell modules. Below is a small script to automate the creation of the imageReference node where you can find and filter through the different location, publishers, offers and skus to get what you need.

Happy ARMing!

Read more
C#, Docker

Running an ASP.NET Core application targeting .NET Framework in Docker

Recently, I’ve came across an interesting challenge that was to dockerize an ASP.NET Core 2.2 application targeting .NET Framework 4.7.2. The reason this application was targeting .NET Framework was because it was using a library that unfortunately had no plans to move to the .NET Core platform. That library was a port from Java. As such I had to take a decision: rewrite the whole application in Java to support this library more natively, or try to find an alternative library that did the same thing. Sometimes it’s better to sleep on such decision. Well it paid off. I had forgotten that possibly I could use mono to run it. I took this as a challenge and used one of…

Read more