powershellazureazure-vm-scale-set

Update-AzureRmVmss : Required parameter 'adminPassword' is missing (null)


I am trying to run a PowerShell vmss custom extension script on scale set.

I get this error when it tries to run the Update-AzureRmVmss command Update-AzureRmVmss : Required parameter 'adminPassword' is missing (null). ErrorCode: InvalidParameter ErrorMessage: Required parameter 'adminPassword' is missing (null). StatusCode: 400 ReasonPhrase: Bad Request

$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

Solution

  • I figured out the issue. The -Name needs to be scaleset name. The code I got from online had the name as the name of the script which was wrong.

    Update-AzureRmVmss -ResourceGroupName $resourceGroup -Name "scalsetname" -VirtualMachineScaleSet $vmss