Share via


Creating or Importing a Runbook

 

Updated: May 13, 2016

Applies To: Windows Azure Pack for Windows Server

You can add a runbook to Service Management Automation by either creating one in the Management Portal or importing an existing runbook from a file. This topic provides procedures for each of these methods.

Creating a new Automation Runbook

You can create a new runbook in Service Management Automation using either the Management Portal or Windows PowerShell. Once the runbook has been created, you can edit it using information in the Runbook Authoring Guide.

To create a new Automation runbook with the Management Portal

  1. In the Management Portal, click, New, App Services, Automation, Runbook, Quick Create.

  2. Enter the required information, and then click Create. The runbook name must start with a letter and can have letters, numbers, underscores, and dashes.

  3. If you want to edit the runbook now, then click Edit Runbook. Otherwise, click OK.

  4. Your new runbook will appear on the Runbooks tab.

To create a new Automation runbook with Windows PowerShell

You can create a new runbook with Windows PowerShell by importing a script file. This is described below in To import a runbook from a script file with Windows PowerShell.

Importing a Runbook into Service Management Automation

You can import a script file into Service Management Automation using either the Management Portal or Windows PowerShell. The file must contain a single workflow, and the name of the workflow must match the name of the script file. This name will be used for the new runbook.

To import a runbook from a script file with the Management portal

You can use the following procedure to import a script file into Service Management Automation.

  1. In the Management portal, select Automation and then select an Automation Account.

  2. Click Import.

  3. Click Browse for File and locate the script file to import.

  4. If you want to edit the runbook now, then click Edit Runbook. Otherwise, click OK.

  5. Your new runbook will appear on the Runbooks tab for the Automation Account.

To import a runbook from a script file with Windows PowerShell

You can use the Import-SmaRunbook cmdlet to create a new runbook from a script file containing a workflow. To modify the draft version of an existing runbook with the contents of a script file, see To Change the Contents of a Runbook Using Windows PowerShell.

The following sample commands show how to import a script file into an existing runbook and then publish it.

$webServer = 'https://MyServer'  
$port = 9090  
$runbookName = "Test-Runbook"  
$scriptPath = "c:\runbooks\Test-Runbook.ps1"  
  
Import-SmaRunbook –WebServiceEndpoint $webServer –Port $port –Path $scriptPath   
Publish-SMARunbook –WebServiceEndpoint $webServer –Port $port –Name $runbookName  
  

See Also

Service Management Automation
Runbook Authoring [SMA]
Editing a Runbook