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.
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
Stop-AzureRmVM stops a system but doesn’t de-allocate. Whereas, Remove-AzureRmVM from the applet’s descript does de-allocate, so shouldn’t Remove-AzureRmVM be used?
Stop-AzureRmVm does de-allocate them, it doesn’t de-allocate them only if you use this parameter
[-StayProvisioned]
The cmdlet stops all the virtual machines within the VMSS but does not deallocate them. The account is charged for the stopped virtual machines.
Othewise it works as required according to the question. So i’d say it is correct.