ARM: Get-AzureAutomationRunbook
the object that the cmdlet returns does not return data for the parameters property of the runbook
here is an example: (Powershell and Graphical runbooks with parameters exist in Azure Automation)
$runbooks = Get-AzureAutomationRunbook -ResourceGroupName mms-eus -AutomationAccountName MSDNAutomation
$runbooks | Select Parameters
Parameters
{}
removed other null values to shorten results
{}
{}
{}
@robplank you are listing runbooks above. Listing runbooks does not return all data on the runbook like a get on a single instance does. Get-AzureAutomationRunbook -ResourceGroupName mms-eus -AutomationAccountName MSDNAutomation -Name "MyRunbook" will return the parameters.
If you want to get all data on all runbooks, you can pipe a list to a get, like so:
Get-AzureAutomationRunbook -ResourceGroupName mms-eus -AutomationAccountName MSDNAutomation | Get-AzureAutomationRunbook
@jodoglevy thanks for the solution to my problem, but wouldn't it make more sense to add a parameter to the cmdlet like -extendedProperties $ture or -Properties * that way you are only enumerating the runbooks once?
This is an issue at the API level. If you do a list (don't specify a runbook name), the API will not return you all properties for all the runbooks it returns. Only the get API (where a single runbook name is provided) will return all the properties. This is for perf reasons.
Joe,
Generally speaking, a PowerShell command shouldn't be returning two different types of objects that represent the same object. Seems like poor design to pipe the output from a PowerShell command into the same command.
Cheers, Trevor Sullivan Microsoft MVP: PowerShell http://trevorsullivan.net http://twitter.com/pcgeek86
It's the same object, some fields are just null / empty.
You wouldn't usually pipe a PS command into the same command. You also wouldn't usually need the parameters of all runbooks. The list operation gives you all the usual overview fields for runbooks. For unusual requirements, the script to use will look unusual :)
The underlying issue is due to the fact that PS uses the Get verb for get single item and Get all (list), but the ARM API model considers the get single and get all as separate APIs. This issue is therefore probably common across many ARM get-* cmdlets.
@jodoglevy if the API issue is not going to be fixed can you please add this as an example when the help information get added to the module, most people are not going to run Get-AzureAutomationRunbook | Get-AzureAutomationRunbook because when you run Get-Process and Get-Process | Get-Process you get the same results.
maybe the API needs to be updated to allow a control parameter to be passed that would allow the powershell cmdlet to follow PS best practices
Joe,
I think I see where the discrepancy is. It's a misunderstanding of what your average PowerShell user "usually" expects. As a general rule, a PowerShell user expects to call a command and get results. If some object properties are empty, that should not be, then the PowerShell user will be confused. While the explanation of the underlying REST API is helpful, and I am not unfamiliar with the concept of "lazy" properties, the PowerShell interface should be more admin-friendly.
A common problem I've seen with the development of Azure PowerShell is that the project is generally (not strictly) being guided by a "one-for-one" match-up between PowerShell commands and REST API calls. Just because a particular REST API doesn't exist, or doesn't operate in the way that a PowerShell user expects, does not mean that the user should suffer for it. Instead, the PowerShell module's public interface should abstract the API implementation details from the end user, and expose functionality using common PowerShell design guidelines.
This design methodology helps to ensure a consistent "look and feel" for PowerShell users, who may or may not understand the intricacies of each platform that they are automating.
Cheers, Trevor Sullivan Microsoft MVP: PowerShell http://trevorsullivan.net http://twitter.com/pcgeek86
I'll make sure we include notes on this in the cmdlet docs, thanks.