New-AzAutomationRuntimeEnvironment
Creates a new Runtime Environment in Azure Automation.
Syntax
Default (Default)
New-AzAutomationRuntimeEnvironment
[-Name] <String>
[-Language] <String>
[-Version] <String>
[-Location <String>]
[-DefaultPackage <Hashtable>]
[-Description <String>]
[-Tag <Hashtable>]
[-ResourceGroupName] <String>
[-AutomationAccountName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-AzAutomationRuntimeEnvironment cmdlet creates a new Runtime Environment in an Azure Automation account. A Runtime Environment defines the language runtime (PowerShell or Python) and version to use when executing runbooks, along with any default packages that should be available. The location is inherited from the parent Automation Account.
Examples
Example 1: Create a PowerShell 7.4 runtime environment
New-AzAutomationRuntimeEnvironment -AutomationAccountName "Contoso17" -ResourceGroupName "ResourceGroup01" -Name "PowerShell-7.4-Prod" -Language "PowerShell" -Version "7.4"
This command creates a new PowerShell 7.4 runtime environment named "PowerShell-7.4-Prod" in the automation account named Contoso17. The location is inherited from the Automation Account.
Example 2: Create a Python runtime environment with default packages
$packages = @{"azure-storage-blob"="12.14.0"; "requests"="2.28.1"}
New-AzAutomationRuntimeEnvironment -AutomationAccountName "Contoso17" -ResourceGroupName "ResourceGroup01" -Name "Python-3.10-DataOps" -Language "Python" -Version "3.10" -DefaultPackage $packages -Description "Python environment for data operations"
This command creates a Python 3.10 runtime environment with pre-installed packages for data operations.
Example 3: Create a PowerShell 5.1 runtime environment with Az module
$packages = @{"Az"="12.3.0"}
New-AzAutomationRuntimeEnvironment -AutomationAccountName "Contoso17" -ResourceGroupName "ResourceGroup01" -Name "PowerShell-5.1-Legacy" -Language "PowerShell" -Version "5.1" -DefaultPackage $packages
This command creates a PowerShell 5.1 runtime environment with the Az module pre-installed.
Parameters
-AutomationAccountName
The automation account name.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultPackage
The default packages for the runtime environment as a hashtable of package name to version.
Parameter properties
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Description
The description of the runtime environment.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Language
The language of the runtime environment. Valid values are 'PowerShell' or 'Python'.
Parameter properties
Type: String
Default value: None
Accepted values: PowerShell, Python
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 4
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Location
The Azure region for the runtime environment. If not specified, uses the Automation Account location.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Name
The runtime environment name.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ResourceGroupName
The resource group name.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Tag
A hashtable of tags to associate with the runtime environment.
Parameter properties
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Version
The version of the language runtime. For PowerShell: '5.1', '7.2', '7.4', '7.6'. For Python: '3.8', '3.10'.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 5
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs