According to MS's docs for New-AzureRmHDInsightCluster,
it should accept -ComponentVersion
as an option:
$httpCredential = New-Object System.Management.Automation.PSCredential ($httpUserName, $clusterpassword)
$sparkConfig = New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]"
$sparkConfig.Add("spark", "2.1")
New-AzureRmHDInsightCluster `
-ClusterName mycluster `
-ComponentVersion $sparkConfig `
-ClusterSizeInNodes 4 `
-HttpCredential $httpCredential `
-Location "Central US" `
-OSType Linux `
-ResourceGroupName tstcluster
However, this command results in:
##[error]A parameter cannot be found that matches parameter name 'ComponentVersion'.
Is there a way to select the Spark version required? We used to use:
Add-AzureRmHDInsightComponentVersion -Config $config -ComponentName "Spark" -ComponentVersion "2.1"
But that's now rejected:
##[error]The term 'Add-AzureRmHDInsightComponentVersion' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
EDIT:
A couple of factors that were key to solving this: First, this script is run by an Azure PowerShell Script
task in an Azure Dev Ops pipeline. Second, the PowerShell version used to run this script was 1.*.