This solution was actually covered on my earlier blog post when using an external USB hard drive, but we had a case in our office recently when an intern reported this similar error when trying to create a VM with the VHD mounted on a internal SSD drive.
The mention of this error with the Hyper-V reporting the service account does not have permission to open the VHD file reminded me about this post. They had reported that when trying to attach the file it reported it was in use even after a reboot.
The difference however was the VHD file was on a SSD drive versus the external USB device which didn't make sense to get this error. Upon further investigation I noticed the VM VHD file was located on the secondary partition of her drive (d:) which made me think there might be another local security policy setting to change.
The error message again was similar to this:
Error applying Hard Drive changes
Failed to add device 'Virtual Hard Disk'
Hyper-V Virtual Machine Management service Account does not have permission to open attachment. Error: 'General access denied error' (0x80070005)
Here are the steps in Windows 8 to fix this issue and allow the use of VHD files from a secondary partition or drive:
- Using Windows 8 Search type "Group Policy" and click "Edit Group Policy" under "Settings" to launch the Local Group Policy Editor found in Administrative tools.
- Under "Computer Configuration" expand, Windows Settings -> Security Settings -> Advanced Audit Policy Configuration -> System Audit Policies -- Local Group and click on the "Object Access" category.
- Double-click "Audit File System" subcategory to open the properties window and click the checkbox for "Configure the following audit events" and leave the Success and Failure checkboxes unchecked. (This will change the audit event to "No Auditing", versus "Not Configured")
- Click OK and then reboot your PC.
You should now be able to create a VM and attach a VHD file located on your secondary partition or drive without receiving the permission error.