Forum Discussion

Arindam's avatar
Arindam
Copper Contributor
Aug 13, 2024

Start-AzAutomationRunbook : Invalid runbook parameters.

Hi Team,

My PowerShell Script trying to run a Runbook job using Runbook Hybrid worker group gives this error:

Start-AzAutomationRunbook : Invalid runbook parameters.

 

This happens when I am trying to pass parameter such as website name. Any help will be great. 

 

Clear-AzContext -Force
Import-Module Az.Accounts
Import-Module Az.Automation


$Secret = ""
$AppId =  ""
$TenantID = ""
$SecurePass = ConvertTo-SecureString $Secret -AsPlainText -Force


$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $AppId, $SecurePass
Connect-AzAccount -ServicePrincipal -Tenant $TenantID -Credential $Credential
#$IIS = "bill36"
#$Redi = "https://www.google.com" 
$parameters= [ordered]@{'SiteName' = 'bill36' ; Redirect = 'https://www.google.com'}



$resourceGroupName = "OnPrem-Automation"
$automationAccountName = "AzOnPrem-Automation"
$runbookName1 = "US03wredirect-IIS"
$hybridWorkerGroupName1 = "OnPrem-Automation"

$runbookName2 = "US01WREDIRECT111-IIS-OnPrem-Automation1"
$hybridWorkerGroupName2 = "OnPrem-Automation1"

$job1 = Start-AzAutomationRunbook -ResourceGroupName $resourceGroupName -AutomationAccountName $automationAccountName -Name $runbookName1 -Parameters $parameters -RunOn $hybridWorkerGroupName1 -debug
#$job2 = Start-AzAutomationRunbook -ResourceGroupName $resourceGroupName -AutomationAccountName $automationAccountName -Name $runbookName2 -Parameters $params2 -RunOn $hybridWorkerGroupName2

 

No RepliesBe the first to reply

Resources