我正在尝试在规模集上运行 PowerShell vmss 自定义扩展脚本。
当它尝试运行 Update-AzureRmVmss 命令 Update-AzureRmVmss 时出现此错误:缺少必需的参数“adminPassword”(空)。错误代码:无效参数错误消息:缺少必需的参数“adminPassword”(空)。状态码:400 原因短语:错误请求
$customConfig = @{
"fileUris" = @("https://$storageAccountName.blob.core.windows.net/scripts/script.ps1");
"commandToExecute" = "PowerShell -ExecutionPolicy Unrestricted .\script.ps1";
};
# Add the extension to the config
$vmss = Get-AzureRmVmss -ResourceGroupName $resourceGroup -VMScaleSetName $vmssname
Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Publisher Microsoft.Compute -Type CustomScriptExtension -TypeHandlerVersion 2.0 -Name "runscript" -Setting $customConfig
# Send the new config to Azure
Update-AzureRmVmss -ResourceGroupName $resourceGroup -Name "runscript" -VirtualMachineScaleSet $vmss