I have shut down a machine in Azure DevTest and I am still being charged.

Admin ITBH 1 20 Reputation points
2024-08-30T18:46:20.49+00:00

In the Azure Portal, I can start and stop the machine from the web interface.

However, if I shut down the machine in the virtual environment or disconnect the session, the portal displays the status Terminated and the Terminate button is still active.

The machine does not really seem to be finished. I continue to be charged until the automatic shutdown.

Is there an error or am I doing something wrong?

I actually want the billing to end when the machine shuts down.

Azure Portal when I shut down the machine

grafik

As you can see, the stop button is still active. When I press it then appears:

grafik

You will now see the status message Stopped (deallocated) and the Stop button is deactivated.

My problem is that students often forget to stop the machine in the Azure portal and only disconnect/close the remote session or simply shut down the virtual machine without stopping in the portal.

What can be done in DevTest Labs?

With Azure Labs Services, all this works proma but that is to be switched off in July 2027.

Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
277 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mounika Reddy Anumandla 590 Reputation points Microsoft Vendor
    2024-09-02T05:21:55.92+00:00

    Hi Admin ITBH,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    When you shut down a VM from within the virtual environment or disconnect the session, it enters a "Stopped" state, but it doesn't deallocate the resources. This is why the Azure Portal still shows the status as "Terminated" and the Terminate button remains active.
    To stop the billing when the machine shuts down, you need to deallocate the resources. You can do this by clicking the "Stop" button in the Azure Portal, and then selecting "Deallocate" in the confirmation dialog. Alternatively, you can use the Azure CLI or PowerShell to deallocate the resources.
    Here's an example using the Azure Powershell:
    Stop-AzVM -ResourceGroupName $rgName -Name $vmName -Force
    https://video2.skills-academy.com/en-us/cli/azure/vm?view=azure-cli-latest#az-vm-deallocate

    The following table provides a description of each instance state and indicates whether that state is billed for instance usage.User's image

    The virtual machine resource - power states and billing:

    The state of the virtual machine impacts whether the virtual machine resource is being billed or not, in relation to the virtual machine resource and its reliance and use of underlying hardware. 

    Running - The virtual machine is powered up and working, and currently being billed for.

    Stopped - The VM has been shut down from within the guest operating system or using PowerOff APIs. The VM will be showing as Stopped. This does not release the lease that the VM has on the underlying hardware, which means the hardware is unavailable for other customers. In this state, the virtual machine is still billed for.

    Deallocated - The VM has released the lease on the underlying hardware and is completely powered off, so the virtual machine resource is not billed. It will appear in the Azure portal as Stopped (Deallocated).

    https://video2.skills-academy.com/en-us/azure/virtual-machines/states-billing?WT.mc_id=modinfra-32183-socuff

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Admin ITBH 1 20 Reputation points
    2024-09-02T16:57:11.9466667+00:00

    Very helpful.

    Thank you.

    It solve my problem and works wonderful. :)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.