When managing Azure Virtual Machines (VMs), the terms Deallocated and Stopped refer to different VM states, each with distinct implications for billing and resource allocation.



OS-level shutdown

When you trigger a command directly on the OS to shutdown the virtual machine, the virtual machine will stop all processes and shutdown but its compute resources like CPU, memory and also its IP addresses are still allocated to the virtual machine even though the VM isn’t running.

!! Note !!
Therefore you will be continued to be billed for the VM’s compute resources because they are still allocated.


Azure-level shutdown

When you trigger the shutdown of the virtual machine in contrast from Azure, either through the Azure Portal or Azure Cloud Shell (PowerShell or Azure CLI), the virtual machine also stops all processes and shutdown but here its compute resources and dynamic IP addresses will be released and no longer reserved.

Therefore you are not billed for the VM’s compute resources while its deallocated.


Use Case

So when you just temporarily need to stop operations and want to keep the VM resources reserved for quick restarts, trigger the shutdown directly on the OS and when you want to save costs and the VM’s compute resources and dynamic IP addresses doesn’t needs to be reserved, stop the VM via the Azure Portal or Azure Cloud Shell (PowerShell or Azure CLI).


Auto shutdown isn’t the same as when you shut down within the VM with power options.

Auto shutdown stops and deallocates your VMs to stop additional usage charges. For more information, see pricing FAQ for Linux VMs and Windows VMs about VM states.

Source: https://learn.microsoft.com/en-us/azure/cost-management-billing/understand/plan-manage-costs#consider-cost-cutting-features-like-auto-shutdown-for-vms

Private IP Addresses – Allocation method

Azure assigns private IP addresses to resources from the address range of the virtual network subnet where the resource is.

Azure reserves five IP addresses in every subnet, which cannot be assigned to resources. These include the first four addresses and the last address in the subnet range.

For example, in the 10.0.0.0/16 subnet, the reserved addresses are 10.0.0.0-10.0.0.3 and 10.0.255.255. All other IP addresses in the range can only be assigned to one resource at a time.

Azure assigns the next available unassigned or unreserved IP address in the subnet’s address range.

While this is normally the next sequentially available address, there’s no guarantee that the address will be the next one in the range.

For example, if addresses 10.0.0.4-10.0.0.9 are already assigned to other resources, the next IP address assigned is most likely 10.0.0.10.

However, it could be any address between 10.0.0.10 and 10.0.0.254.

If a specific Private IP address is required for a resource, you should use a static private IP address.

With static allocation, you select and assign any unassigned or unreserved IP address in the subnet’s address range.

Static addresses are only released if a network interface is deleted.


We can change the private IP address allocation from Dynamic to Static on the fly.




In Azure, even with a static private IP address assigned to a VM, the process is still handled through a DHCP reservation, not by directly assigning a static IP address within the VM’s operating system. This means the VM’s operating system will still receive its IP address via DHCP, but Azure reserves the specific static IP for that VM

Static private IP addresses don’t change throughout the lifespan of the Azure resource. Static private IP addresses persist if a resource is stopped or deallocated.

Links

Plan to manage Azure costs
https://learn.microsoft.com/en-us/azure/cost-management-billing/understand/plan-manage-costs

Consider cost-cutting features like auto shutdown for VMs
https://learn.microsoft.com/en-us/azure/cost-management-billing/understand/plan-manage-costs#consider-cost-cutting-features-like-auto-shutdown-for-vms

Private IP addresses
https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/private-ip-addresses