Add-AzureRmHDInsightScriptAction
Adds a script action to a cluster configuration object.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
Add-AzureRmHDInsightScriptAction
[-Config] <AzureHDInsightConfig>
[-NodeType] <ClusterNodeType>
[-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.
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.
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 |
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: | 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
Parameters: Config (ByValue)