Search code examples
azureazure-automation

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]

example


Solution

  • 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