We use powershell script to start and stop the VMs using the build job. Please see the screenshot of the build job below
It is a simple powershell script to start an VM. The issue is when this job runs, we are getting an error and the build fails. We get Parameter set cannot be resolved using the specified named parameters
But when we run it locally using the powershell console, the VMs get started.
Please find the error screenshot below
Am I missing something here.. Any help would be very much appreciated.
EDIT 1 Powershell script
$machines = @("machinename")
Select-AzureSubscription -Default "XXXYYYZZZ"
Foreach ($machine in $machines)
{
Try
{
Start-AzureVM -ServiceName $machine -Name $machine
}
Catch
{
}
}


I check your screenshot, I find you want to stop classic VMs. However, you logon Azure with cmdlet
Add-AzureRmAccountand select subscription with cmdletselect-azurermsubscription, am I right? The two cmdlets are ARM mode cmdlets, you should use classic mode cmdlets.According to your error, you could not use
Select-AzureSubscription -Default "XXXYYYZZZ".Defaultcould not add parameters. More information please refer to this link.Try to use the following cmdlets.