1. A method for restoring compliance of a virtual machine found to be non-compliant to a compliance rule, the method comprising detecting non-compliance of the virtual machine with the compliance rule using a compliance agent deployed on the virtual machine; detaching the virtual machine from a network; creating a copy of a compliance repository volume on a requested disk resource for the virtual machine, wherein the compliance repository volume has stored thereon a version of the virtual machine which adheres to the compliance rule; responsive to detecting the non-compliance of the virtual machine, mounting the requested disk resource, having stored thereon the copy of the compliance repository volume, to the virtual machine; responsive to mounting the requested disk resource, applying a remediation action to the virtual machine using content of the copy of the compliance repository volume to restore compliance of the virtual machine; and responsive to applying the remediation action to the virtual machine, triggering, by the compliance agent, a compliance scan to ensure that the virtual machine complies with the compliance rule, wherein the creation of the copy of the compliance repository volume is performed by a storage system controlled by a hypervisor and is triggered by the compliance agent via the hypervisor.