Deploying Software from Configuration Manager using the Service Manager Self-Service Portal

This post is the 12th in a series of posts focused on making common administrative tasks in System Center and Azure available via the Service Manager Self-Service Portal. The Configuration Manager and Operations Manager Connectors pull a lot of information into Service Manager but not everything necessary to manage clients, agents, and other settings. This solution provides for the ability to deploy software with Configuration Manager via the Service Manager Self-Service Portal. It does this by allowing the user, via the Service Manager Portal, to create an include rule on a collection with deployments targeted at it with another collection that they manage using direct membership rules.

Series

Using the Service Manager Self-Service Portal for Common Tasks in Configuration Manager, Operations Manager, and Azure

Prerequisites

The scenarios were designed using the following

  • System Center Service Manager 2012 R2
    • Self-Service Portal configured and working
    • Active Directory Connector configured and working
    • Configuration Manager Connector configured and working
    • Orchestrator Connector configured and working
  • System Center Configuration Manager 2012 R2
    • Discovery configured and working
  • System Center Orchestrator 2012 R2
    • SC 2012 Configuration Manager Integration Pack configured and working
    • SC 2012 Service Manager Integration Pack configured and working
    • Configuration Manager Console installed on runbook servers (open the console, make sure you can connect to your site server)
    • Operations Manager Console installed on runbook servers
    • Service Manager Console installed on runbook servers
    • Runbook servers configured to allow PowerShell scripts to run
  • Previous Blogs
    • Sync Configuration Manager Client and Operations Manager Agent State in Service Manager
    • Managing Configuration Manager Collections using the Service Manager Self-Service Portal
    • Sync Configuration Manager Application Collections in Service Manager

Create the Add Include Rule to Application Collection Runbook

This Runbook will create include collection rules to "application collections" in Configuration Manager, trigger the Sync Application Collections runbook created previously, and finally update the Description in the Service Request with the result of the Sync collections runbook.

  • Open the Orchestrator Runbook Designer
  • Create a new runbook
  • Drag the "Runbook Control\Initialize Data" activity into the new runbook
  • Rename it to "Get Runbook GUID"
  • Create a new string parameter under "Details" called RunbookID, and click "Finish"
  • Drag the "SC 2012 Service Manager\Get Object" activity into the new runbook
  • Rename it to "Get Runbook Object"
  • Link "Get Runbook GUID" to "Get Runbook Object"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Class: Runbook Automation Activity
    • Filters: SC Object Guid Equals {RunbookID from "Get Runbook GUID"}

clip_image001

  • Click "Finish"
  • Drag the "SC 2012 Service Manager\Get Relationship" activity into the new runbook
  • Rename it to "Get SR GUID"
  • Link "Get Runbook Object" to "Get SR GUID"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Object Class: Runbook Automation Activity
    • Object Guid: {SC Object Guid from "Get Runbook Object"}
    • Related Class: Service Request

clip_image002

  • Click "Finish"
  • Drag the "SC 2012 Service Manager\Get Object" activity into the new runbook
  • Rename it to "Get Service Request"
  • Link "Get SR GUID" to "Get Service Request"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Class: Service Request Extended
    • Filters: SC Object GUID Equals {Related Object Guid from "Get SR GUID"}

clip_image003

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Application Collection"
  • Link "Get Service Request" to "Get Application Collection"
  • Fill out the following properties under "Details"
    • XML Text: {User Input from "Get Service Request"}
    • Xpath Query: /UserInputs/UserInput[@Question='Select Application Collection']/@Answer

clip_image004

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Application Collection Display Name"
  • Link "Get Application Collection" to "Get Application Collection Display Name"
  • Fill out the following properties under "Details"
    • XML Text: {Query Result from "Get Application Collection"}
    • Xpath Query: //@DisplayName

clip_image005

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Collection"
  • Link "Get Application Collection Display Name" to "Get Collection"
  • Fill out the following properties under "Details"
    • XML Text: {User Input from "Get Service Request"}
    • Xpath Query: /UserInputs/UserInput[@Question='Select Collection to Include in Application Collection']/@Answer

clip_image006

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Collection Display Name"
  • Link "Get Collection" to "Get Collection Display Name"
  • Fill out the following properties under "Details"
    • XML Text: {Query Result from "Get Collection"}
    • Xpath Query: //@DisplayName

clip_image007

  • Click "Finish"
  • Drag the "SC 2012 Configuration Manager\Add Collection Rule" activity into the new runbook
  • Link "Get Collection" to "Add Collection Rule"
  • Fill out the following properties under "Details"
    • Collection: {Query result from "Get Application Collection Display Name"}
    • Collection Value Type: Name
    • Rule Name: {Query result from "Get Collection Display Name"}
    • Rule Type: Include Collection
    • Rule Definition: Query result from "Get Collection Display Name"}
    • Rule Definition Value Type: Collection Names

clip_image008

  • Click "Finish"
  • Drag the "SC 2012 Configuration Manager\Update Collection Membership" activity into the new runbook
  • Link "Add Collection Rule" to "Update Collection Membership"
  • Fill in the following properties under "Details"
    • Collection: {Query result from "Get Application Collection Display Name"}
    • Collection Value Type: Name
    • Wait for Refresh Completion: True
    • Polling Interval (seconds): 5

clip_image009

  • Click "Finish"
  • Drag the "Runbook Control\Invoke Runbook" activity into the new runbook
  • Rename it to "Sync Collection in SM"
  • Link "Update Collection Membership" to "Sync Collection in SM"
  • Set the following properties on the "Sync Collection in SM" activity
    • Runbook: <Sync Applications Collections runbook created previously>
    • ServiceRequest: {ID from "Get Service Request"}
    • CollectionName: {Query result from "Get Application Collection Display Name"}
    • Ensure "Wait for completion" is checked
  • Click "Finish"
  • Drag the "Text File Management\Find Text" activity into the new runbook
  • Rename it to "Get Script Result"
  • Link "Create Collection in SM" to "Get Script Result"
  • Fill out the following properties under "Details"
    • File: <local sharepath>\Automation\Logs\SRLogs\{ID from "Get Service Request"}.log
    • File encoding: Auto
    • Search text: Info:Script Complete, Result:

clip_image010

  • Click "Finish"
  • Drag the "SC 2012 Service Manager\Update Object" activity into the new runbook
  • Rename it to "Update Description of Service Request"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Class: Service Request
    • Object Guid: {SC Object Guid from "Get Service Request"}
    • Fields: Description {Original line from "Get Script Result"} CMTrace Log File: {File path from "Get Script Result"}

clip_image011

  • Click "Finish" and link "Get Script Result" to "Update Description of Service Request"
  • Check in the Runbook, it should look similar to this:

clip_image012

Create the Remove Include Rule from Application Collection Runbook

This Runbook will remove include collection rules from "application collections" in Configuration Manager, update the collection membership in Configuration Manager, trigger the Sync Application Collections runbook created previously, and finally update the Description in the Service Request with the result of the Sync collections runbook.

  • Open the Orchestrator Runbook Designer
  • Create a new runbook
  • Drag the "Runbook Control\Initialize Data" activity into the new runbook
  • Rename it to "Get Runbook GUID"
  • Create a new string parameter under "Details" called RunbookID, and click "Finish"
  • Drag the "SC 2012 Service Manager\Get Object" activity into the new runbook
  • Rename it to "Get Runbook Object"
  • Link "Get Runbook GUID" to "Get Runbook Object"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Class: Runbook Automation Activity
    • Filters: SC Object Guid Equals {RunbookID from "Get Runbook GUID"}

clip_image001[1]

  • Click "Finish"
  • Drag the "SC 2012 Service Manager\Get Relationship" activity into the new runbook
  • Rename it to "Get SR GUID"
  • Link "Get Runbook Object" to "Get SR GUID"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Object Class: Runbook Automation Activity
    • Object Guid: {SC Object Guid from "Get Runbook Object"}
    • Related Class: Service Request

clip_image002[1]

  • Click "Finish"
  • Drag the "SC 2012 Service Manager\Get Object" activity into the new runbook
  • Rename it to "Get Service Request"
  • Link "Get SR GUID" to "Get Service Request"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Class: Service Request Extended
    • Filters: SC Object GUID Equals {Related Object Guid from "Get SR GUID"}

clip_image003[1]

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Application Collection"
  • Link "Get Service Request" to "Get Application Collection"
  • Fill out the following properties under "Details"
    • XML Text: {User Input from "Get Service Request"}
    • Xpath Query: /UserInputs/UserInput[@Question='Select Application Collection']/@Answer

clip_image004[1]

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Application Collection Display Name"
  • Link "Get Application Collection" to "Get Application Collection Display Name"
  • Fill out the following properties under "Details"
    • XML Text: {Query Result from "Get Application Collection"}
    • Xpath Query: //@DisplayName

clip_image005[1]

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Collection"
  • Link "Get Application Collection Display Name" to "Get Collection"
  • Fill out the following properties under "Details"
    • XML Text: {User Input from "Get Service Request"}
    • Xpath Query: /UserInputs/UserInput[@Question='Select Collection to Remove from Application Collection']/@Answer

clip_image006[1]

  • Click "Finish"
  • Drag the "Utilities\Query XML" activity into the new runbook
  • Rename it to "Get Collection Display Name"
  • Link "Get Collection" to "Get Collection Display Name"
  • Fill out the following properties under "Details"
    • XML Text: {Query Result from "Get Collection"}
    • Xpath Query: //@DisplayName

clip_image007[1]

  • Click "Finish"
  • Drag the "SC 2012 Configuration Manager\Delete Collection Rule" activity into the new runbook
  • Link "Get Collection" to "Delete Collection Rule"
  • Fill out the following properties under "Details"
    • Collection: {Query result from "Get Application Collection Display Name"}
    • Collection Value Type: Name
    • Membership Rule: {Query result from "Get Collection Display Name"}
    • Membership Rule Type: Include Collection

clip_image013

  • Click "Finish"
  • Drag the "SC 2012 Configuration Manager\Update Collection Membership" activity into the new runbook
  • Link "Delete Collection Rule" to "Update Collection Membership"
  • Fill in the following properties under "Details"
    • Collection: {Query result from "Get Application Collection Display Name"}
    • Collection Value Type: Name
    • Wait for Refresh Completion: True
    • Polling Interval (seconds): 5

clip_image009[1]

  • Click "Finish"
  • Drag the "Runbook Control\Invoke Runbook" activity into the new runbook
  • Rename it to "Sync Collection in SM"
  • Link "Update Collection Membership" to "Sync Collection in SM"
  • Set the following properties on the "Sync Collection in SM" activity
    • Runbook: <Sync Applications Collections runbook created previously>
    • ServiceRequest: {ID from "Get Service Request"}
    • CollectionName: {Query result from "Get Application Collection Display Name"}
    • Ensure "Wait for completion" is checked
  • Click "Finish"
  • Drag the "Text File Management\Find Text" activity into the new runbook
  • Rename it to "Get Script Result"
  • Link "Create Collection in SM" to "Get Script Result"
  • Fill out the following properties under "Details"
    • File: <local sharepath>\Automation\Logs\SRLogs\{ID from "Get Service Request"}.log
    • File encoding: Auto
    • Search text: Info:Script Complete, Result:

clip_image010[1]

  • Click "Finish"
  • Drag the "SC 2012 Service Manager\Update Object" activity into the new runbook
  • Rename it to "Update Description of Service Request"
  • Fill out the following properties under "Details"
    • Connection: <Your Service Manager Connection>
    • Class: Service Request
    • Object Guid: {SC Object Guid from "Get Service Request"}
    • Fields: Description {Original line from "Get Script Result"}
    • CMTrace Log File: {File path from "Get Script Result"}

clip_image011[1]

  • Click "Finish" and link "Get Script Result" to "Update Description of Service Request"
  • Check in the Runbook, it should look similar to this:

clip_image014

Create the Runbook Automation Activity Template for the Add Include Rule to Application Collection Runbook

The Runbook Automation Activity Template will be link the Runbook we just created to a Service Request that we will be created later.

  1. Open the Service Manager Console
  2. Go to Administration\Connectors and Synchronize your Orchestrator Runbook Connector
  3. Go to Library\Templates and click "Create Template"
    • Name: Add Include Rule to Application Collection RAA Template
    • Description: Add Include Rule to Application Collection RAA Template
    • Class: Runbook Automation Activity
    • Management Pack: Click "New"
      • Name: DataCenter Automation: Configuration Manager Application Collections UI
      • Description: Configuration Manager Application Collections Templates and Offerings
    • Click OK, the Runbook Activity Form should appear. Check "Is Ready For Automation"
      • Title: Add Include Rule to Application Collection RA
      • Description: Add Include Rule to Application Collection RA
      • Click the "Runbook" Tab
      • Click "Select" and choose the Runbook created earlier
      • Click "Edit Mapping" and choose "Object\Id"
      • Click "OK"

Create the Service Request Template for the Add Include Rule to Application Collection Runbook

The Service Request Template is needed to create a Request Offering using the Runbook Activity Template created previously

  1. Open the Service Manager Console
  2. Go to Library\Templates and click "Create Template"
    • Name: Add Include Rule to Application Collection SR Template
    • Description: Add Include Rule to Application Collection SR Template
    • Class: Service Request
    • Management Pack: DataCenter Automation: Configuration Manager Application Collections UI
    • Click OK, the Service Request Form should appear.
      • Title: Add Include Rule to Application Collection SR
      • Description: Add Include Rule to Application Collection SR
      • Click the "Activities" Tab
      • Click the Plus sign and select the Runbook Activity Template created earlier
      • Click OK when the form is launched

Create Request Offering for Add Collection to Application Collection

The Add Collection to Application Collection request offering will be used to configure the user interface displayed via the self-service portal

  • Open the Service Manager Console
  • Go to Library\Service Catalog\Request Offerings and Click "Create Request Offering"
    • Title: Add Collection to Application Collection
    • Description: Add Include Rule to Application Collection
    • Template name: Add Include Rule to Application Collection SR Template
    • Management Pack: DataCenter Automation: Configuration Manager Application Collections UI
  • User Prompts
    • Select Application Collection | Required | Query Results
    • Select Collection to Include in Application Collection | Required | Query Results

clip_image015

  • Configure Prompts
    • Select Application Collection
      • Select Class: Application Collection Projection
      • Display Columns: Name, CollectionID
      • Options: Check Add user-selected objects to template object as related items (Add Include Rule in Application Collection SR - (Service Request))
    • Select Collection to Include in Application Collection
      • Select Class: Collection Projection
      • Display Columns: Name, CollectionID, MemberCount
      • Options: Check Allow the user to select multiple objects and Add user-select objects to template object as related items (Add Include Rule in Application Collection SR - (Service Request))
    • Publish: Published

Create the Runbook Automation Activity Template for the Remove Include Rule from Application Collection Runbook

The Runbook Automation Activity Template will be link the Runbook we just created to a Service Request that we will be created later.

  1. Open the Service Manager Console
  2. Go to Administration\Connectors and Synchronize your Orchestrator Runbook Connector
  3. Go to Library\Templates and click "Create Template"
    • Name: Remove Include Rule from Application Collection RAA Template
    • Description: Remove Include Rule from Application Collection RAA Template
    • Class: Runbook Automation Activity
    • Management Pack: Click "New"
      • Name: DataCenter Automation: Configuration Manager Application Collections UI
      • Description: Configuration Manager Collections Templates and Offerings
    • Click OK, the Runbook Activity Form should appear. Check "Is Ready For Automation"
      • Title: Remove Include Rule from Application Collection RA
      • Description: Remove Include Rule from Application Collection RA
      • Click the "Runbook" Tab
      • Click "Select" and choose the Runbook created earlier
      • Click "Edit Mapping" and choose "Object\Id"
      • Click "OK"

Create the Service Request Template for the Remove Include Rule from Application Collection Runbook

The Service Request Template is needed to create a Request Offering using the Runbook Activity Template created previously

  1. Open the Service Manager Console
  2. Go to Library\Templates and click "Create Template"
    • Name: Remove Include Rule from Application Collection SR Template
    • Description: Remove Include Rule from Application Collection SR Template
    • Class: Service Request
    • Management Pack: DataCenter Automation: Configuration Manager Application Collections UI
    • Click OK, the Service Request Form should appear.
      • Title: Remove Include Rule from Application Collection SR
      • Description: Remove Include Rule from Application Collection SR
      • Click the "Activities" Tab
      • Click the Plus sign and select the Runbook Activity Template created earlier
      • Click OK when the form is launched

Create Request Offering for Remove Collection from Application Collection

The Remove Collection from Application Collection request offering will be used to configure the user interface displayed via the self-service portal

  • Open the Service Manager Console
  • Go to Library\Service Catalog\Request Offerings and Click "Create Request Offering"
    • Title: Remove Collection from Application Collection
    • Description: Remove Collection from Application Collection
    • Template name: Remove Include Rule from Application Collection SR Template
    • Management Pack: DataCenter Automation: Configuration Manager Application Collections UI
  • User Prompts
    • Select Application Collection | Required | Query Results
    • Select Collection to Remove from Application Collection | Required | Query Results

clip_image016

  • Configure Prompts
    • Select Application Collection
      • Select Class: Application Collection Projection
      • Display Columns: Name, CollectionID
      • Options: Check Add user-selected objects to template object as related items (Remove Include Rule in Application Collection SR - (Service Request))
    • Select Collection to Include in Application Collection
      • Select Class: Collection Projection
      • Display Columns: Name, CollectionID, MemberCount
      • Options: Check Allow the user to select multiple objects and Add user-select objects to template object as related items (Remove Include Rule in Application Collection SR - (Service Request))
    • Publish: Published

Create Service Offering for Application Management

The Application Management service offering will be used to display the Software Deployment requests via the self-service portal

  1. Open the Service Manager Console
  2. Go to Library\Service Catalog\Service Offerings and Click "Create Service Offering"
    • Title: Application Management
    • Overview: Application Membership Management
    • Description: Application Membership Management
    • Management Pack: DataCenter Automation: Configuration Manager Application Collections UI
    • Request Offerings: Add Collection to Application Collection, Remove Collection from Application Collection
    • Publish: Published
    • Click "Create"

Test Scenarios

  1. Open the Service Manager Self-Service Portal logged in as a location admin
  2. Click on the Application Management Service Offering
  3. Click on the Add Collection to Application Collection Request Offering
  4. Click Go to request form
  5. Check the application collection you want to use
  6. Check the collection you want to include in the application collection
  7. Click Next and then Submit
  8. Repeat testing for Remove Collection from Application Collection Request Offering
  9. Go to "My Requests" and ensure they were completed successfully
  10. Use CMTrace to view output of the logs

Portal

clip_image017

CMTrace

clip_image018