Search code examples
powershellazuremsbuildazure-automation

Import Azure automation module via powershell


I am able to upload and use an automation module via ARM and the Portal. I would like to upload the module via powershell. Is this possible?

My aim is to have a custom module uploaded to azure automation via our build server. Is it better to use ARM or powershell to upload the module to azure from the build server?


Solution

  • Just use powershell, its pretty easy:

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

    taken from help of the 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.