Skip to content

Commit 2ed3b4f

Browse files
authored
Merge pull request #42580 from husamhilal/patch-3
Adding an example for importing PS module from PSGallery directly
2 parents f9c4f9f + 5237f19 commit 2ed3b4f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

articles/automation/shared-resources/modules.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ You can use the [New-AzureRmAutomationModule](/powershell/module/azurerm.automat
2929
New-AzureRmAutomationModule -Name <ModuleName> -ContentLinkUri <ModuleUri> -ResourceGroupName <ResourceGroupName> -AutomationAccountName <AutomationAccountName>
3030
```
3131

32+
You can also use the same cmdlet to import a module from PowerShell Gallery directly. Make sure to grab **ModuleName** and **ModuleVersion** from [PowerShell Gallery](https://www.powershellgallery.com).
33+
34+
```azurepowershell-interactive
35+
$moduleName = <ModuleName>
36+
$moduleVersion = <ModuleVersion>
37+
New-AzAutomationModule -AutomationAccountName <AutomationAccountName> -ResourceGroupName <ResourceGroupName> -Name $moduleName -ContentLinkUri "https://www.powershellgallery.com/api/v2/package/$moduleName/$moduleVersion"
38+
```
39+
3240
### Azure portal
3341

3442
In the Azure portal, navigate to your Automation Account and select **Modules** under **Shared Resources**. Click **+ Add a module**. Select a **.zip** file that contains your module and click **Ok** to start to import process.

0 commit comments

Comments
 (0)