For whatever reason, the -Wait parameter is not working within my powershell runbook. I am perplexed as to why this wouldn't work. I assuming it is a newbie mistake. Any thoughts? Full error and code below:

Error: "Start-AzureRmAutomationRunbook : A parameter cannot be found that matches parameter name 'Wait'. At restore_DEV_DBIN_master_runbook:31 char:31 + + CategoryInfo : InvalidArgument: (:) [Start-AzureRmAutomationRunbook], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.Automation.Cmdlet.StartAzureAutomationRunbook"

workflow restore_DEV_DBIN_master_runbook
{
    #Establishing Connection
    $connectionName = "AzureRunAsConnection"
    try {
        # Getting the service principal connection "AzureRunAsConnection"
        $servicePrincipalConnection = Get-AutomationConnection -name $connectionName

        "Logging into Azure..."
        Add-AzureRmAccount -ServicePrincipal -TenantID $servicePrincipalConnection.TenantID -ApplicationID $servicePrincipalConnection.ApplicationID -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint
    }

    catch {
        if (!$servicePrincipalConnection) {
            $ErrorMessage = "Connection $connectionName not found."
            throw $ErrorMessage
        }
        else {
            Write-Error -Message $_.Exception
            throw $_.Exception
        }
    }
    if ($err) {
        throw $err
    }

    inlinescript
    {
        Start-AzureRmAutomationRunbook –AutomationAccountName 'SQLAutomation' –Name 'scale_down_DEV_DBIN_temp_db' -ResourceGroupName 'SQL-Automation-rg' -Wait
    }
}
1

There are 1 answers

0
Daniel Johnson On BEST ANSWER

Figured out the resolution to this. My modules where out of date. Once I updated it, Everything worked like a charm.

However, Updating is not straightforward. If you actually click the update icon, it tells you that this feature is depricated and that you have to download the ps1 file then import it into a runbook. Wasn't hard to run from there, just a few extra steps.

enter image description here

enter image description here