Bug 1772622

Summary: Unable to start containers privilege validation fails with "Hyper-v commands have to be run as an Administrator"
Product: OpenShift Container Platform Reporter: Michael M <mmikhailidi>
Component: crcAssignee: Praveen Kumar <prkumar>
Status: CLOSED EOL QA Contact: Tomáš Sedmík <tsedmik>
Severity: high Docs Contact: Kevin Owen <kowen>
Priority: unspecified    
Version: 4.2.zCC: cfergeau, gbraad, kowen, tsedmik, veillard
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-15 09:03:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michael M 2019-11-14 18:53:50 UTC
Description of problem:
Whenever I run command it fails with the message "Hyper-v commands have to be run as an Administrator"

Version-Release number of selected component (if applicable):

Additional info:
I have corporate AD account, and all local admin privileges on my laptop.

The debug output shows that PowerShell fails to validate Hyper-V admin role assignment 

The relevant debug output is 

*********************************************************************************************************************************************************************************************************

INFO Loading bundle: crc_hyperv_4.2.2.crcbundle ...
INFO Creating CodeReady Containers VM for OpenShift 4.2.2...
Found binary path at crc.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:53496
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(crc) Calling .GetMachineName
(crc) Calling .DriverName
Running pre-create checks...
(crc) Calling .PreCreateCheck
(crc) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Module -ListAvailable hyper-v).Name | Get-Unique
(crc) DBG | [stdout =====>] : Hyper-V
(crc) DBG |
(crc) DBG | [stderr =====>] :
(crc) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("S-1-5-32-578")
(crc) DBG | [stdout =====>] :
(crc) DBG | [stderr =====>] : Exception calling "IsInRole" with "1" argument(s): "The trust relationship between the primary domain and the trusted domain failed.
(crc) DBG | "
(crc) DBG | At line:1 char:1
(crc) DBG | + @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIde ...
(crc) DBG | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(crc) DBG |     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
(crc) DBG |     + FullyQualifiedErrorId : SystemException
(crc) DBG |
(crc) DBG |
(crc) DBG | exit status 1
(crc) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
(crc) DBG | [stdout =====>] : False
(crc) DBG |
(crc) DBG | [stderr =====>] :
ERRO Error creating host: Error creating the VM: Error with pre-create check: "Hyper-v commands have to be run as an Administrator"
Making call to close driver server
(crc) Calling .Close
(crc) DBG | Closing plugin on server side
Successfully made call to close driver server
Making call to close connection to plugin binary

C:\mywork\crc-windows-1.1.0-amd64
λ

Comment 1 Michael M 2019-11-14 18:56:32 UTC
Similar issue and some solution propoesed in this issue tracker https://github.com/hashicorp/packer/issues/5216

Comment 2 Michael M 2019-11-14 18:56:54 UTC
(In reply to Michael M from comment #1)
> Similar issue and some solution proposed in this issue tracker
> https://github.com/hashicorp/packer/issues/5216

Comment 3 Praveen Kumar 2019-11-15 03:53:50 UTC
Thanks for bug report, there is already a discussion going on to resolve it https://github.com/code-ready/crc/issues/771

Comment 4 Praveen Kumar 2021-02-15 09:03:01 UTC
Closing this one, since it is fixed some time back.