通过 powershell 导入 Azure 自动化模块

Import Azure automation module via powershell

我可以通过 ARM 和 Portal 上传和使用自动化模块。我想通过 powershell 上传模块。这可能吗?

我的目标是通过我们的构建服务器将自定义模块上传到 Azure Automation。从构建服务器上传模块到azure,是用ARM还是powershell更好?

就用powershell,很简单:

New-AzureRmAutomationModule -ResourceGroupName  $rgName -AutomationAccountName $name -Name $moduleName -ContentLink $moduleUrl

取自 cmdlet 的帮助:

The New-AzureRmAutomationModule cmdlet imports a module into Azure Automation. This command accepts a compressed file that has a .zip file
name extension. The file contains a folder that includes a file that is one of the following types:

- wps_2 module, which has a .psm1 or .dll file name extension

- wps_2 module manifest, which has a .psd1 file name extension


The name of the .zip file, the name of the folder, and the name of the file in the folder must be the same.

Specify the .zip file as a URL that the Automation service can access.