< Back

Add-AzureRmHDInsightScriptAction

Tue Jan 29, 2019 9:47 pm

NAME Add-AzureRmHDInsightScriptAction



SYNOPSIS

Adds a script action to a cluster configuration object.





SYNTAX

Add-AzureRmHDInsightScriptAction [-Config] <AzureHDInsightConfig> [-NodeType] {HeadNode | WorkerNode | ZookeeperNode | EdgeNode} [-Uri] <Uri>

[-Name] <String> [[-Parameters] <String>] [-DefaultProfile <IAzureContextContainer>] [<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.





PARAMETERS

-Config <AzureHDInsightConfig>

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

New-AzureRmHDInsightClusterConfig cmdlet.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

Specifies the name of the script action.



Required? true

Position? 3

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-NodeType <ClusterNodeType>

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



- HeadNode



- WorkerNode



- ZookeeperNode



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Parameters <String>

Specifies the parameters for the script action.



Required? false

Position? 4

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Uri <Uri>

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



Required? true

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

AzureHDInsightConfig

Parameter 'Config' accepts value of type 'AzureHDInsightConfig' from the pipeline





OUTPUTS

Microsoft.Azure.Commands.HDInsight.Models.AzureHDInsightConfig







NOTES









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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... riptaction

New-AzureRmHDInsightClusterConfig