New-AzureRmAutomationModule
Imports a module into Automation.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
New-AzureRmAutomationModule
[-Name] <String>
[-ContentLinkUri] <Uri>
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
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.
If you import a wps_2 module into Automation by using this cmdlet or the Set-AzureRmAutomationModule cmdlet, the operation is asynchronous.
The command finishes whether the import succeeds or fails.
To check whether it succeeded, run the following command:
PS C:\\\> $ModuleInstance = Get-AzureRmAutomationModule -Name
ModuleName Check the ProvisioningState property for a value of Succeeded.
Examples
Example 1: Import a module
PS C:\>New-AzureRmAutomationModule -AutomationAccountName "Contoso17" -Name "ContosoModule" -ContentLink "http://contosostorage.blob.core.windows.net/modules/ContosoModule.zip" -ResourceGroupName "ResourceGroup01"
This command imports a module named ContosoModule into the Automation account named Contoso17. The module is stored in an Azure blob in a storage account named contosostorage and a container named modules.
Parameters
-AutomationAccountName
Specifies the name of the Automation account for which this cmdlet imports a module.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ContentLinkUri
The url to a module zip package
Type: | Uri |
Aliases: | ContentLink |
Position: | 3 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Specifies the name of the module that this cmdlet imports.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of a resource group for which this cmdlet imports a module.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |