Add-AzureHDInsightScriptAction

Adds an HDInsight script action.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Add-AzureHDInsightScriptAction
   -Config <AzureHDInsightConfig>
   -Name <String>
   -ClusterRoleCollection <ClusterNodeType[]>
   -Uri <Uri>
   [-Parameters <String>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

This version of Azure PowerShell HDInsight is deprecated. These cmdlets will be removed by January 1, 2017. Please use the newer version of Azure PowerShell HDInsight.

For information about how to use the new HDInsight to create a cluster, see Create Linux-based clusters in HDInsight using Azure PowerShell (https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hadoop-create-linux-clusters-azure-powershell/). For information about how to submit jobs by using Azure PowerShell and other approaches, see Submit Hadoop jobs in HDInsight (https://azure.microsoft.com/en-us/documentation/articles/hdinsight-submit-hadoop-jobs-programmatically/). For reference information about Azure PowerShell HDInsight, see Azure HDInsight Cmdlets.

The Add-AzureHDInsightScriptAction cmdlet provides Azure HDInsight functionality that is used to install additional software or to change the configuration of applications that run on a Hadoop cluster by using Windows PowerShell scripts.

A script action runs on the cluster nodes when HDInsight clusters are deployed, and they run after nodes in the cluster complete HDInsight configuration. The script action runs under system administrator account privileges and provides full access rights to the cluster nodes. You can provide each cluster with a list of script actions to run in a specified sequence.

Examples

Example 1: Add a script action to a cluster

PS C:\>$Config = New-AzureHDInsightClusterConfig -ClusterSizeInNodes 4
PS C:\> $Config = Add-AzureHDInsightScriptAction -Config $Config -Name "TestScriptAction" -Uri http://test.com/test.ps1 -Parameters "test" -ClusterRoleCollection HeadNode,DataNode
PS C:\> New-AzureHDInsightCluster -Config $Config

The first command uses the New-AzureHDInsightClusterConfig cmdlet to create an HDInsight cluster configuration, and then stores it in the $Config variable.

The second command uses the Add-AzureHDInsightScriptAction cmdlet to add the script action named TestScriptAction to $Config.

The final command uses the New-AzureHDInsightCluster cmdlet to create a new HDInsight cluster that runs the script action stored in $Config.

Example 2: Add multiple script actions to a cluster

PS C:\>$Config = New-AzureHDInsightClusterConfig -ClusterSizeInNodes 4
PS C:\> $Config = Add-AzureHDInsightScriptAction -Config $Config -Name "TestScriptAction1" -Uri http://test.com/test1.ps1 -Parameters "Test1" -ClusterRoleCollection HeadNode,DataNode | Add-AzureHDInsightScriptAction -Config $Config -Name "TestScriptAction2" -Uri http://test.com/test2.ps1 -ClusterRoleCollection HeadNode
PS C:\> New-AzureHDInsightCluster -Config $Config

The first command uses the New-AzureHDInsightClusterConfig cmdlet to create an HDInsight cluster configuration, and then stores it in the $Config variable.

The second command uses the Add-AzureHDInsightScriptAction cmdlet to add the specified script action to $Config, and then uses the pipeline operator to pass $Config to Add-AzureHDInsightScriptAction a second time to add a second script action to $Config.

The final command uses the New-AzureHDInsightCluster cmdlet to create a cluster that runs the script actions in $Config.

Parameters

-ClusterRoleCollection

Specifies the nodes for which to run a script. The acceptable values for this parameter are: HeadNode or DataNode.

You can specify one value or both values.

Type:ClusterNodeType[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Config

Specifies a configuration object. This cmdlet adds script action information to the object that this parameter specifies.

Type:AzureHDInsightConfig
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of a script action.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Parameters

Specifies the parameters that are required by a script action.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Uri

Specifies the URI location of a script to run.

Type:Uri
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False