Calling python3 runbook from another runbook in azure automation

GURUVANANTHAM Guru-Mohan 1 Reputation point
2021-10-25T09:43:40.467+00:00

Dear Team,

We have a function (named download_file()) which is in a python3 runbook named get_secret.py. We need to use it in an another python3 runbook called register.py.

All these runbooks are created under one of the automation accounts in Azure.

We would like to know how to call/invoke/import the function/script (get_secret.py) from register.py

Tried as per the usual method given below, but it didn't work.
In register.py

! /usr/bin/env python3

import get_secret

get_secret.download_file()

Also, imported the get_secret.py script into "Python packages" under Shared Resources in Automation Account, that too also not worked out.

The below links provide useful information for powershell but couldn't find any details for python anywhere.

https://learn.microsoft.com/en-us/azure/automation/automation-child-runbooks

Any suggestions/solutions would be very helpful.

Regards,
Guru Mohan G

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,368 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,426 Reputation points Moderator
    2021-10-25T13:40:14.94+00:00

    Hi @GURUVANANTHAM Guru-Mohan ,

    I hope this would be helpful reference regarding python parent and child runbooks. Let me know if you have further queries with regards to it.

    On the other hand, this brought up an Azure document enhancement feedback regarding this Azure document so I have created this issue so that respective content author would review and enhance the document as appropriate.

    Just FYI, in general, if you have any Azure document enhancement feedback then you may click on "This page" option under "Feedback" section of the Azure document.

    143420-image.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.