Reducing Azure costs

A few years back I developed a booking and payment system for my mountaineering club (Dundee Mountain Club). Although the system is fairly straightforward functionally, it consists of quite a few software components which I landed up hosting on Microsoft Azure. The components include:-

  • A website (App Service) to allow bookings (on a domain
  • A managed SQL database for storing users, authentication, payment tokens, meets, events etc.
  • A worker process for synchronizing the database to Google Sheets (a neat solution – see this post). This is running on an Azure WebJob linked to the App Service
  • A simple API consumed by mobile and web clients

I was eligible for an Azure “Bizspak” subscription, which essentially allowed hosting all the above (and more) free for up to 3 years.

And, you can guess the problem! 3 years lapsed and I started getting charged nearly £70 a month! For a small club, this was not sustainable, so I had to look at ways of reducing the costs.

Step 1) Downgrade App Service from “Basic” to “Free” tier

Problem: Domain ( and SSL certificate (required for payment and social login callbacks) not supported on the free tier!

Solution: Remove the domain and use .azurewebsites subdomain which has free wildcard SSL certificate – i.e. ->

This involved a little work updating the authorized domains on social logins and the callbacks from GoCardless payment gateway, but overall this change ended up saving around £40.92 / month + VAT


Step 2) Fix WebJob (worker process) that no longer runs continuously

On the ‘free’ app service tier, we can no longer have the option for websites and web jobs to be “always on” (or run continuously). This effectively means that after around 20 mins of inactivity the service stops.


Thankfully, I only need my WebJob to be active after activity has occurred on the website (e.g. to update the Google Sheet after a new booking is made or a call-back is received from the payment service)

WebJobs provide a “hook” that can be called to start them (see below screenshot from Azure dashboard):-



So I created a simple service which calls this on activity on the website.

public class WebJobWakeUpService : IWebJobWakeUpService
    public async Task Execute()
        var client = new HttpClient();
        client.BaseAddress = new Uri("");

        var byteArray = Encoding.ASCII.GetBytes("username:password");
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

        await client.PostAsync("triggeredwebjobs/MeetSignupWorker/run", null);

public interface IWebJobWakeUpService
    Task Execute();


I call the WebJobWakeUpService.Execute() from my website app_start and any controllers where I know that the job needs to be active (e.g. the event signup controller). This ensured my web job was always running when it needed to be.


Step 3) Reduce Service Bus

The app and web job was using Azure Service Bus Standard to communicate. E.g. when a new meet attendee was added, a message was added to a queue which was picked up by the worker to sync the Google Sheet.

I didn’t need many of the features of standard like transactions and de-duplication, so it was possible to downgrade to “Basic” service bus saving around £7.50 per month


Step 4) A note on Azure SQL 

The database is pretty small – only around 10Mb of data. It is possible to get one 30 Mb SQL database for free by using a quick start. However, after a few failed attempts to do this (see below), I found that it is only possible to do this in the first year of a subscription.

“Within the Free tier, you will have 5 DTUs and 32 MB of shared storage. This free DB trial will end in 0 days, after which it will be upgraded to Basic. “

I ended up settling for the minimum database tier (Basic, 5 DTU, 100Mb) which costs approx £3.65 a month + VAT


Overall the system remains stable and there are only 2 visible changes to the user:-

  1. The website address now contains
  2. It is a little slower, particularly on the first load.

However, given the application is used by a small club, both these changes are acceptable tradeoffs to reduce the cost from over £600 a year to around £60 per year.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.