Skip to content

Instantly share code, notes, and snippets.

@mgreenegit
Created April 9, 2015 12:34
Show Gist options
  • Save mgreenegit/420f7f6e378c9f60f193 to your computer and use it in GitHub Desktop.
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
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