Add-​Azure​Rm​HD​Insight​Script​Action

Adds a script action to a cluster configuration object.

Syntax

Add-AzureRmHDInsightScriptAction
   [-Config] <AzureHDInsightConfig>
   [-NodeType] <ClusterNodeType>
   [-Uri] <Uri>
   [-Name] <String>
   [[-Parameters] <String>]
   [<CommonParameters>]

Description

The Add-AzureRmHDInsightScriptAction cmdlet adds script actions to the HDInsight configuration object created by the New-AzureRmHDInsightClusterConfig cmdlet.

Script actions provide 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 or Bash scripts (for Windows or Linux clusters, respectively).

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 the cluster configuration object

PS C:\># Primary storage account info
PS C:\> $storageAccountResourceGroupName = "Group"
PS C:\> $storageAccountName = "yourstorageacct001"
PS C:\> $storageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value


PS C:\> $storageContainer = "container001"

# Script action info
PS C:\> $scriptActionName = "<script action name>"
PS C:\> $scriptActionURI = "<script action URI>"
PS C:\> $scriptActionParameters = "<script action parameters>" 

# Cluster configuration info
PS C:\> $location = "East US 2"
PS C:\> $clusterResourceGroupName = "Group"
PS C:\> $clusterName = "your-hadoop-001"
PS C:\> $clusterCreds = Get-Credential

# If the cluster's resource group doesn't exist yet, run:
#   New-AzureRmResourceGroup -Name $clusterResourceGroupName -Location $location

# Create the cluster
PS C:\> New-AzureRmHDInsightClusterConfig  `
            | Add-AzureRmHDInsightScriptAction `
                -Name $scriptActionName `
                -Uri $scriptActionURI `
                -Parameters $scriptActionParameters `
                -NodeType Worker `
            | Add-AzureRmHDInsightScriptAction `
                -Name $scriptActionName `
                -Uri $scriptActionURI `
                -Parameters $scriptActionParameters `
                -NodeType Head `
            | New-AzureRmHDInsightCluster `
                -ClusterType Hadoop `
                -OSType Windows `
                -ClusterSizeInNodes 4 `
                -ResourceGroupName $clusterResourceGroupName `
                -ClusterName $clusterName `
                -HttpCredential $clusterCreds `
                -Location $location `
                -DefaultStorageAccountName "$storageAccountName.blob.core.contoso.net" `
                -DefaultStorageAccountKey $storageAccountKey `
                -DefaultStorageContainer $storageContainer

This command adds a script action for the Head and Worker nodes of the your-hadoop-001 cluster, to be run at the end of cluster creation.

Required Parameters

-Config

Specifies the HDInsight cluster configuration object that this cmdlet modifies. This object is created by the New-AzureRmHDInsightClusterConfig cmdlet.

Type:AzureHDInsightConfig
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Name

Specifies the name of the script action.

Type:String
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-NodeType

Specifies the node type on which to run the script action. The acceptable values for this parameter are:

  • HeadNode
  • WorkerNode
  • ZookeeperNode
Type:ClusterNodeType
Parameter Sets:HeadNode, WorkerNode, ZookeeperNode, EdgeNode
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Uri

Specifies the public URI for the script action (a PowerShell or Bash script).

Type:Uri
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-Parameters

Specifies the parameters for the script action.

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