Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BCContainerHelper Always requires WinRM running, even as admin. #3518

Closed
rdebath opened this issue Apr 28, 2024 · 10 comments · Fixed by #3520
Closed

BCContainerHelper Always requires WinRM running, even as admin. #3518

rdebath opened this issue Apr 28, 2024 · 10 comments · Fixed by #3520

Comments

@rdebath
Copy link

rdebath commented Apr 28, 2024

Describe the issue
Running as any of ".\Administrator", "NT AUTHORITY\System" or elevated first user.
If I have a client "SKU" and have not run winrm quickconfig -force I get an error about "WSManFault" from New-BCContainer.
(Remote Mgt is not enabled by default by Windows)

Scripts used to create container and cause the issue

Write-Host "### Running New-BCContainer"
New-BCContainer `
    -containerName $containerName `
    -imagename $navimage `
    -accept_eula `
    -auth NavUserPassword `
    -isolation $isolation `
    -memoryLimit 8G `
    -Credential $credential `
    -shortcuts None `
    -EnableTaskScheduler:$false `
    -doNotCheckHealth

Full output of scripts

BcContainerHelper version 6.0.16
Setting MicrosoftTelemetryConnectionString = 
Running on Windows, PowerShell 5.1.19041.4291
WARNING: Container name should not exceed 15 characters
BcContainerHelper is version 6.0.16
BcContainerHelper is running as administrator
HyperV is Disabled
UsePsSession is True
UsePwshForBc24 is True
Host is Microsoft Windows 10 Enterprise - 10.0.19045.4291
Docker Client Version is 24.0.6
Docker Server Version is 24.0.6
<f:WSManFault Code="2150858770" Machine="Blade01" xmlns:f="[http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">](http://schemas.microsoft.com/wbem/wsman/1/wsmanfault%22%3E)
    <f:Message>The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". </f:Message>
</f:WSManFault>

Error number:  -2144108526 0x80338012
The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". 
Removing Desktop shortcuts
Fetching all docker images
Fetching all docker volumes
...

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

  • does it happen all the time? -- Yes with version 6.0.16
  • did it use to work? -- Yes with 6.0.15 and earlier
@freddydk
Copy link
Contributor

It would help if you share the full log
I cannot see what artifacts are you using f.ex.

The winrm quickconfig is for the service (the container) - should not be needed on the client.
But... - then running PS5 in admin mode - it should use a container connection (not a winrm connection) - and it definitely works on my machine - not sure why it doesn't on your.

@freddydk
Copy link
Contributor

Ahhhh - it is during removal of an old container - right?

@freddydk
Copy link
Contributor

Does it actually fail - or is it just displaying an error and then continuing?

@rdebath
Copy link
Author

rdebath commented Apr 29, 2024

Yes, at or just before removing a container during the startup of every attempt to create a container with any artifact on those agents.
It displays an error and continues which causes the pipeline to fail.
I imagine you have a group policy to turn on the winrm on your PC (That would be pretty common) and it seems it is turned on by default for server "SKUs".

2024-04-27T01:22:39.0896870Z ### Running New-BCContainer
2024-04-27T01:22:39.2037194Z BcContainerHelper version 6.0.16
2024-04-27T01:22:39.4410689Z Setting MicrosoftTelemetryConnectionString = 
2024-04-27T01:22:39.5600845Z Running on Windows, PowerShell 5.1.19041.4291
2024-04-27T01:22:41.7884818Z WARNING: Container name should not exceed 15 characters
2024-04-27T01:22:42.0080744Z BcContainerHelper is version 6.0.16
2024-04-27T01:22:42.0091264Z BcContainerHelper is running as administrator
2024-04-27T01:22:42.3009033Z HyperV is Disabled
2024-04-27T01:22:42.3028210Z UsePsSession is True
2024-04-27T01:22:42.3050360Z UsePwshForBc24 is True
2024-04-27T01:22:42.3071176Z Host is Microsoft Windows 10 Enterprise - 10.0.19045.4291
2024-04-27T01:22:42.3517923Z Docker Client Version is 24.0.6
2024-04-27T01:22:42.3538286Z Docker Server Version is 24.0.6
2024-04-27T01:22:46.6871540Z ##[error]<f:WSManFault Code="2150858770" Machine="Blade02" xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">
    <f:Message>The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". </f:Message>
</f:WSManFault>

Error number:  -2144108526 0x80338012
The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".
2024-04-27T01:22:46.6883478Z Removing Desktop shortcuts
2024-04-27T01:22:46.6910284Z Fetching all docker images
2024-04-27T01:22:46.7334109Z Fetching all docker volumes
2024-04-27T01:22:46.7814797Z Using image navimage:nextmajor-gb.6
2024-04-27T01:22:46.8338076Z Disabling Health Check (always report healthy)
2024-04-27T01:22:46.8496942Z Creating Container Build-S36B27595A130
2024-04-27T01:22:46.8592403Z Style: sandbox
2024-04-27T01:22:46.8599087Z Multitenant: No
2024-04-27T01:22:46.8612223Z Version: 25.0.18915.0
2024-04-27T01:22:46.8678739Z Platform: 25.0.18882.0
2024-04-27T01:22:46.8697743Z Generic Tag: 1.0.2.17
2024-04-27T01:22:46.8724008Z Container OS Version: 10.0.19041.1415 (2004)
2024-04-27T01:22:46.8733618Z Host OS Version: 10.0.19045.4291 (22H2)
2024-04-27T01:22:46.8820994Z Using process isolation
2024-04-27T01:22:46.8883368Z Using locale en-GB
2024-04-27T01:22:46.8928900Z Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
2024-04-27T01:22:46.9399727Z Additional Parameters:
2024-04-27T01:22:46.9408233Z --volume "C:\Agent:C:\agents"
2024-04-27T01:22:46.9415884Z --expose 5986
2024-04-27T01:22:46.9422737Z --env customNavSettings=EnableTaskScheduler=False
2024-04-27T01:22:46.9428343Z Files in C:\ProgramData\BcContainerHelper\Extensions\Build-S36B27595A130\my:
2024-04-27T01:22:46.9484342Z - AdditionalOutput.ps1
2024-04-27T01:22:46.9495613Z - AdditionalSetup.ps1
2024-04-27T01:22:46.9502719Z - HelperFunctions.ps1
2024-04-27T01:22:46.9509045Z - MainLoop.ps1
2024-04-27T01:22:46.9514847Z - SetupVariables.ps1
2024-04-27T01:22:46.9522345Z - updatecontainerhosts.ps1
2024-04-27T01:22:46.9528183Z Creating container Build-S36B27595A130 from image navimage:nextmajor-gb.6
2024-04-27T01:22:47.2480939Z 7a148c11bb3f11c10684b406a5ab9ce96ea3fe4364503829776c8f2849816751
2024-04-27T01:22:48.5026783Z Waiting for container Build-S36B27595A130 to be ready
2024-04-27T01:22:50.6488818Z Adding BUILD-S36B27595 to hosts file
2024-04-27T01:22:51.7048277Z Initializing...
2024-04-27T01:22:51.7053779Z Setting host.containerhelper.internal to 172.26.16.1 in container hosts file
2024-04-27T01:22:51.7058729Z Starting Container
2024-04-27T01:22:51.7064015Z Hostname is Build-S36B27595A130
2024-04-27T01:22:51.7068893Z PublicDnsName is Build-S36B27595A130
2024-04-27T01:22:51.7073668Z Using NavUserPassword Authentication
2024-04-27T01:22:53.8206769Z Starting Local SQL Server
2024-04-27T01:22:58.0365906Z Starting Internet Information Server
2024-04-27T01:22:59.0828081Z Creating Self Signed Certificate
2024-04-27T01:22:59.0838865Z Self Signed Certificate Thumbprint DD0A3EEEF6CB62C6379F4ADF8C3A7E8258B1B1C3
2024-04-27T01:22:59.0853247Z DNS identity Build-S36B27595A130
2024-04-27T01:22:59.0862139Z Modifying Service Tier Config File with Instance Specific Settings
2024-04-27T01:22:59.0869760Z Modifying Service Tier Config File with settings from environment variable
2024-04-27T01:22:59.0877766Z Setting EnableTaskScheduler to False
2024-04-27T01:23:08.6728221Z Starting Service Tier
2024-04-27T01:23:08.6739051Z Registering event sources
2024-04-27T01:23:08.6749154Z Creating DotNetCore Web Server Instance
2024-04-27T01:23:08.6763536Z Using application pool name: BC
2024-04-27T01:23:08.6771399Z Using default container name: NavWebApplicationContainer
2024-04-27T01:23:11.8821108Z Copy files to WWW root C:\inetpub\wwwroot\BC
2024-04-27T01:23:11.8828213Z Create the application pool BC
2024-04-27T01:23:13.9967982Z Create website: NavWebApplicationContainer without SSL
2024-04-27T01:23:13.9976560Z Update configuration: navsettings.json
2024-04-27T01:23:13.9983765Z Done Configuring Web Client
2024-04-27T01:23:13.9990647Z Enabling Financials User Experience
2024-04-27T01:23:15.0703049Z Dismounting Tenant
2024-04-27T01:23:15.0713508Z Mounting Tenant
2024-04-27T01:23:29.9733575Z Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
2024-04-27T01:23:33.1275246Z Sync'ing Tenant
2024-04-27T01:23:33.1290581Z Tenant is Operational
2024-04-27T01:23:33.1299174Z Creating http download site
2024-04-27T01:23:33.1304681Z Setting SA Password and enabling SA
2024-04-27T01:23:36.2944373Z Creating TVision as SQL User and add to sysadmin
2024-04-27T01:23:38.3979890Z Creating SUPER user
2024-04-27T01:23:42.6171608Z Enable PSRemoting and setup user for winrm
2024-04-27T01:23:42.6179231Z WARNING: Waiting for service 'Windows Remote Management (WS-Management) 
2024-04-27T01:23:44.7199574Z (winrm)' to stop...
2024-04-27T01:23:44.7206549Z WARNING: Waiting for service 'Windows Remote Management (WS-Management) 
2024-04-27T01:24:05.9330546Z (winrm)' to stop...
2024-04-27T01:24:05.9337017Z Creating self-signed certificate for winrm
2024-04-27T01:24:05.9344945Z Container IP Address: 172.26.20.185
2024-04-27T01:24:05.9353751Z Container Hostname  : Build-S36B27595A130
2024-04-27T01:24:05.9361601Z Container Dns Name  : Build-S36B27595A130
2024-04-27T01:24:05.9369073Z Web Client          : http://Build-S36B27595A130/BC/?tenant=default
2024-04-27T01:24:05.9381131Z Dev. Server         : http://Build-S36B27595A130
2024-04-27T01:24:05.9386922Z Dev. ServerInstance : BC
2024-04-27T01:24:06.9794543Z Dev. Server Tenant  : default
2024-04-27T01:24:06.9801935Z Setting Build-S36B27595A130-default to 127.0.0.1 in container hosts file
2024-04-27T01:24:06.9805264Z 
2024-04-27T01:24:08.0225652Z Files:
2024-04-27T01:24:08.0235923Z http://Build-S36B27595A130:8080/ALLanguage.vsix
2024-04-27T01:24:08.0238998Z 
2024-04-27T01:24:08.0246569Z Container Total Physical Memory is 7.9Gb
2024-04-27T01:24:08.0251997Z Container Free Physical Memory is 2.3Gb
2024-04-27T01:24:08.0255680Z 
2024-04-27T01:24:08.0261213Z Initialization took 77 seconds
2024-04-27T01:24:08.0266811Z Ready for connections!
2024-04-27T01:24:09.8476359Z Reading CustomSettings.config from Build-S36B27595A130
2024-04-27T01:24:10.3551300Z Cleanup old dotnet core assemblies
2024-04-27T01:24:10.3574714Z Container Build-S36B27595A130 successfully created
2024-04-27T01:24:10.3578758Z 
2024-04-27T01:24:10.3586579Z Use:
2024-04-27T01:24:10.3602255Z Get-BcContainerEventLog -containerName Build-S36B27595A130 to retrieve a snapshot of the event log from the container
2024-04-27T01:24:10.3618275Z Get-BcContainerDebugInfo -containerName Build-S36B27595A130 to get debug information about the container
2024-04-27T01:24:10.3638846Z Enter-BcContainer -containerName Build-S36B27595A130 to open a PowerShell prompt inside the container
2024-04-27T01:24:10.3653666Z Remove-BcContainer -containerName Build-S36B27595A130 to remove the container again
2024-04-27T01:24:10.3663009Z docker logs Build-S36B27595A130 to retrieve information about URL's again

@freddydk
Copy link
Contributor

freddydk commented Apr 29, 2024

@rdebath what does this command return on your computer:

winrm get winrm/config/client -format:pretty

Just need to make sure i fix the right thing

@freddydk
Copy link
Contributor

freddydk commented Apr 29, 2024

I would have expected more info between these lines:

2024-04-27T01:22:42.3517923Z Docker Client Version is 24.0.6
2024-04-27T01:22:42.3538286Z Docker Server Version is 24.0.6

and

2024-04-27T01:22:46.6871540Z ##[error]<f:WSManFault Code="2150858770" Machine="Blade02" xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">

I have a hard time seeing where it should try to connect to the container.

@freddydk
Copy link
Contributor

Got it now - the command checking to get the winrm client config is exactly what is giving your error.
Will provide a fix asap.

@rdebath
Copy link
Author

rdebath commented Apr 29, 2024

Okay.

Indeed the container isn't being created at that point and there isn't an old container to delete.

The service isn't running so you get this ...

PS C:\> winrm get winrm/config/client -format:pretty
<f:WSManFault Code="2150858770" Machine="Blade02" xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault">
    <f:Message>The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". </f:Message>
</f:WSManFault>

Error number:  -2144108526 0x80338012
The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".
PS C:\>

After enabling it I get this, ie defaults.

<cfg:Client xml:lang="en-GB" xmlns:cfg="http://schemas.microsoft.com/wbem/wsman/1/config/client">
    <cfg:NetworkDelayms>5000</cfg:NetworkDelayms>
    <cfg:URLPrefix>wsman</cfg:URLPrefix>
    <cfg:AllowUnencrypted>false</cfg:AllowUnencrypted>
    <cfg:Auth>
        <cfg:Basic>true</cfg:Basic>
        <cfg:Digest>true</cfg:Digest>
        <cfg:Kerberos>true</cfg:Kerberos>
        <cfg:Negotiate>true</cfg:Negotiate>
        <cfg:Certificate>true</cfg:Certificate>
        <cfg:CredSSP>false</cfg:CredSSP>
    </cfg:Auth>
    <cfg:DefaultPorts>
        <cfg:HTTP>5985</cfg:HTTP>
        <cfg:HTTPS>5986</cfg:HTTPS>
    </cfg:DefaultPorts>
    <cfg:TrustedHosts></cfg:TrustedHosts>
</cfg:Client>

freddydk added a commit that referenced this issue Apr 29, 2024
Fixes #3518
Fixes #3519

---------

Co-authored-by: freddydk <freddydk@users.noreply.github.com>
@BW-PA
Copy link

BW-PA commented Apr 29, 2024

Just posting to confirm I had this issue too on a Win 11 laptop I am using as a Build Agent and it has been resolved when using BcContainerHelper version 6.0.17-preview1193

@freddydk
Copy link
Contributor

Thanks - will ship 6.0.17 when #3522 is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants