Recent Posts

Dependency substitution for legacy code

This post shows an example of how to introduced a form of dependency injection in to legacy code with minimal changes. I refer to this as dependency substitution because, in my view at least, there is a subtle difference between this and depdendency injection. With dependency injection, we are injecting the dependency via either constructor or property injection. The dependency is set once by ...

This post shows an example of how to introduced a form of dependency injection in to legacy code with minimal changes. I refer to this as dependency substitution because, in my view at least, there is a subtle difference between this and depdendency injection. With dependency injection, we are i...

Copying messages between SQS queues

This week I had the need to copy a load of messages from one SQS queue to another, below is the body of the Linqpad script I used to do it. void Main() { var seenIds = new List<string>(); var sidContainer = new DumpContainer("Seen Ids: ").Dump(); var sqsConfig = new AmazonSQSConfig { ServiceURL = "AWS_REGION_URL" }; var client = new AmazonSQSClient("A...

This week I had the need to copy a load of messages from one SQS queue to another, below is the body of the Linqpad script I used to do it. void Main() { var seenIds = new List<string>(); var sidContainer = new DumpContainer("Seen Ids: ").Dump(); var sqsConfig = new Am...

Bicep - Outputting connection string

One of the nice touches of Bicep are some of the helpers it provides you, specifically the environment() helper. This provides information such as Azure endpoints to save you hard-coding it. In my recent journey in to deploying SQL Database, I wanted to output the connection string. Naturally, I did what I do with ARM which is build up the connection string myself, as below: output MyConnecti...

One of the nice touches of Bicep are some of the helpers it provides you, specifically the environment() helper. This provides information such as Azure endpoints to save you hard-coding it. In my recent journey in to deploying SQL Database, I wanted to output the connection string. Naturally, I...

Bicep - A root resource type must have segment length one greater than its resource name

I was working on a Bicep script that would deploy an Azure SQL database server and a database. Below is an excerpt of the file with the relevant pieces: resource server 'Microsoft.Sql/servers@2021-02-01-preview' = { name: 'server${appname}${envtype}' location: resourceGroup().location properties:{ administratorLogin: 'adminuser' administratorLoginPassword...

I was working on a Bicep script that would deploy an Azure SQL database server and a database. Below is an excerpt of the file with the relevant pieces: resource server 'Microsoft.Sql/servers@2021-02-01-preview' = { name: 'server${appname}${envtype}' location: resourceGroup(...

Bicep - Create a storage account and retrieve SAS tokens

First thing first, I am really enjoying using Bicep. The intellisense is the real difference between that and something like Terraform, it makes discovery so much easier and creates a real flow to building Bicep files. The ability to get an ARM JSON file out of the Bicep script is also proving really useful when something isn’t working to figure out what I am doing wrong. I thought I’d just s...

First thing first, I am really enjoying using Bicep. The intellisense is the real difference between that and something like Terraform, it makes discovery so much easier and creates a real flow to building Bicep files. The ability to get an ARM JSON file out of the Bicep script is also proving r...

Terraform to Bicep - Part 2

Following Part 1, thought i’d write part 2 before I forgot/lost interest in doing so. In this part, I am just going to show a few examples of Terraform resources and the Bicep equivalents, including how I worked out what the Bicep equivalent was. For all of my editing, I am using VS Code with the HashiCorp Terraform and Bicep extensions. Storage Account Terraform resource "azurerm_stor...

Following Part 1, thought i’d write part 2 before I forgot/lost interest in doing so. In this part, I am just going to show a few examples of Terraform resources and the Bicep equivalents, including how I worked out what the Bicep equivalent was. For all of my editing, I am using VS Code with t...

Terraform to Bicep - Part 1

In what will hopefully be a multi-part series of posts, I’ll go over Terraform vs Bicep and cover translating a Terraform file to Bicep and cover the challenges I experience doing this and my thoughts as I go. What is Terraform? Terraform is a product from HashiCorp that provides a common way to build infrastructure and manipulate systems. It uses HashiCorp Common Language (HCL) and has a prov...

In what will hopefully be a multi-part series of posts, I’ll go over Terraform vs Bicep and cover translating a Terraform file to Bicep and cover the challenges I experience doing this and my thoughts as I go. What is Terraform? Terraform is a product from HashiCorp that provides a common way to...

Why document what you know?

I’ve been thinking for a while about writing this post and some recent realisations in my professional life has spurred me on to finally do it. This is just my view and my way of working. Your mileage may vary. Why documenting what you know benefits everyone. So why document what you know? As people in the tech profession, especially as part of a multi-discipline team (i.e. not just pure dev...

I’ve been thinking for a while about writing this post and some recent realisations in my professional life has spurred me on to finally do it. This is just my view and my way of working. Your mileage may vary. Why documenting what you know benefits everyone. So why document what you know? As ...

Automating Fortify scanning in Azure DevOps

Fortify is a really useful tool for scanning your code and reducing the chance of bugs or vulnerabilities making their way in to production. They even provide Azure DevOps tasks for integrating submitting your code in to your build pipelines. The documentation for how to actually set the whole process up is pretty poor to non-existent so below is what I did to get it working which I hope will ...

Fortify is a really useful tool for scanning your code and reducing the chance of bugs or vulnerabilities making their way in to production. They even provide Azure DevOps tasks for integrating submitting your code in to your build pipelines. The documentation for how to actually set the whole p...

Supporting SameSite None in .Net 4.6 or lower

As I write this post, it is 4 days until Chromium begins enforcing the new SameSite rules again. When they first did this in March, it caused a number of issues including breaking website integrations with some payment gateways. If you’re on .Net 4.7 or higher, Microsoft supports setting SameSite to None. The official recommendation is that if you want to use SameSite None, then you need to m...

As I write this post, it is 4 days until Chromium begins enforcing the new SameSite rules again. When they first did this in March, it caused a number of issues including breaking website integrations with some payment gateways. If you’re on .Net 4.7 or higher, Microsoft supports setting SameSi...