Azure Virtual Machines: Start, Stop, and Terminate Instances


Your use of this download is governed by Stonebranch’s Terms of Use, which are available at


This Universal Task enables users to utilize Azure Virtual Machine (VM) name, resource group, subscription ID, and access token as inputs for the start, stop, terminate, list, and check status of Azure VMs.


  • This task uses python requests module to interact with the Azure cloud platform. 

  • It expands user ability to start/stop/terminate/check/list Azure VMs that belong to a subscription and resource group.

  • In Universal Controller (UC), this task reaches and stays in the success state until the Azure instance is completely started, stopped, or terminated. 

  • Scheduling this task in Universal Controller with the right dependencies set up would start and stop EC2 instances based on business needs using a UC workflow. 

  • This task helps to dynamically manage VM operations. It could potentially reduce the Azure VM running cost in the cloud. 

Software Requirements

This integration requires a Universal Agent and a Python runtime to execute the Universal Task against a Azure Virtual Machine.

Software Requirements for Universal Template and Universal Task

  • Requires Python 3.6 or higher . Tested with the Universal Agent bundled Python distribution.

  • Python modules required

    • requests

  • UAC Global Variables with azure oauth2.0 access should be set in order to run the UT properly.

    • Create a global variable and set the value of that with the Azure access token and this will be used in job definition to make the REST-API calls authenticated from universal controller to Azure logic apps

    • Access token can be populated with a new access token by setting up a web services task that can run periodically; for example, every hour.

Software Requirements for Universal Agent

  • Universal Agent for Windows x64 Version 6.5 and later with python options installed

  • Universal Agent for Linux Version 6.5 and later with python options installed

Software Requirements for Universal Controller

  • Universal Controller Version and later

Software Requirements for the Application to be Scheduled

This Universal Task can schedule and execute Azure VM Operations with API Version 2019-12-01.

Technical Considerations

This task uses Azure Oauth2.0 access token for Azure API authentication. Users may need to use Universal Controller web services task to refresh the access token periodically.

Generate Access Token Using Sample webservice Task

Generated Access Token can be Stored in a Global Variable by Using the UAC Function for the Above webservices Task in Actions Set Variable

Azure Virtual Machines Key Features



Start VM

Starts an Azure Virtual Machine

Stop VM

Stop an Azure Virtual Machine

Terminate VM

Terminate an Azure Virtual Machine

VM status

Check the status of an Azure Virtual Machine

List All VM

List the Azure VM’s belongs to a subscription & Resource group

Import AWS Virtual Machine Start-Stop-Terminate Instances Downloadable Universal Template

To use this downloadable Universal Template, you first must perform the following steps:

  1. This Universal Task requires the Resolvable Credentials feature. Check that the Resolvable Credentials Permitted system property has been set to true.
  2. To import the Universal Template into your Controller, follow the instructions here.
  3. When the files have been imported successfully, refresh the Universal Templates list; the Universal Template will appear on the list.

Configure Azure Virtual Machine Start-Stop-Terminate Instances Universal Task

For the new Universal Task type, create a new task, and enter the task-specific details that were created in the Universal Template.

Field Descriptions for Azure Virtual Machine Start-Stop-Terminate Instances Universal Task



VM Function

Select the function to perform with the Azure VM , Either start or stop or terminate or check status or List VM’s

Resource Group Name

Resource group name from the Azure Subscription

subscription Id

Azure Subscription ID

VM Name

Name of the Virtual Machine in Azure


Api version in Azure

Access Token Variable

Bearer access that is store Universal Controller global variable

Examples for Azure Virtual Machine Start-Stop-Terminate Instances Universal Tasks

Starting an Azure Virtual Machine from Universal Controller

List All Virtual Machines for an Azure Subscription

Document References

This document references the following documents:



Universal Templates

User documentation for creating Universal Templates in the Universal Controller user interface.

Universal Tasks

User documentation for creating Universal Tasks in the Universal Controller user interface.