Skip to content

Instantly share code, notes, and snippets.

@mgreenegit
Created April 9, 2015 12:34
Show Gist options
  • Select an option

  • Save mgreenegit/420f7f6e378c9f60f193 to your computer and use it in GitHub Desktop.

Select an option

Save mgreenegit/420f7f6e378c9f60f193 to your computer and use it in GitHub Desktop.
Kick off an Azure Automation Runbook
Function Run {
param (
[parameter (mandatory = $true, valuefrompipeline = $true)]
[system.string]$Runbook,
[system.string]$AutomationAccount
)
if (!(Get-Module Azure)) {ipmo 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1'}
if (!$AutomationAccount) {$AutomationAccount = Get-AzureAutomationAccount | % AutomationAccountName}
Start-AzureAutomationRunbook -Name $Runbook -AutomationAccountName $AutomationAccount
}
@mgreenegit

Copy link
Copy Markdown
Author

Several things need to be added. Prompt for account, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment