Skip to Content
Technical Articles
Author's profile photo Kiran Vejendla

Automatic snoozing of SAP systems on azure


This blog post has been drafted by myself and my colleague, Evren Buyruk to provide  information on how automatic snoozing can be implemented to SAP systems running on Microsoft Azure to reduce IaaS costs and manage the monthly spend to maintain cost-effective IaaS on Microsoft Azure Public Cloud which has been a peak interest for enterprise grade , mid-size companies . Snoozing helps to reduce infrastructure costs by eliminating resource utilization when systems are not required for business operations.

Snoozing Procedure

There are different ways to address snoozing process on Azure. We will talk few scenarios here.

Scenario 1: Using Azure Automation

This scenario explains how to leverage native Azure automation to schedule automatic SAP system startup / shutdown when needed. Azure provides runbooks gallery with sample scripts to start or shutdown virtual machines on demand. These scripts will not handle applications like SAP running inside those virtual machines . If at all graceful shutdown of SAP application is required in  any organization, that has to be handled separately in Microsoft Azure automation run book. There is a requirement to create a power shell / shell script depending on operating system and initiate execution of shell script using Virtual machine custom extension.

This blog post has sample scripts to handle SAP instances running on Microsoft Windows operating system. We must create  Powershell functions to start and stop sap instances. These functions can be created in different ways. Below is the very simple example using sapcontrol.exe to start and stop sap instances. Alternatively, sapcontrol web service calls can also be used to complete this task. Below are the sample powershell functions  to stop /start all sap instances installed on Virtual systems with Windows operating system.

Sample script to STOP SAP Instances in Virtual Machine

Sample script to START SAP Instances in Virtual Machine

If you want to verify whether instance is free and make sure that nothing is executing on system, you must create one more function to verify all work processes status. It is very useful to make sure that no batch job is active while instance being stopped.

Below is the sample powershell function to check work processes status and wait until all work processes comes to free status.

Depending on your requirement , you must create a script by using functions (similar in nature if you customize them) described above. Use the prepared script as virtual machine custom script extension as mentioned in the blog post

Please note that the custom script extension has to run in the context of operating system user <sid>adm.

Once SAP instances are stopped, you can use powershell or CLI commands to stop virtual machines. Similarly you can use azure powershell commands to start Virtual machines and start SAP instances.

Scenario 2: Using azure powerapps

Should you want to build user friendly mobile / desktop app, you can always leverage  powerapps to build application by using web services from SAP control. This will be much useful when you want to pass the startup/shutdown control process to your developers and embed certain controls/workflow in the application. SAPSnoozing power app is available to download at the location



There are different ways to snooze Microsoft Azure virtual machines. Snoozing helps to keep infrastructure costs low by stopping virtual machines when not in use and not pay for those systems when not needed.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Uday Kiran Madala
      Uday Kiran Madala

      Good Article Kiran.

      Author's profile photo Vijay Chandra
      Vijay Chandra

      This is not snoozing.  Snoozing is pausing a running instance and then unpausing it exactly where it was.  This is just automation of stopping/starting an SAP system and then the VM underlying it.



      Author's profile photo Kiran Vejendla
      Kiran Vejendla
      Blog Post Author

      Hi Vijay, Above are the scripts to start and stop SAP instances and after that you need to shut down VM. As starting and stopping vm's can be easily achieved i focused on how to gracefully shutdown VMs with extension handlers before shutting down VM.