DRAG DROP
You have a runbook in Azure that evaluates the virtual machines (VMs) in a tenant and deallocates the VMs if
they are no longer needed. You use the PowerState to determine if a VM is running.
You need to deallocate only those VMs that are running at the time your runbook runs.
How should you complete the relevant Azure PowerShell script? To answer, drag the appropriate Azure
PowerShell cmdlets to the correct locations. Each Azure PowerShell cmdlet may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Select and Place:
Explanation:
Box 1:
Get-AzureRmVM
Box 2:
Get-AzureRmVM
Box 3:
Stop-AzureRmVMhttps://social.msdn.microsoft.com/Forums/sqlserver/en-US/24a74571-a118-4e17-9adc-308cc20b9d93/get-vmpowestate-in-stopstart-vms-runbook-arm-powershell-workflow-runbook?forum=azureautomation
Box 3 should be Remove-AzureRmVM since the question asked to deallocate.
This is wrong and the provided answer is correct. Stop-AzureRmVM will place a VM into the “deallocated” state (meaning it is not using compute/network resources). Stop-AzureRmVM -StayProvisioned will keep it in the provisioned state (same as powering it off from the guest OS).
Remove-AzureRmVM does as it says and removes/deletes the VM object from the subscription.