# Postponing Azure VM Auto-Shutdown From Your iPhone

I normally use Azure Devtest Labs for managing the remote environments I work in, but now and then I have to set up standalone VMs outside a lab, and the first thing I do in the case of a cost-intensive resource (like, say, a GPU-enabled machine where I’m training a neural network1) is set up an auto-shutdown timer (usually for around dinner time).

This is supported on all VMs now – automatic power-on isn’t yet supported outside Devtest Labs, which is sad, but I’m hoping it will surface some time in the future.

The one catch with this approach is that I often need to keep working for a while, and I’m invariably not logged in to the right subscription (or even to the portal itself) when auto-shutdown kicks in, so I’m often caught by surprise (often when I’m actually logged in directly to the machine).

Going over to the portal in a hurry and trying to find the right machine amidst hundreds of resources is a major pain and completely breaks my flow, so in order to avoid chagrin and interruptions I’ve been looking into ways to have a bit more control over auto-shutdown.

That led me to investigate Azure infrastructure web hooks – you can define hooks for metrics alerts, and as it happens Devtest Labs also has an auto-shutdown hook. After a little searching and asking around (because it’s still somewhat hard to find this in the docs outside the context of Devtest Labs), I figured out that the Schedules > Auto-shutdown web hook available for any VM works exactly the same as the ones in Devtest Labs).

So I went over to Microsoft Flow, logged in and created a new flow with a Request node and a Send me a mobile notification node, like so:

To provide the required field bindings for the data sent as part of the web hook call, I pasted in to the Request input box the following schema:

{
"\$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"delayUrl120": {
"type": "string"
},
"delayUrl60": {
"type": "string"
},
"eventType": {
"type": "string"
},
"guid": {
"type": "string"
},
"labName": {
"type": "string"
},
"owner": {
"type": "string"
},
"resourceGroupName": {
"type": "string"
},
"skipUrl": {
"type": "string"
},
"subscriptionId": {
"type": "string"
},
"text": {
"type": "string"
},
"vmName": {
"type": "string"
}
},
"required": [
"skipUrl",
"delayUrl60",
"delayUrl120",
"vmName",
"guid",
"owner",
"eventType",
"text",
"subscriptionId",
"resourceGroupName",
"labName"
],
"type": "object"
}


…and I then added the delayUrl60 link as the notification link.

This lets me conveniently postpone shutdown for an hour without having to log in to the portal (or anywhere else) – I just do it straight from my iPhone in a couple of taps (first the notification and then the link inside the Flow app), which is quick and easy enough to not break my flow.

A minor thing, I know, but so useful that I thought it needed more exposure.

Update: Here’s what it looks like on the phone. And yes, that’s a Douglas Adams reference:

1. I haven’t written anything about the deep learning stuff I’ve been doing (just like I haven’t blogged about Kubernetes and other container-related stuff), but that might change in the future – I’ve been sticking to my Disclaimer, but I realize that there’s a lot I can actually write about, once I find the time to do it properly. ↩︎

# The MacBook Pro, My Mid-Life-Crisis Laptop

I’ve been using the late 2016 MacBook Pro (13” Touch Bar) for around five months now, so I think it’s about time I gave it a review of sorts. I like to think of it as my mid-life-crisis laptop: it’s hideously expensive for what it does, comes with flashy, useless trimmings, and is more than a statement than practical because I can’t actually use it as my primary machine – and yet it is nice and oddly fulfilling.

# Living Inside The Updated Windows Subsystem For Linux

This weekend I finally caved in and nuked the Windows installation on my work laptop, which had been degrading a fair bit after moving to and fro between stable and Insider builds, plus assorted hacks I did prior to the Creators Update (which didn’t improve things on top of those). Considering I held off doing a full nuke & pave since October 2015 (which is when I got the machine), I’d say that the Windows install on it had a good run.

# Buffering...

Nothing much to report, other than I’ve managed to get caught up in entirely too many threads, with the rather fascinating result that I’m booked pretty much solid halfway through May. So much so that in order to be able to actually get stuff done, I’ve had to refuse a number of otherwise vastly more interesting engagements and put all my personal projects on hold.

It’s been around four months since I last wrote anything interesting inside a code editor, but spurred on by a few personal itches I decided I’d have another stab at it - and behold, snippets of code sprung forth, nearly unbidden. Time is as scarce as ever and my current role lends itself more to crossing out and re-drawing things on whiteboards than on coding them from scratch, but nevertheless I’ve been having fun with an unlikely combination of Docker, Cognitive Services and asyncio.