Disabling "sleep" mode in a virtual machine in Azure

Estefany Claudet Benitez Flores 0 Reputation points
2023-04-03T20:27:25.0833333+00:00

We require that the virtual machine does not enter "sleep" mode, so that the running activities do not stop; the virtual machine always enters sleep mode when closing the remote connection, so the execution of the running activities is lost. We already made the configuration settings in Windows, but we did not identify if this is a feature that needs to be adjusted directly in the Microsoft Azure portal.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,033 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,453 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Syed Shiraz Shahid 290 Reputation points
    2023-04-03T21:49:48.1766667+00:00

    you can disable this feature by following these steps: nullnullnull

    jsonCopy code
    "disallow_sleep": true
    

    This code will prevent the virtual machine from going into sleep mode. null

    Alternatively, you can use Azure PowerShell or Azure CLI to modify the virtual machine's settings. Here's an example of how to use Azure PowerShell: nullnull

    
    $vm = Get-AzVM -ResourceGroupName <resource_group_name> -Name <vm_name>
    

    null

    
    Set-AzVM -VM $vm -DisallowSleep $true
    

    null

    
    Update-AzVM -ResourceGroupName <resource_group_name> -VM $vm
    

    With these steps, you should be able to disable sleep mode for your Azure virtual machine.


  2. msrini-MSFT 9,291 Reputation points Microsoft Employee
    2023-04-13T10:32:57.7566667+00:00

    Hi, You can try the below steps:

    1. Adjust the Windows power settings: In the virtual machine, go to Control Panel > Power Options and adjust the power plan to ensure that the computer does not enter sleep mode. You can select the "High performance" power plan, or create a custom power plan with sleep mode disabled.
    2. Adjust the Azure portal settings: In the Azure portal, navigate to your virtual machine, and under the Settings section, select the "Auto-shutdown" option. Make sure that the "Enabled" toggle is set to "No", and that the "Time zone" and "Time" settings are also correct.
    3. Check the Remote Desktop settings: In the Remote Desktop settings for the virtual machine, ensure that the "End a disconnected session" setting is set to "Never". This will ensure that the virtual machine does not enter sleep mode when the remote connection is closed.
    4. Consider using the Azure Bastion service: If you're still experiencing issues with the virtual machine entering sleep mode, you may want to consider using the Azure Bastion service to connect to the virtual machine. This service provides a secure and reliable way to connect to your virtual machines without the need for a public IP address, and can help to prevent issues with the virtual machine entering sleep mode. Regards, Karthik Srinivas
    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.