Virtual machines lifecycle and states

Azure Virtual Machines (VMs) go through different states that can be categorized into provisioning and power states. The purpose of this article is to describe these states and specifically highlight when customers are billed for instance usage.

Power states

The power state represents the last known state of the VM.

VM power state diagram


The following table provides a description of each instance state and indicates whether it is billed for instance usage or not.
State Description Instance usage billing

Starting

VM is starting up.

"statuses": [
{
"code": "PowerState/starting",
"level": "Info",
"displayStatus": "VM starting"
}
]

Not billed

Running

Normal working state for a VM

"statuses": [
{
"code": "PowerState/running",
"level": "Info",
"displayStatus": "VM running"
}
]

Billed

Stopping

This is a transitional state. When completed, it will show as **Stopped**.

"statuses": [
{
"code": "PowerState/stopping",
"level": "Info",
"displayStatus": "VM stopping"
}
]

Billed

Stopped

The VM has been shut down from within the guest OS or using the PowerOff APIs.

Hardware is still allocated to the VM and it remains on the host.

"statuses": [
{
"code": "PowerState/stopped",
"level": "Info",
"displayStatus": "VM stopped"
}
]

Billed*

Deallocating

Transitional state. When completed, the VM will show as **Deallocated**.

"statuses": [
{
"code": "PowerState/deallocating",
"level": "Info",
"displayStatus": "VM deallocating"
}
]

Not billed*

Deallocated

The VM has been stopped successfully and removed from the host.

"statuses": [
{
"code": "PowerState/deallocated",
"level": "Info",
"displayStatus": "VM deallocated"
}
]

Not billed

*Some Azure resources, such as Disks and Networking, incur charges. Software licenses on the instance do not incur charges.

Provisioning states

A provisioning state is the status of a user-initiated, control-plane operation on the VM. These states are separate from the power state of a VM.

  • Create – VM creation.

  • Update – updates the model for an existing VM. Some non-model changes to VM such as Start/Restart also fall under update.

  • Delete – VM deletion.

  • Deallocate – is where a VM is stopped and removed from the host. Deallocating a VM is considered an update, so it will display provisioning states related to updating.

Here are the transitional operation states after the platform has accepted a user-initiated action:


States

Description

Creating

"statuses": [
{
"code": "ProvisioningState/creating",
"level": "Info",
"displayStatus": "Creating"
}

Updating

"statuses": [
{
"code": "ProvisioningState/updating",
"level": "Info",
"displayStatus": "Updating"
}
]

Deleting

"statuses": [
{
"code": "ProvisioningState/deleting",
"level": "Info",
"displayStatus": "Deleting"
}
]

OS provisioning states

If a VM is created with an OS image and not with a specialized image, then following substates can be observed:

1. OSProvisioningInprogress – The VM is running, and installation of guest OS is in progress.

"statuses": [
{
"code": "ProvisioningState/creating/OSProvisioningInprogress",
"level": "Info",
"displayStatus": "OS Provisioning In progress"
}
]

2. OSProvisioningComplete – Short-lived state. The VM quickly transitions to **Success** unless any extensions need to be installed. Installing extensions can take time.
"statuses": [
{
"code": "ProvisioningState/creating/OSProvisioningComplete",
"level": "Info",
"displayStatus": "OS Provisioning Complete"
}
]

Note: OS Provisioning can transition to **Failed** if there is an OS failure or the OS doesn't install in time. Customers will be billed for the deployed VM on the infrastructure.

Once the operation is complete, the VM will transition into one of the following states:

  • Succeeded – the user-initiated actions have completed.

    "statuses": [ 
    {
     "code": "ProvisioningState/succeeded",
     "level": "Info",
     "displayStatus": "Provisioning succeeded",
     "time": "time"
    }
    ]
    
  • Failed – represents a failed operation. Refer to the error codes to get more information and possible solutions.

    "statuses": [
    {
      "code": "ProvisioningState/failed/InternalOperationError",
      "level": "Error",
      "displayStatus": "Provisioning failed",
      "message": "Operation abandoned due to internal error. Please try again later.",
      "time": "time"
    }
      ]
    

VM instance view

The instance view API provides VM running-state information. For more information, see the Virtual Machines - Instance View API documentation.

Azure Resources explorer provides a simple UI for viewing the VM running state: Resource Explorer.

Provisioning states are visible on VM properties and instance view. Power states are available in instance view of VM.

Next steps

To learn more about monitoring your VM, see How to monitor virtual machines in Azure.