This is in continuation of my previous Article Auto Scaling of SAP Systems on Azure – Part III
4. DEPLOYMENT AND CONFIGRUATION
4.1 Log Analytics Workspace
As we need to store the telemetry date from SAP System, for which we are using the Log Analytics Workspace. To create Log Analytics Workspace, go to azure portal and search for Log Analytics Workspace and Click on Add
Specify the requested subscription and instance details of the Log Analytics Workspace and click on Pricing Tier
Select the required pricing tier and then click on Tags
Specify the Tags if any, and then click on Review + Create
Wait for the Validation to pass for the Log Analytics Workspace and once the validation is passed then click on Create
Wait for the deployment to finish, we can see the below screen once the deployment is finish with a success
We can see the Log Analytics Workspace is ready to use
4.2 Deploying Scripts on Azure Storage Container
For preparing Operating System and for deploying customized VM, we have some scripts and file that needs to be placed in the Storage Container so that Files can be used to deploy custom Virtual Machines. To do so we need to create container by clicking Container button under the storage account
Once the container is created, we need to upload the attached files to the location by clicking Upload button
We have uploaded the files to the container, now we can access the container with the URI and then we can use the script as per the requirement
4.2.1 Deploying app server
In the storage container we have placed two json files which is act as part of ARM template. These files will be used to create the Virtual Machines.
One file named as appserver_deploy.json, contains the actual parameters of the VM which contains the information about IP Address, Name, location, network interface, availability set, OS Profile, OS Disk etc.… Under OS profiling we are also putting the ssh key data so that we can use the same to login after the creation of Virtual Machine.
Second file named as appserver_deploy.parameters.json, contains the parameter for the first file, in which there are certain dynamic entries which will be changed during each execution of Virtual Machine creation. There are variables in which location, subnet, Virtual Network, Virtual Machine, OS Disk, Machine Size, Availability Set, Username, Password etc….
These two json files will be used in Automation Runbook to deploy the VMs with the specific required parameters.
4.2.2 Setting Up App Server
In storage container we have also placed appserver_setup.sh which will be used as custom script to prepare the Operating system for SAP System. This script will do the following actions: –
- Rename of environment variable files from old hostname to new hostname
- Preparing the SAP Services files with the new hostname
- Performing the hostname changes in SAP profiles
- Performing the restart of SAP Service so that new parameters will be in play
- Performing the start of SAP server as an Additional Application Server
This script will be executed using custom script extension of Virtual Machine.
4.2.3 Decom of App Server
In storage container we have also placed appserver_decom.sh which will be used as custom script to soft shutdown of SAP application with a defined timeout. Script has the wait function in which it will wait for the defined time for all work processes to get free.
This script will be executed using custom script extension of Virtual Machine.
4.3 Deploying Table on Azure Storage Tables
To provide some dynamic execution of the SAP Scaling on Azure, we need to create a table which has all the parameters which will used during the execution. To create the same, we need to go to Storage account and click on Table under Tables
Then it will ask for the table name by which we need to create
Create the table structure as below using Storage Explorer
Below are the details on the Property Name: –
- CurrentAppCount – Value under this property tells the automation about the current application server count for which SAP is running
- MaxAppCount – Value under this property tells the automation about the maximum count upto which the scale out is allowed.
- MinAppCount – Value under this property tells the automation about the minimum count upto which the scale down is allowed.
- SAPAppLoadBalancer – Value under this property tells the automation about the Azure Load Balancer name under which application server needs to be added.
- SAPAppNamingPrefix – Value under this property tells the automation about the hostname prefix, so actual hostname will be followed by Application number.
- SAPAppVmSize – Value under this property tells the automation about the size of the VM which needs to be provisioned during scale out.
- SAPAvSet – Value under this property tells the automation about the Availability Set Name to which new VM needs to be provisioned during scale out
- SAPCustomImageid – Value under this property tells the automation about the location of the VM Image which will be used to provision new Virtual Machine during scale out.
- SAPDeleteTimeout – Value under this property tells the automation about the time difference that needs to be kept between removal of Logon and Server Groups and VM resource removal.
- SAPImageHostName – Value under this property tells the automation about the hostname that is there in the VM image for the replacement during the post actions.
- SAPInstanceNr – Value under this property tells the automation about the SAP systems instance number
- SAPLogonGroups – Value under this property tells the automation about the Logon group that needs to be added/remove from the SAP System
- SAPRegion – Value under this property tells the automation about the location of the Virtual Machine which needs to be provisioned
- SAPResourceGroup – Value under this property tells the automation about the Name of the Resource Group which will used for all Automation tasks
- SAPServerGroups – Value under this property tells the automation about the Server groups that needs to be added/remove from the SAP System
- SAPShutdownTimeout – Value under this property tells the automation about the time after which SAP will be shutdown forcefully.
- SAPSubnet – Value under this property tells the automation about the Subnet on the Virtual Machine which needs to be provisioned
- SAPVnet – Value under this property tells the automation about the Vnet on the Virtual Machine which needs to be provisioned
Fields inside the Table is important and change as per the requirement as it is getting used by Automations.
4.4 Data Collection Logic App
For collecting the data from the SAP system we need to create a logic app that will be resposible for collecting te telemetry data from SAP system to the Log Analytics Workscape. To do so, we need to goto Logic App and then click on Add
Specify all the details about the Logic App, please note that we will be using Integration Service Enviroment for this logic app. Once the information is filled then click Create
Once the Logic app is created then we the can see the same under Integration Server Environment as well
Once the Logic app is created then first we need to add the recurrence for the logic app, we can specify the same according to our requirement
Now we need to add a step to get the secret from the Key vault for the HTTP request for SAP access
Then we need to specify the HTTP method as GET to fetch the data from SAP system. Make sure to fill the proper HTTP URI for the ODATA service connection to SAP, we also need to specify the Date filter, format with condition
As we get the data from SAP in json format, hence we need to add one step to parse JSON which is coming from SAP system using a schema as below
Now we need to compose the data that we get the result after parsing JSON in a format which is compatible with the Log Analytics Workspace as below
And now we need to send the composed data to Log Analytics Workspace with Custom Log Name with the help of API connections
We can see the same API Connection in Logic App’s properties
Now our logic app is ready for collecting the telemetry data from SAP system. Once we Enable the Logic App we can see the Runs history in Logic Apps Overview page
For further checks we can click on each execution for the step by step running status with time taken.
As we can see that Logic app is able to get the telemetry data from SAP system and filling it to Log Analytics Workspace without any issue, then we need to check the data from Log Analytics from Azure portal under Custom Logs
We can also check the integrity of the data by querying the Custom Logs, we can see that data is getting filled after regular interval of time
Now out telemetry data is ready for the next execution of the SAP Auto-Scaling.
4.5 Logic App for Logon and Server Group Changes
As we also need to update the Logon Group(SMLG) and Server Groups (RZ12) when ever there is any change in the application server, hence we need to build a logic app which can perform this actions for us according to the parameter we pass to the same. To do so we need to create Logic using HTTP POST URL as first step with JSON Request as below
As we are passing information in JSON format, hence we need to parse JSON with the request schema in the next step of the logic app
After parsing the JSON, we need to format the output to the SAP xml format for sending the request to SAP system. Here we are using SMLG_MODIFY Remotely enabled function to the actual execution on SAP System
So, after the successful changes to the Logon and Server Groups we also need to send the email notification for the same
As we are calling this as a HTTP request and we are using response from the Logic Apps to Automation, so we are adding response 200 from this as below