Time sync on Azure VM, detach from host to External NTP sources?

Yossi Gurvich 20 Reputation points
2023-09-06T11:12:45.7133333+00:00

Hi, I have two questions:
Is it possible to really detach the VM guest from synchronizing the time with the Azure host?

I have read both the Linux and the windows pages about time sync, and I have experimented with Azure VMs in Azure portal sandbox

in Linux VM, The time synchronization can be "sort of" detached and set to external NTP, or hold its independent time, but every reboot of the VM the time will initially synchronize with the host, and then after a while re-synchronize with the configured NTP.

while on windows VM ( at least win10 VM)
even if I disable the "VMICTimeSync" in the registry, as soon as I change the time it will automatically sync with the host.

-- I have also tried this script:

az vm extension set --name VMAccessAgent --publisher Microsoft.Compute --resource-group 'myResourceGroup' --vm-name 'myVMName' --version 2.4 --settings "{'TimeSync':'false'}"

It fails on Linux VM, it succeeds on Windows VM, but changes nothing in the VMs behavior.

Is there a way for me to toggle off the VM time synchronization between host and guest?

2- Are the Azure NTP sources public? (the NTPs that all the hosts sync with)
Can I have their IP addresses so it will possible for me to poll the NTP sources directly from the VM ? (via standard udp packet for time protocol)

Thank you in advance.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,105 questions
{count} votes

Accepted answer
  1. Luke Murray 10,526 Reputation points MVP
    2023-09-18T06:46:39.7066667+00:00

    There are three options for configuring time sync for your Windows VMs hosted in Azure:

    The Azure hosts themselves, are probably tied to an internal clock, as part of internal switches or firewalls, although the information isn't public, but are set the same across the globe with UTC.

    Note the registry keys and GPO config, even for PCs not in a domain, you can edit the local policy using gpedit.msc as well.

    VMICTimeProvider is the key registry item here.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. robin 75 Reputation points
    2023-09-26T09:30:17.5666667+00:00

    To ensure accurate time synchronization for an Azure Virtual Machine (VM), you can detach it from the host's time synchronization, which is often controlled by the host's Hyper-V integration services, and instead, configure the VM to sync its time with external NTP (Network Time Protocol) sources. This is important for maintaining precise timekeeping within the VM, which can be crucial for various applications, security protocols, and compliance requirements. By syncing with reliable NTP servers, the VM can maintain accurate time even in a cloud environment, helping you ensure the integrity and consistency of your system's time settings.

    0 comments No comments