A couple of weeks ago I was speaking at a System Center 2012 event in Stockholm/Sweden. My session was around Orchestrator and Service Manager integration. On stage I created and demo a scenario where Service Manager, Virtual Machine Manager and Orchestrator was used to administrate lifecycle of virtual machines and virtual services. My laptop only hosted Orchestrator and Service Manager so in many of the example runbooks I only create a computer object in Service Manager. But as you realize you could re-place that with any kind of Virtual Machine Manager activity. In this post I will share with you the demo files, runbooks and management packs I used.
The demo scenario was that someone could order a virtual machine or a service (service template) from the self service portal in Service Manager. Orchestrator and Virtual Machine Manager then created the machines and so on. When you order a new virtual machine you needed to input a expire date, for how long will you need the virtual machine. You also need to input a cost center, to know who should approve and how will pay for it. When a virtual machine is close to the expire date it is picked up by a runbook that notify the owner. The owner can use the portal to extend the date or simple don’t. If the machine pass the expire date Orchestrator will shut it down. When it has been shut down for some months it is deleted. The demo also showed how to generate reports to follow up which how much each cost center should pay. When the order is complete the user can see the result in the Service Manager portal
The cool thing about this demo is not only that we can create any kind of virtual environment with Virtual Machine Manager 2012, instead of just deploying machines we can follow up on who order, who approved and we can also see how much each cost center is using.
The solution is divided into multiple steps
- Extend the Windows Computer CI class in Service Manager with a couple of extra properties, like order date, cost center, owner, expire date, approver and cost. (MP attached)
- Create a new CI class in Service Manager to store cost information (MP attached)
- Create a runbook that creates computer objects (export file attached)
- Publish a service in the self-service portal in service manager (not included in this post, ping me if you need step by step guide)
- Create a report to follow up number of orders and total cost per cost center
- Create runbooks to administrate removal of expired objects (export file attached)
Extend the Windows Computer Class
To add extra attributes to all Windows Computer CI objects in Service Manager we need to extend the Windows Computer class. We can do that with the Service Manager Authoring Tool, download here. (http://www.microsoft.com/en-us/download/details.aspx?id=28726). When the Authoring Tool is installed follow these steps to extend the Windows Computer class
- We need to seal the management pack we will create in the Authoring Tool. If we don’t seal it we cant use it with Orchestrator or the data warehouse. To seal it we need a keyfile. SN.EXE (.NET Framework Strong Name Utility) is a tool that we can use to generate that key file. Open a command prompt and navigate to C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin
- To generate a key pair run, SN.EXE -k C:\temp\snKey.snk
- Start Service Manager Authoring Tool
- From the File menu choose New
- New Management Pack, save the new management pack in a suitable folder, for example C:\TEMP\Contoso.WinCompExt
- Use the Class Browser to find the Windows Computer class, right-click it and select View
- In the Management Pack Explorer pane, note all the default properties. Right-click on the Windows Computer class and select Extend Class
- Target Management Pack, select Contoso.WinCompExt to save the extension in the management pack
- Click Create Property and add the following properties. Edit each property in the Details pane
Internal Name Name Data Type Note ContosoOrderDate Order Date Date Time ContosoCostCenter Cost Center String ContosoOwner Owner String ContosoExpireDate Expire Date Date Time ContosoApprover Approver String ContosoCost Cost Integer
- Save your management pack
- In the Management Pack Explorer pane, right-click Contoso.WinCompExt and select Seal Management Pack
- Seal Management Pack,
Output Directory: C:\TEMP
Key File: C:\temp\snKey.snk
Click Seal and then Close
- Start Service Manager Console and import the sealed Contoso.WinCompExt management pack from C:\temp\Contoso.WinCompExt.mp (make sure to select the .MP management pack, MP=Sealed XML=Unsealed)
- Close the Service Manager Console and open it again, this will re-load class information
- Navigate to Configuration Items/Computers/All Windows Computers and open a computer. Note all the new properties that are shown on the Extensions tab. We have now extended the Windows Computer class with the properties we need for the computer lifecycle demo.
One of the properties we extended the Windows Computer class with is Cost. My idea is to use this field to show the monthly price of the configuration item, the computer. We could input that price manual but we can also build a price list inside of Service Manager. To do that we can use the Authoring Tool to create a new CI class, Contoso Price List.
- Start Service Manager Authoring Tool
- From the File menu create a new management pack, for example C:\TEMP\ContosoCost
- In the Management Pack Explorer pane, right-click Classes and select Create Configuration Item Class
- Create Class, input ContosoCostItem as internal class name
- In the Details pane change the Name to Cost Item
- Delete default Property_4
- Add two properties, AvailabilityLevel and Cost. Change AvailabilityLevel name to Availability Level. Change data type to Integer for the Cost property. Change Key to TRUE on the Availability Level property
- Save the managemente pack
- Seal the management pack the same way we did with the first management pack
- Import the management pack into Service Manager. Remember to import the sealed version, MP file.
- Restart the Service Manager Console
- Navigate to Configuration Items
- Create a new folder, name it Price List. Create a new management pack, for example Contoso, and store the folder in it
- Select the Price List folder and click Create View in the Tasks pane
- Create View
Name: All Items
Criteria: All objects of the ContosoCost Item class, where object status does not equals Pending Delete
Display: Availability Level and Cost
- Select the new All Items view and click Create Contoso Cost Item from the Tasks pane
Availability Level: Gold
- Click Create Contoso Cost Item from the Tasks pane
Contoso Cost Item Properties
Availability Level: Silver
- Click Create Contoso Cost Item from the Tasks pane
Contoso Cost Item Properties
Availability Level: Bronze
- Click OK
This example use a number of runbooks, all included in the export file attached to this blogpost. I will explain each one of them and you can import them and look at the in the Orchestrator Runbook Designer
- 700.10 Cost. This runbook will get the correct price for the new computer based on the price list in Service Manager
- 700.11 Count Machines. This runbook counts existing machines to figure out a suitable computer name for the new machine
- 700.2 Update Approver. This runbook updates the approver step in the service request template based on the cost center. The runbook attach approver to the manual approval step
- 700.3 Create VM (picture) creates the new computer
- 700.4 Update Service Request, updated the Description attribute on the Service Request. This is used when the machine is create to communicate the new computer name to the user. The user will see this in the self-service portal
- 700.5 This one will find all VMs that are close to expire date (2 months or less) and send a e-mail to the owner of the machine. Also flag the virtual machine that e-mail has been sent
- 700.6 Get Cost Center. This runbook gets approver for each cost center. This could be done with a external database or any other way
- 700.7 When a VM have passed expire date it is shut down in Virtual Machine Manager
- 700.8 Deleted expired VM, when the VM has been shutdown for 2 months it is deleted
- 700.9 Update expire date, if the user order a new expire date for the computer in the portal, this runbook will update the virtual machine with the new expire date
- 500.1-500.3, these runbooks are used to generate the HTML based report. One master runbook and then one runbook for each cost center
Reporting have changed a lot with Service Manager 2012. We now have cubes to analyze the data and we use Excel to easy drag and drop fields to build table. The first image below show a table with everything that cost center 2 is running right now. If you want to sum everything into a one cell, total cost, it is a bit more difficult now when we are running cubes. We need to extend the cube to include that field. If you don’t know how to do that you could solve it with SQL reports or using Orchestrator. In the second image below you can see a HTML based report generated by a couple of runbooks in Orchestrator.
Management packs SC12 day MPs
Please note that this is provided “as is” with no warranties at all.
Yes, you need to already have import all the integration packs that his runbook uses. Else you often ends up with “?” activities in the runbook.
Thanks for this post, i have a little query ..when i am importing the runbook its saying UNKNOWN ACTIVITY , i have only imported VMM integration pack . do i need to also import service manager integration pack ? or something else
can you please help me
Hi, see if this guide can help you http://technet.microsoft.com/en-us/magazine/jj933281.aspx. If not let me know and I will find Another document for you.
Can you please explain steps involved to create the service offering in service manager “SM portal”
Take a look at this video http://technet.microsoft.com/en-us/video/private-cloud-demo-extravaganza-8-create-an-orchestrator-runbook-and-integrate-with-service-manager-with-system-center-2012.aspx or in the Service Manager console, when you click Service Catalog you will see a list of all the steps on the right side of the console.
4.Publish a service in the self-service portal in service manager (not included in this post, ping me if you need step by step guide)…
Can you please share step by step guide for publishing this in SM self service portal…
Hi, in the runbook automation activity I have map object/ID to that parameter. So every time I use that runbook activity in a service request I map the current runbook automation activity instance ID to that parameter in Initialize data.
I’m interesting on how you build the service request template in service manager to be published in the web portal.
In your RB 700.3, in initialize data you call the SRID and the get runbook automation get the RBID. Does it mean that the RB template for the RB 700.3 should the maping of the SRID to be linked to the runbook automation activity workitem id ?
Hi, thanks for reading my blog. Your service request need to included a activity that create these VMs. You can create a runbook in Orchestrator, syncronize it to Service Manager and then use it as a runbook activity in the service request template.
Hi Anders ,
Do you have any idea of via Service portal submit the service request to deploy the multi-tier VM from service template which made in VMM ,is that service request must included the runbook activity in order to accomplish this ?
Many Thanks & Appreciate
[…] Manager and Orchestrator – A Real World Private Cloud Scenario « Cloud Administrator on VM lifecycle in Service Manager with Orchestrator magicNader on VM lifecycle in Service Manager with Orchestrator magicCameron Fuller – Using the Service […]
[…] MVPs and author of System Center Service Manager 2010 Unleashed wrote an amazing article titled “VM lifecycle in Service Manager with Orchestrator magic”. Not only he provides the knowledge on how to built lifecycle scenario for virtual machines but […]
Great stuff, Thanks for sharing!