Modifier

Partager via


Start-AzAutomationRunbook

Starts a runbook job.

Syntax

Start-AzAutomationRunbook
     [-Name] <String>
     [-Parameters <IDictionary>]
     [-RunOn <String>]
     [-ResourceGroupName] <String>
     [-AutomationAccountName] <String>
     [-DefaultProfile <IAzureContextContainer>]
     [<CommonParameters>]
Start-AzAutomationRunbook
     [-Name] <String>
     [-Parameters <IDictionary>]
     [-RunOn <String>]
     [-Wait]
     [-MaxWaitSeconds <Int32>]
     [-ResourceGroupName] <String>
     [-AutomationAccountName] <String>
     [-DefaultProfile <IAzureContextContainer>]
     [<CommonParameters>]

Description

The Start-AzAutomationRunbook cmdlet starts an Azure Automation runbook job. Specify the ID or name of a runbook.

Examples

Example 1: Start a runbook job

Start-AzAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbk01" -ResourceGroupName "ResourceGroup01"

This command starts a runbook job for the runbook named Runbk01 in the Azure Automation account named Contoso17.

Example 2: Start a Python 2 runbook job with parameters

$params = [ordered]@{"Key1"="ValueForPosition1";"Key2"="ValueForPosition2"}
Start-AzAutomationRunbook -AutomationAccountName "Contoso17" -Name "RunbkPy01" -ResourceGroupName "ResourceGroup01" -Parameters $params

This command starts a runbook job for the Python 2 runbook named RunbkPy01 in the Azure Automation account named Contoso17 with "ValueForPosition1" as the first positional parameter and "ValueForPosition2" for the second one.

Example 3: Start a runbook job and wait for results

Start-AzAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbk01" -ResourceGroupName "ResourceGroup01" -MaxWaitSeconds 1000 -Wait

This command starts a runbook job for the runbook named Runbk01 in the Azure Automation account named Contoso17. This command specifies the Wait parameter. Therefore, it returns results after the job is completed. The cmdlet waits up to 1000 seconds for the results.

Parameters

-AutomationAccountName

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxWaitSeconds

Specifies the number of seconds this cmdlet waits for a job to finish before it abandons the job. The default value is 10800, or three hours.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Type:String
Aliases:RunbookName
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Parameters

Type:IDictionary
Aliases:JobParameters
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RunOn

Specifies which Hybrid Worker Group on which to run the runbook.

Type:String
Aliases:HybridWorker
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Wait

Indicates that this cmdlet waits for job to complete, suspend, or fail, and then returns control to Azure PowerShell.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

Job

PSObject