Creating an Automation PowerShell Module using 'private' GitHub repo?

Kenneth Huddleston 145 Reputation points
2023-04-10T18:55:30.0033333+00:00

I would like to be able to pull a PowerShell module from an organization/private repo. Going through the UI, I am only given the option to upload it manually via a zip file. Going through Terraform, I am only given the option to upload it through a publicly hosted URI. Is there a way to give Automation access to my GitHub repo, so it can pull private modules?

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,196 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,329 questions
0 comments No comments
{count} votes

Accepted answer
  1. AnuragSingh-MSFT 21,251 Reputation points
    2023-04-11T05:55:42+00:00

    @Kenneth Huddleston , thank you for the question. This feature of pulling PS module from private GH repo is not available as of now. However, there are workarounds that can be used to achieve this goal, like

    1. Upload it manually (as mentioned in the question)
    2. Download the file on your local machine and use New-AzAutomationModule cmdlet to upload it to the automation account.
    3. A slightly modified version is to use option 2 (New-AzAutomationModule) with the solution as provided by Rich in the answer above. This would require creating a runbook --> using the script in discussion to download the module locally with authentication --> using New-AzAutomationModule cmdlet to upload the module to the Azure Automation Account.

    I also found a feedback item which was shared sometime back - Allow Custom Module sync / link from AzureDevOps Artifacts (or other external repository) I have reached out to the team requesting for an update about it and will update this thread with additional information. Hope this helps. If the answer did not help, please add more context/follow-up question for it, and we will help you out. Else, if the answer helped, please click Accept answer so that it can help others in the community looking for help on similar topics.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rich Matheisen 45,906 Reputation points
    2023-04-10T20:01:00.28+00:00
    0 comments No comments