I'm trying to start an Azure VM using the following PowerShell script:
$subscriptionId = "00000000-0000-0000-0000-000000000000"
$azureVM = "VS2017"
$resourceGroup = "VS2017ResourceGroup"
Add-AzureRmAccount # here start interactive login
Select-AzureSubscription -SubscriptionId $subscriptionId
Start-AzureRmVM - -ResourceGroupName $resourceGroup -Name $azureVM
When executing the script, I receive the following response:
Start-AzureRmVM : A positional parameter cannot be found that accepts argument '-'.
At C:\Users\ralbano\Desktop\Senza nome7.ps1:11 char:1
+ Start-AzureRmVM - -ResourceGroupName "VS2017ResourceGroup" -Name $azu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-AzureRmVM], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Azure.Commands.Compute.StartAzureVMCommand
I am using Windows PowerShell ISE to run the script.
Am I doing something wrong?
I checked the subscription id and the resource group name and are correct (of course in the sample above the subscription id is a fake). The VM is in "Stopped (deallocated)" state on Azure.
Start-AzureRmVM
(docs.microsoft.com/en-us/powershell/module/azurerm.compute/…). I believeStart-AzureVM
is for starting Classic VMs. – Gaurav Mantri