Edit

Share via


Import-AzAutomationRunbook

Imports an Automation runbook.

Syntax

Default (Default)

Import-AzAutomationRunbook
    [-Path] <String>
    [-Description <String>]
    [-Name <String>]
    [-Tags <IDictionary>]
    -Type <String>
    [-LogProgress <Boolean>]
    [-LogVerbose <Boolean>]
    [-Published]
    [-Force]
    [-ResourceGroupName] <String>
    [-AutomationAccountName] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Import-AzAutomationRunbook cmdlet imports an Azure Automation runbook. Specify the path to a wps_2 script (.ps1) file to import for wps_2 and wps_2 Workflow runbooks, (.graphrunbook) file for graphical runbooks, or (.py) file for python 2 runbooks. For wps_2 Workflow runbooks, the script must contain a single wps_2 Workflow definition that matches the name of the file.

Examples

Example 1: Import a runbook from a file

$Tags = @{"tag01"="value01"; "tag02"="value02"}
Import-AzAutomationRunbook -Path .\GraphicalRunbook06.graphrunbook -Tags $Tags -ResourceGroupName "ResourceGroup01" -AutomationAccountName "AutomationAccount01" -Type GraphicalPowershell

The first command assigns two key/value pairs to the $Tags variable. The second command imports a graphical runbook called GraphicalRunbook06 into the Automation account named AutomationAccount01. The command also assigns the tags stored in $Tags.

Example 2

Imports an Automation runbook. (autogenerated)

Import-AzAutomationRunbook -AutomationAccountName 'AutomationAccount01' -Name 'Configuration01' -Path .\GraphicalRunbook06.graphrunbook -Published -ResourceGroupName 'ResourceGroup01' -Type PowerShell

Parameters

-AutomationAccountName

Specifies the name of the Automation account into which this cmdlet imports a runbook.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Description

Specifies a description for the imported runbook.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Force

ps_force

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LogProgress

Specifies whether the runbook logs progress information.

Parameter properties

Type:

Nullable<T>[Boolean]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-LogVerbose

Specifies whether the runbook logs detailed information.

Parameter properties

Type:

Nullable<T>[Boolean]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies the name of the runbook that this cmdlet imports.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:RunbookName

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Path

Specifies the path of a .ps1 or .graphrunbook file that this cmdlet imports.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:SourcePath

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Published

Indicates that this cmdlet publishes the runbook that it imports.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of the resource group for which this cmdlet imports a runbook.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Tags

Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}

Parameter properties

Type:IDictionary
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Tag

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Type

Specifies the type of runbook that this cmdlet creates. Valid values are:

  • PowerShell
  • PowerShell72
  • GraphicalPowerShell
  • PowerShellWorkflow
  • GraphicalPowerShellWorkflow
  • Graph
  • Python2
  • Python3 The value Graph is obsolete. It is equivalent to GraphicalPowerShellWorkflow.

Parameter properties

Type:String
Default value:None
Accepted values:PowerShell, GraphicalPowerShell, PowerShellWorkflow, GraphicalPowerShellWorkflow, Graph, Python2, Python3, Powershell72
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

IDictionary

Nullable<T>

Outputs

Runbook