简体   繁体   中英

Azure Automation - Runbook parameters not found?

After adding a runbook with parameters, I'm unable to start it, either in the Test Pane or as a Job after publishing.

  • Runbooks that existed prior to this do populate parameters.
  • Unable to start a Test Job in ISE (aka, it's not simply a Portal/browser problem).
  • GET from the ARM API returns a runbook with an empty Parameters property.

[edit] I should probably add it doesn't matter if I have [CmdletBinding()] specified or not. [/edit]

例

The runbook (script) in your screenshot contains a function definition (which takes parameters), but does not ever call the function. Your runbook does not take parameters, the function does. That is why the test pane is showing no parameters.

Try this:

param([string]$Bar)

function test-set {
  param([string]$Bar)
  "$Bar"
}

test-set -Bar $Bar

My memory of this 'support' was incorrect. As Joe points out, Workflow runbooks require the function declaration, but old-school scripts do not.

Commenting the function func-name { } bits allows the runbook parameters to be found again..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM