gpt4 book ai didi

Azure 的 New-AzureRmHDInsightCluster 命令不接受记录的 ComponentVersion 选项

转载 作者:行者123 更新时间:2023-12-03 04:16:39 24 4
gpt4 key购买 nike

根据 MS 的文档 New-AzureRmHDInsightCluster ,它应该接受 -ComponentVersion 作为选项:

$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

但是,此命令会导致:

##[error]A parameter cannot be found that matches parameter name 'ComponentVersion'.

有没有办法选择所需的 Spark 版本?我们曾经使用:

Add-AzureRmHDInsightComponentVersion -Config $config -ComponentName "Spark" -ComponentVersion "2.1"

但现在已被拒绝:

##[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.

编辑:

有几个对于解决此问题至关重要的因素:首先,此脚本由 Azure Dev Ops 管道中的 Azure PowerShell 脚本 任务运行。其次,用于运行此脚本的 PowerShell 版本是 1.*。

最佳答案

尝试下面的命令,它在我这边工作得很好。确保您已安装AzureRM.HDInsight powershell 模块,您可以使用 Get-Module AzureRM.HDInsight 检查它。

enter image description here

示例命令:

$httpUserName = "joyhd"
$clusterpassword = ConvertTo-SecureString "<password>" -AsPlainText -Force
$httpCredential = New-Object System.Management.Automation.PSCredential($httpUserName, $clusterpassword)
$SshCredential = New-Object System.Management.Automation.PSCredential($httpUserName, $clusterpassword)
$storageAccountName = "<storageAccountName>"
$storageAccountKey = "xxxxxxx"
$storageContainer = "testhd"

New-AzureRmHDInsightClusterConfig `
| Add-AzureRmHDInsightComponentVersion `
-ComponentName "Spark" `
-ComponentVersion "2.1" `
| New-AzureRmHDInsightCluster `
-ClusterName joytesthd `
-ClusterType "Spark" `
-ClusterSizeInNodes 4 `
-HttpCredential $httpCredential `
-Location "eastus" `
-OSType Linux `
-ResourceGroupName joywebapp `
-DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" `
-DefaultStorageAccountKey $storageAccountKey `
-DefaultStorageContainer $storageContainer `
-SshCredential $SshCredential

结果:

enter image description here

关于Azure 的 New-AzureRmHDInsightCluster 命令不接受记录的 ComponentVersion 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52413163/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com