All guidesAzure virtual machines

How to let clients start and stop their own Azure VMs without portal access

Four ways to let a client switch their own Azure virtual machines on and off, with the exact permissions each needs and when to use which.

6 min read

A client wants to switch their own Azure virtual machines on and off. Usually it is to save money out of hours. Sometimes a test server is only needed on Tuesdays. Either way, you do not want to give them the Azure portal.

There are four ways to do it. They differ mostly in how much you build and how much you maintain. This guide walks through each one, with the exact permissions involved, and ends with a table for choosing.

It is one of the requests covered in how MSPs cut routine tickets with client self-service.

Why clients ask, and the detail that decides whether it saves money

A virtual machine that nobody is using still costs money while it is allocated. Development servers, training machines and the box that only runs at month end are the usual candidates. The client would rather switch them off than pay for them, and would rather not wait for you to do it.

One detail decides whether switching off saves anything. Azure has two stopped states, and Microsoft bills them differently:

StateWhat it meansCompute billed
StoppedStill allocated on a host, but not runningYes
Stopped (deallocated)The hardware has been releasedNo

Disks and networking carry on costing money in both states. Shutting down from inside the operating system leaves the machine allocated, so the bill does not change. Whichever route you pick below, make sure its stop action deallocates.

Option 1: a custom role in Azure

The obvious built-in role is Virtual Machine Contributor. It is far too wide for this job: it lets someone create, resize and delete machines, not just power them. The built-in roles that are limited to power actions are written for Azure Virtual Desktop. So for ordinary machines you write a custom role. Microsoft's own custom roles page uses a "Virtual Machine Operator" role as its example.

The role needs five actions:

Microsoft.Compute/virtualMachines/read
Microsoft.Compute/virtualMachines/instanceView/read
Microsoft.Compute/virtualMachines/start/action
Microsoft.Compute/virtualMachines/restart/action
Microsoft.Compute/virtualMachines/deallocate/action

The two read actions let the person see the machine and its power state. Leave out powerOff/action unless you have a reason for it: it stops the machine without deallocating, so it keeps billing.

A custom role can be made assignable at management group, subscription or resource group scope. Assign it as narrowly as you can, on the resource group or on the machine itself, to a named person and not a shared account.

What it costs you:

  • The client needs an identity in the tenant and has to sign in to the Azure portal or the mobile app.
  • They have to find the machine in an interface built for administrators.
  • You maintain the role and its assignments for every client.
  • Your brand is nowhere in it.

It is free and it is native. For one technical client it is often enough.

Option 2: schedules and auto-shutdown

If the hours are fixed, nobody needs to press anything.

Auto-shutdown is a setting on the virtual machine itself. It turns the machine off at a set time, with an optional warning beforehand. The setting covers shutdown only. Its steps do not include a scheduled start to match.

Start/Stop VMs v2 is Microsoft's packaged answer for both directions. It deploys Azure Functions, Logic Apps, a storage account and Application Insights into your subscription and starts and stops machines on schedules you define, across subscriptions. Two things to know before you adopt it. Deploying it needs the Owner role on the subscription. And at the time of writing Microsoft files its documentation under previous versions and says it will get no further development.

A scheduled runbook in Azure Automation does the same job with less to deploy, if you are comfortable writing and maintaining the script.

Schedules are the cheapest route when the pattern never changes. They fail the case clients actually raise tickets about: "I need it now, and it is Saturday."

Option 3: your own button

You can put a button in front of the client and keep Azure behind it. The usual shape is an Azure Automation runbook or a Logic App that starts or deallocates a named machine, triggered over HTTP from a form or a small internal page. The automation's own identity holds the permissions from Option 1. The client never signs in to Azure.

It works, and for one client with in-house skills it can be the right answer. Count the whole job before you start:

  • Who may press it. The trigger needs its own sign-in and its own list of who is allowed. A bare webhook address is a secret that anyone holding it can use.
  • Which machine. Every client and every machine is configuration you now keep.
  • What happened. Azure records that the automation acted. Recording which person asked is yours to build.
  • When it fails. The client needs to see that the start did not work, and so do you.
  • Who looks after it. It is a small product, and it needs an owner for as long as it runs.

The first version takes a weekend. The list above is the rest of the work.

Option 4: a client portal

A client portal product is Option 3 built by somebody else and kept up for you. It holds the connection to Azure, shows each client only the machines and actions you allow, and puts your brand on the page they sign in to.

The products differ, so ask five questions before you choose one:

  1. What does it ask for in Azure? Ask to see the exact role. It should be the short list from Option 1, not Contributor.
  2. Does stop mean deallocate? If it only powers off, the bill does not move.
  3. Can you set permissions per person? Seeing a machine, powering it and scheduling it are three different levels of trust.
  4. Is every action recorded against a person?
  5. Where are the credentials kept, and whose name is on the portal?

Which to choose

OptionClient needs an Azure sign-inWorks on demandWhat you buildRecord of who did itBest for
1. Custom roleYesYesA role and its assignments per clientAzure activity logOne technical client
2. SchedulesNoNoLittle or nothingRun history onlyFixed hours that never change
3. Your own buttonNoYesEverythingOnly what you buildOne client, with in-house skills
4. Client portalNoYesNothingBuilt inSeveral clients, non-technical users

The options combine. A schedule for the working week plus a button for the exceptions covers most clients, which is why the portal route usually includes both.

How Task Ember does it

Task Ember is a white-label client portal for MSPs and IT teams. Its Virtual Machine Start/Stop product is Option 4, and it answers the five questions like this.

  • What it asks for in Azure. In the subscription that holds the machines you create one custom role, Task Ember VM Controller. It can start, power off, deallocate and restart machines and read their status. It cannot create, change or delete one.
  • Stop means deallocate. The client gets start, stop, pause and restart. Stop deallocates, so compute billing stops. Pause powers the machine off but keeps it allocated, so it still bills.
  • Permissions per person. Seeing a machine, powering it and setting its schedule are granted separately.
  • Schedules as well as buttons. Each workspace can hold a schedule of days and times in its own time zone, and the buttons cover the exceptions.
  • A record. Every power action is written to the workspace's activity log.
  • Credentials and brand. You connect through Task Ember's enterprise app with admin consent, or through your own app registration, whose secret is stored in Azure Key Vault. Clients sign in to your portal, with your logo and colours on your own subdomain, or on your own domain on the Professional plan.

See Virtual Machine Start/Stop and the rest of the catalogue at taskember.com/products.

A workspace for every client.

Task Ember is a white-label client portal for MSPs and IT teams. Set up a workspace and switch on the product your clients ask for most.