question

Noorjahan avatar image
0 Votes"
Noorjahan asked tbgangav-MSFT commented

How can we add the powershell scripts that are used in main powershell script in run books

I am trying to automate the kusto scripts by triggering from azure runbook instead from VM. I have a masterscript.ps1 which calls other powershell scripts. Could you please help me where should be we add the code of other powershell scripts in runbook created. Ways that we can call other powershell scripts from powershell runbook.
In below example, I have the masterscript which tries to invoke the other powershell scripts. In powershell runbook type, where should I add the other scripts code.
Example :

Masterscript.ps1 -
write-host n n "Master script initiate" n n

write-host n "########################################################################################################################################################################################" n n write-host "investigatorDB_v3.ps1 script initiate" n n write-host "########################################################################################################################################################################################" n n &"$PSScriptroot\investigatorDB_v3.ps1" -save write-host n "########################################################################################################################################################################################" n n
write-host "investigatorDB_ClosedSync_v3.ps1 script initiate" n n
write-host "########################################################################################################################################################################################" n n
&"$PSScriptroot\investigatorDB_ClosedSync_v3.ps1" -save

write-host n "########################################################################################################################################################################################" n n write-host "investigatorDB_UpdateState_v3.ps1 script initiate" n n write-host "########################################################################################################################################################################################" n n &"$PSScriptroot\investigatorDB_UpdateState_v3.ps1" -save write-host n n "Master Script Complete" n `n



azure-automation
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Create functions, but them in module and import to AA

0 Votes 0 ·

Hi @Noorjahan, Did you get chance to review the below information? Let me know if you have any further queries regarding it.

0 Votes 0 ·

1 Answer

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered

Hi @Noorjahan,

In Azure Automation we have a feature to create modular runbooks so a parent runbook can call one or more child runbooks to perform required functionality. On the other hand, as @MortenLerudjordet-9658's mentioned, you could also go with traditional way of creating functions in a module and then can import it to Azure Automation.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.