Editar

Partilhar via


Add-AzHDInsightScriptAction

Adds a script action to a cluster configuration object.

Syntax

Add-AzHDInsightScriptAction
   [-Config] <AzureHDInsightConfig>
   [-NodeType] <ClusterNodeType>
   [-Uri] <Uri>
   [-Name] <String>
   [[-Parameters] <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Add-AzHDInsightScriptAction cmdlet adds script actions to the HDInsight configuration object created by the New-AzHDInsightClusterConfig 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

# Primary storage account info
$storageAccountResourceGroupName = "Group"
$storageAccountResourceId = "yourstorageaccountresourceid"
$storageAccountName = "yourstorageacct001"
$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value


$storageContainer = "container001"

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

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

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

# Create the cluster
New-AzHDInsightClusterConfig  `
            | Add-AzHDInsightScriptAction `
                -Name $scriptActionName `
                -Uri $scriptActionURI `
                -Parameters $scriptActionParameters `
                -NodeType Worker `
            | Add-AzHDInsightScriptAction `
                -Name $scriptActionName `
                -Uri $scriptActionURI `
                -Parameters $scriptActionParameters `
                -NodeType Head `
            | New-AzHDInsightCluster `
                -ClusterType Hadoop `
                -OSType Windows `
                -ClusterSizeInNodes 4 `
                -ResourceGroupName $clusterResourceGroupName `
                -ClusterName $clusterName `
                -HttpCredential $clusterCreds `
                -Location $location `
                -StorageAccountResourceId $storageAccountResourceId `
                -StorageAccountKey $storageAccountKey `
                -StorageContainer $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.

Parameters

-Config

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

Type:AzureHDInsightConfig
Position:0
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:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the script action.

Type:String
Position:3
Default value:None
Required:True
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
Accepted values:HeadNode, WorkerNode, ZookeeperNode, EdgeNode
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Parameters

Specifies the parameters for the script action.

Type:String
Position:4
Default value:None
Required:False
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
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

AzureHDInsightConfig

Outputs

AzureHDInsightConfig