IaC and runbook RRS feed

  • Question

  • In an "Infrastructure as Code" context, I'm trying to rebuild by powershell my automation account.

    I'm able to create the resource group, the automation account with git repos settings and the runbook. The powershell script that is supposed to periodically run is in the repos.

    I need to know the best way to import the script. I've seen the cmdlet Import-AzAutomationRunbook but I can't see how to achieve the binding between the powershell script in the repos and the runbook.

    Have anyone tried this? Is it possible? Is there a better way?

    Thanks in advance,

    Tuesday, November 12, 2019 9:41 PM

All replies

  • Hi bkack,

    Perhaps I am missing something but if you are looking for a way to keep your runbooks in your Automation account up-to-date with your PowerShell scripts in your GitHub repos then you may leverage Source control integration in Azure Automation. For more information, refer this Azure document.

    Hope this helps!
    Friday, November 15, 2019 8:36 AM
  • Thank you KrishnaG,

    I added the step Run-As Account from a supbage in your proposed url (the one with the New-RunAsAccount.ps1 script). Before that step, I had added the New-AzureRmAutomationSourceControl but it wasn't able to get the git content. Now it can but it doesn't seem to sync alone even though I had the switch EnableAutoSync.

    Is there a way to automate the initial sync start by code?

    Thanks in advance,

    Friday, November 22, 2019 6:14 PM