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://learn.microsoft.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.
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).