Setup Azure Automation for SAP

In order to have Azure Automation gracefully managing SAP Worklaods, we need to setup the Azure Automate and import some runbooks.

This section will show the steps required for that to be accomplished:

Azure Automation Setup

  1. Log on to the Azure Portal and go to Automation Accounts SS1
  2. Create an Automation Account with the following parameters:
  • Resource Group: Pick the SAPCAL-XXXXXXXX created by SAP CAL so we can cleanup properly.
  • Account Name: SAPAutomationAcc
  • Region: East US (same as SAP)
  • Click Review and Create and then in Create SS1
  1. Go to the newly create SAPAutomationAcc SS1

Importing Modules

Let’s add a Module to run PowerShell commands with SAP.

  1. On the left pane click on Modules and Add Module SS1
  2. Click on Browse from gallery SS1
  3. Search for SAPAzure and pick SAPAzurePowershellModules SS1
  4. Click on Select SS1
  5. Pick the Runtime 5.1 and click Import SS1

Importing Runbooks

Now we will import the template runbooks required for automating SAP. There is an extensive list but we will only use the ones required for the SAP CAL deployment model. Other deployment modules mey need additional modules. Please see the complete documentation for more information.

Info

The procedure below will be executed for 8 Runbooks:

  • Stop-SAPSystem
  • Start-SAPSystem
  • List-SAPSystemInstances
  • Stop-SAPHANA
  • Start-SAPHANA
  • List-SAPHANAInstance
  • Start-SAPApplicationServer
  • Stop-SAPApplicationServer

Please at the end of this procedure, repeat the sequence for the remaining runbooks

  1. On the left pane click on Runbooks and Import a Runbook SS1
  2. Go to Browse from gallery SS1
  3. Search for the Runbook Name from the list above and pick Source: Powershell Gallery. In this example we are searching for Stop-SAPSystem but you will do the same procedure for all the 8 Runbooks required. SS1
  4. Click Select SS1
  5. Use the same namefrom the template, pick runtime 5.1 and click Import SS1
  6. Click on Publish and Yes SS1
  7. Go back to SAPAutomationAcc by clicking on the top link SS1
  8. Repeat the process for all the other runbooks. SS1

At the end your SAPAutomationAcc screen should look like this, with all the 8 runbooks imported: SS1

Adding Execution Permissions (Run As Accounts)

In order to start and stop SAP, Azure Automation needs to log in as root to those VMs. Let’s give it the permissions for this:

  1. Go back to the SAPAutomationAcc, scroll down the left panel and select Run as accounts. Click on Azure Run As Accounts SS1
  2. Wait until the green checkmark is added to the option. This will expire in 365 days. SS1

Congratulations, you have configured the Azure Automation and imported the required runbooks.Now let’s move to the next section and add Tags to our VMs so the script can identify the VMs properly.