Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Introduction to Microsoft Operations Management Suite (OMS) – Part III

  • March 24, 2016
  • 25 min read
Microsoft MVP Charbel Nemnom is an accomplished technical professional with over 13 years of broad IT project management and infrastructure experience serving on and guiding technical teams to optimize performance of enterprise systems. He has practical knowledge of complex systems builds, network design and virtualization. Charbel has extensive experience in various systems, focusing on Microsoft Cloud Platform, Hyper-V, Datacenter Management, Cloud Computing, security, data protection, and many types of monitoring tools as well as a solid knowledge of technical reporting.
Microsoft MVP Charbel Nemnom is an accomplished technical professional with over 13 years of broad IT project management and infrastructure experience serving on and guiding technical teams to optimize performance of enterprise systems. He has practical knowledge of complex systems builds, network design and virtualization. Charbel has extensive experience in various systems, focusing on Microsoft Cloud Platform, Hyper-V, Datacenter Management, Cloud Computing, security, data protection, and many types of monitoring tools as well as a solid knowledge of technical reporting.

 

Azure OMS

Introduction

In part two of this multi part blog series, we covered how to configure OMS to collect data through integration with System Center Operations Manager (SCOM), and through direct connections to individual servers. We also covered how Microsoft Operations Management Suite uses Solutions to deliver insights into your log data by providing a cost-effective, all-in-one cloud management solution so you can better protect guest workloads in Azure, AWS, Windows Server, Linux, VMWare, and Open Stack.

In the third part, Part III: we will cover how to configure automation for OMS.

Runbooks are workflows that perform an administrative process. The good news is you do not have to create all runbooks from scratch. Workflows can be uploaded to Azure from the Azure Runbook Gallery, the Microsoft Script Center, Microsoft MSDN and TechNet libraries, and the Azure community forums. OMS leverages the runbook capabilities of Microsoft Azure.

If you want to follow along, please ensure that Part I and Part II of this multi part blog series has been successfully completed.

Infrastructure Overview

We have the following servers installed in our demo environment:

  • Domain controller, DNS, WSUS.
  • System Center Operations Manager 2012 R2 with update Rollup 9.
  • SQL Server holding SCOM databases.
  • Linux Server (Ubuntu).

Part III - Image

Introduction to OMS Runbooks

In this section, you will learn how to create and manage runbooks.

Step 1 Configure Azure Automation Assets

In this step, you will create a credential asset for use in the creation of runbooks.

  1. Login to your SQL Server
  2. Sign in Operations Management Suite Portal at http://www.microsoft.com/en-us/server-cloud/operations-management-suite/overview.aspx
  3. On the OMS Overview blade, click Automation. If you recall, this is the account we created in Part I.
  4. Click the Runbooks Microsoft Azure Portal will open.
  5. On the Assets blade, click AzureOMSAutomation
  6. Under Resources, click Assets as shown in the following screenshot.

1

  1. On the Credential blade, click Credentials.

2

  1. Click +Add a credential.
  2. In the name field, type OMS Account.
  3. In the User name and password fields, type the credentials used to log in to OMS and click Create.

Note: In a production environment, you would need to use an organizational account. The Credential asset will not function correctly when a Microsoft account (i.e., outlook.com or live.com) is used.

3

  1. Close all blades and return to the Start board.

Step 2 – Create a Runbook from Scratch

In this section, you will create a runbook from scratch.

  1. Login to your SQL Server machine.
  2. Sign in to Operations Management Suite Portal at http://www.microsoft.com/en-us/server-cloud/operations-management-suite/overview.aspx
  3. Switch to the OMS Portal, OMS Automation
  4. Click Create a runbook. Microsoft Azure Portal will open.
  5. On the Assets blade, click AzureOMSAutomation
  6. Under Resources, click Runbooks.
  7. On the Runbook page, click +Add a runbook.
  8. On the Add Runbook page, click Create a new runbook.
  9. In the Runbook blade, type Write-HybridOMS as a Name.
  10. From the Runbook type drop-down menu, select PowerShell Workflow, click Create.
  11. Ensure that the correct Automation account, subscription, and region are selected and click Create.
  12. In the script area, edit the text to match the following:4
  13. Click Save.

Step 3 – Test and Publish a Runbook

In this step, we will test and publish a runbook.

  1. In the Edit PowerShell Workflow Runbook blade for Write-HybridOMS, click Test Pane.
  2. Click Start.
  3. When you click, a runbook job is created and its status displayed in the pane. The job status will start as Queued indicating that it is waiting for a runbook worker in the cloud to come available. It will then move to Starting when a worker claims the job, and then Running when the runbook actually starts running. Please note it will take couple of minutes to complete.
  4. When the runbook job completes, its output is displayed as shown in the following screenshot. In this case, you should see Hybrid OMS.

5

  1. Close the Test blade to return to the canvas.
  2. Switch to the Edit PowerShell Workflow Runbook blade in the Azure Portal.
  3. Click Publish and then click Yes. The runbook will be published.
  4. Switch to the OMS Portal, click on Automation. As you can see in the following screenshot, we have additional runbook now.

6

Step 4 – Edit a Runbook

In this step, we will edit a runbook.

  1. Login to your SQL Server
  2. Switch to the Edit PowerShell Workflow Runbook blade in the Azure Portal.
  3. In the Write-HybridOMS blade, Click Edit.
  4. Change “$Name = OMS” to “$Name = Azure”.
  5. Click Save.
  6. Click Revert to published and click Yes. This will discard all changes you have made and revert to the last published version.
  7. Close the Write-HybridOMS blade.

Step 5 – Start a Runbook

In this step, we will start a runbook manually and as a scheduled task.

  1. Login to your SQL Server
  2. Switch to Runbook blade in the Azure Portal, Click on Write-HybridOMS
  3. In the Write-HybridOMS blade, Click Start.
  4. In the Start Runbook blade, click OK.

When the runbook starts, a job pane is opened for the runbook job that you just created. The job status is shown in Job Summary and matches the statuses that you saw when you tested the runbook.

  1. When the job completed, click Output.
  2. The Output blade is opened; you can see Hybrid OMS” as shown in the following screenshot

7

  1. Close the Output blade and the Job blade.
  2. Switch to the OMS Portal and click on the Overview In the Automation tile, “Jobs in the last 7 days” will have increased by 1 as shown in the following screenshot.

8

  1. Switch to the Job blade in the Microsoft Azure Portal.
  2. Close the Job blade.
  3. In the Write-HybridOMS blade, click Schedule.
  4. In the Schedule Runbook blade, click Link a schedule to your runbook.
  5. Click +Create a new schedule.
  6. In Name, type Daily.
  7. Change the time to 5 minutes from the current time. The start time must be at least 5 minutes after the time you create the schedule.
  8. From the Recurrence drop-menu, select Daily.
  9. Click Create.

9

  1. In the Schedule Runbook blade, click OK. The runbook will launch according to the schedule. When the job completes, “Jobs in the last 7 days” will increase by 1, so the total will be 2 as shown below:

10

  1. Leave the Microsoft Azure portal window open for the next steps.

Step 6 – Delete a Runbook

In this step, we will delete a runbook.

  1. Login to your SQL Server machine.
  2. Sign in to Operations Management Suite Portal at http://www.microsoft.com/en-us/server-cloud/operations-management-suite/overview.aspx
  3. Switch to the OMS Portal, OMS Automation
  4. Click the Runbooks Microsoft Azure Portal will open.
  5. Select Write-HybridOMS.
  6. In the Write-HybridOMS blade, click Delete and click Yes. The runbook is removed from the list of Runbooks.
  7. Switch to the OMS Portal and lick the Overview In the Automation tile, the number of runbooks is reduced by 1.

11

Step 7 – Import a Workflow to an OMS Runbook

In this step, we will import an existing workflow from the Microsoft Marketplace.

  1. Login to your SQL Server
  2. Sign in to Operations Management Suite Portal at http://www.microsoft.com/en-us/server-cloud/operations-management-suite/overview.aspx
  3. Click the Automation tile and note the number of Runbooks, we have one runbook.
  4. Click Runbooks. Microsoft Azure Portal will open.
  5. On the Dashboard blade, click AzureOMSAutomation.
  6. Under Resources, click
  7. On the Runbooks blade, click Browse gallery. Note that a larger number of runbooks are available from this location, as runbooks provided by community members are included in this view.
  8. In the Search box, type Create.
  9. In the results, click Create a new Virtual (VM) on Azure. Note that you can preview the contents of the runbook.

12

  1. In the Create a new Virtual Machine (VM) on Azure blade, click Import.
  2. In the import blade, click OK.
  3. Close open blades to return to the Runbooks
  4. Click New-AzureVMSample.
  5. In the New-AzureVMSample blade, click Edit. Note additional parameters are required for this runbook. Due to the fact that this is a new Azure environment, we have not yet created the virtual network necessary in Azure to support the creation of Virtual Machines.
  6. In the Runbook blade, click Publish and click Yes.
  7. Close the Azure Portal.
  8. In the OMS Portal, click the Overview Note the Automation tile, “Runbook” has increased by 1.

13

Creating a Graphic-Style Runbook

In this section, we will create a simple graphic-style runbook designed to obtain Azure Subscription information.

Step 1 – Create a Graphical Runbook

In this step, we will create a new graphical runbook.

  1. Login to your SQL Server machine.
  2. Sign in to Operations Management Suite Portal at http://www.microsoft.com/en-us/server-cloud/operations-management-suite/overview.aspx
  3. Click the Automation
  4. Click Create a Runbook. Microsoft Azure Portal will open.
  5. On the Dashboard, click AzureOMSAutomation.
  6. Under Resources, click
  7. In the Azure Portal, in the Runbooks blade, click +Add a runbook.
  8. Select Create a new runbook.
  9. In the Name, type Get-CurrentAzureSubscription.
  10. From the Runbook type drop-down menu, select Graphical14
  11. Click Create.

Step 2 – Add Activities to a Graphical Runbook

In this step, we will use Library controls to add activities to the runbook.

  1. In the Azure Portal, in the Runbooks blade, click on Get-CurrentAzureSubscription
  2. In the Get-CurrentAzureSubscription blade, click on Edit.
  3. In the Library control, expand Cmdlets | PowerShell.Utility.
  4. Scroll down to the bottom of the list, right-click Write-Output, and click Add to canvas.
  5. Click on the Write-Output activity on the canvas. This opens the Configuration control which allows you to configure the activity.
  6. Change the label to Welcome to OMS UI Runbook.
  7. Click Parameters to provide values for the cmdlet’s parameters.
  8. Select the InputObject This is the parameter where we will specify the text to send to the output stream.
  9. In the Data source dropdown, select PowerShell expression.
  10. In the Expression box, type “Welcome to OMS UI Runbook” (including the double quotes) and then click OK twice to return to the canvas.

15

  1. Save the runbook by clicking Save.
  2. Click Test pane.
  3. Click Start.
  4. When the runbook job completes, its output is displayed. In this case, you should see Welcome to OMS UI Runbook.

16

  1. Close Test
  2. In the Edit Graphical Runbook Get-CurrentAzureSubscription blade, click Publish.
  3. In the Get-CurrentAzureSubscription blade, click Start and click Yes.
  4. Once the runbook status shows Completed, click Output. The Output pane is opened, and you can see Welcome to OMS UI Runbook.

17 18

 

  1. Close the Output
  2. Click All Logs to open the Streams pane for the runbook job. You should only see Hello World in the output stream, but this can show other streams for a runbook job such as Verbose and Error if the runbook writes to them.
  3. Close the Streams pane and the Job pane to return to the Get-CurrentAzureSubscription
  4. Click Jobs to open the Jobs pane for this runbook. This lists all of the jobs status created by this runbook. You can click on any job to open it. This allows you to go back in time and view the details of any job that was created for a particular runbook.
  5. Close the Jobs

Step 3 – Add Authentication to Manage Azure resources

In this step, we will use the Add-AzureAccount cmdlet to allow the runbook to authenticate in order to manage Azure resources.

  1. In the Azure Portal, in the Runbooks blade, click on Get-CurrentAzureSubscription
  2. In the Get-CurrentAzureSubscription blade, click on Edit.
  3. Right-click on Welcome to OMS UI Runbook and select Delete.
  4. In the Library control, expand Cmdlets | Azure.
  5. Right-click Add-AzureAccount and click Add to canvas.
  6. Select Add-AzureAccount.
  7. In the Configuration pane, click Configure Parameters. Add-AzureAccount has multiple parameter sets, so you need to select one before you can provide parameter values.
  8. Click Choose a Parameter set and select the User parameter set. Once you select the parameter set, the parameters are displayed in the Activity Parameter Configuration pane.
  9. Under Parameter set, click Credential.
  10. From the Data source drop-down menu, select Credential asset.
  11. Select Credential asset and click the OMS Account you created earlier in Part I.
  12. Click OK twice to return to the canvas.

19

  1. Click Save.

Step 4 – Add Activity to Graphical Runbook

In this step, you will add a Get-AzureSubscription activity to your Runbook.

  1. In the Azure Portal, in the Runbooks blade, click on Get-CurrentAzureSubscription
  2. In the Get-CurrentAzureSubscription blade, click on Edit.
  3. Under Cmdlets | Azure, right-click Get-AzureSubscription and click Add to canvas.
  4. Click and drag Get-AzureSubscription underneath Add-AzureAccount.
  5. Hover over Add-AzureAccount until a circle appears on the bottom of the shape.
  6. Click the circle and drag the arrow to Get-AzureSubscription. The arrow that you just created is a link. The runbook will start with Add-AzureAccount and then run Get-AzureSubscription.
  7. Click Get-AzureSubscription and click Configure Parameters.
  8. Click Choose a Parameter set and click ByName.
  9. Select SUBSCRIPTIONNAME.
  10. From the Data source drop-down menu, select Credential asset and click the OMS Account you created earlier in Part I.
  11. Click OK twice to return to the canvas.

20

  1. Click Save.

Step 5 – Finalize Your Graphical Runbook

In this step, we will test, run and publish the graphical runbook.

  1. In the Azure Portal, in the Runbooks blade, click on Get-CurrentAzureSubscription
  2. In the Get-CurrentAzureSubscription blade, click on Edit.
  3. Click Test pane.
  4. Click Start.

Note: The job will run with the following expected error. The error is produced because you are using a Microsoft account during this clinic. Credential asset can only be used with an Organizational account.

21

  1. Close the Test pane to return to the canvas.
  2. Close the Edit In production environment, you would edit the runbook to use your organizational account credentials, re-test the runbook, and then publish it.

Conclusion

Congratulations! In Part 3 we covered the introduction to OMS Runbooks, we created a Runbook from scratch, then we imported a ready-made runbook from Azure gallery and finally we tested it and published it.

In the second section of this walkthrough article, we created a graphical-style runbook using a graphical tool and a graphical programming model, with little or no code required. It’s a simple insert activity from the library to the canvas, where you can link them together into a workflow, and configure the properties in order to create useful runbooks that automate your IT processes. If you are familiar with System Center Orchestrator, you will be familiar with this intuitive method of creating visual runbooks as well.

Until then… see you in the final part – Part 4.

Thanks for reading!

Found Charbel’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!