VMware Cloud Community
timkennedy
Contributor
Contributor

Connect-SrmServer fails when -RemoteCredential is used

vCenter version 6.0.0, build 3634794.

srm version: 6.1.0

I have a protected site, and a recovery site.  Running `connect-viserver -alllinked:$true -server protected.domain.com` works just fine, and I can see all the linked servers in $global:DefaultVIServers

PS > $global:DefaultVIServers

Name                           Port  User

----                           ----  ----

recovery.domain.com  443   DOMAIN\timkennedy

protected.domain.com 443   DOMAIN\timkennedy

When I go to connect to the SRM server(s), I can log into each one individually, but I can't authenticate a single session to both servers using the -RemoteCredential option or the -RemoteUser & -RemotePassword options.

First, building a credential known to work at both sides (AD SSO):

PS > $credential = Get-Credential -Message 'Enter Password:' -UserName 'DOMAIN\timkennedy'

Using -RemoteCredential or passing -RemoteUser with -RemotePassword:

PS > Connect-SrmServer -IgnoreCertificateErrors -Server protected.domain.com -RemoteCredential $credential -Credential $credential

Connect-SrmServer : 8/29/2017 12:51:33 PM       Connect-SrmServer               Cannot complete login due to an incorrect user name or password.

At line:1 char:1

+ Connect-SrmServer -IgnoreCertificateErrors -Server protected.domain. ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Connect-SrmServer], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer

And:

PS > Connect-SrmServer -IgnoreCertificateErrors -Server protected.domain.com -RemoteUser 'DOMAIN\timkennedy' -RemotePassword 'supersecretpassword' -User 'DOMAIN\timkennedy' -Password 'supersecretpassword'

Connect-SrmServer : 8/29/2017 12:51:33 PM       Connect-SrmServer               Cannot complete login due to an incorrect user name or password.

At line:1 char:1

+ Connect-SrmServer -IgnoreCertificateErrors -Server protected.domain. ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Connect-SrmServer], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer

And even calling the api directly after logging into a SRM server directly:

PS> $global:DefaultSrmServers[1].ExtensionData.SrmLoginSites('DOMAIN\timkennedy','supersecretpassword','DOMAIN\timkennedy','supersecretpassword')

Exception calling "SrmLoginSites" with "4" argument(s): "Cannot complete login due to an incorrect user name or

password."

At line:1 char:1

+ $global:DefaultSrmServers[1].ExtensionData.SrmLoginSites('DOMAIN\timk ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : VimException

The same behavior is seen, even if I change the target server to be recovery.domain.com.

Without specifying any -Remote options, I can log into both SRM servers successfully using either username and password, or credential, however this prevents being able to do things like configure protection on an array based protection group, because the single session isn't authenticated to both SRM servers.

PS > Connect-SrmServer -Credential $cred -Server protected.domain.com

ServiceUri    : https://192.168.1.101:9086/vcdr/extapi/sdk

SessionSecret : "10334eb7e60c9bb1cb23c4fdce6a8c1c525423af"

User          : DOMAIN\timkennedy

IsConnected   : True

Port          : 9086

Version       : 6.1.0

Build         : 3037005

ProductLine   : srm

InstanceUuid  : 459474ca-50ad-41de-8d3f-a21cdbb0027c

RefCount      : 1

ExtensionData : VMware.VimAutomation.Srm.Views.SrmServiceInstance

Uid           : /SrmServer=domain\timkennedy@192.168.1.101:9086/

Id            : /SrmServer=domain\timkennedy@192.168.1.101:9086/

Name          : 192.168.1.101

IsInUse       : True

PS > Connect-SrmServer -Server recovery.domain.com -Username 'DOMAIN\timkennedy' -Password 'supersecretpassword'

ServiceUri    : https://172.16.1.101:9086/vcdr/extapi/sdk

SessionSecret : "e58247793dcda1e31182388d1856dd2be40457e7"

User          : DOMAIN\timkennedy

IsConnected   : True

Port          : 9086

Version       : 6.1.0

Build         : 3037005

ProductLine   : srm

InstanceUuid  : cf5269b3-237b-4d6a-b6a7-f5632e015c90

RefCount      : 1

ExtensionData : VMware.VimAutomation.Srm.Views.SrmServiceInstance

Uid           : /SrmServer=domain\timkennedy@172.16.1.101:9086/

Id            : /SrmServer=domain\timkennedy@172.16.1.101:9086/

Name          : 172.16.1.101

IsInUse       : True

I this scenario, if I configure a new protection group, via the api at $global:DefaultSrmServers[1].ExtensionData.Protection something like:

$pgroup = $srmapi.Protection.ListProtectionGroups()[-1]

$pspec = New-Object VMware.VimAutomation.Srm.Views.SrmProtectionGroupVmProtectionSpec

$pspec.Vm = (Get-Vm test-vm).ExtensionData.MoRef
$ptask = $pgroup.ProtectVms($pspec)

Here is the error:

PS > $ptask.GetResult().Error

Fault                  LocalizedMessage

-----                  ----------------

VMware.Vim.MethodFault Not authenticated into SRM server 'Recovery'.

I should note, that logging in to the same vcenter server as the same user, and using the GUI to configure protection on the protection group does work.  So I'm not sure what I'm missing.

Tags (2)
13 Replies
parmarr
VMware Employee
VMware Employee

Hi,

So, vCenter 6.0 U2 and SRM 6.1 should be fine, no reason that should not work afaik. Looks like a bug or an interop issue. Have you raised this with VMware Support?

What version of PowerCLI are you running with those?

Sincerely, Rahul Parmar VMware Support Moderator
0 Kudos
timkennedy
Contributor
Contributor

I have raised an SR with VMware Support.  They have been pretty responsive, so hopefully we find something concrete. 

I have been using PowerCLI 6.5.1.  I will be updating a test node to 6.5.2 today.   It would be nice if it were a simple issue with PowerCLI. Smiley Happy

0 Kudos
jkav
Contributor
Contributor

I was having great success with PowerCLI and SRM API via connect-srmserver. Recently the connect-srmserver began failing. I initially thought it might be the latest version of PowerCLI but I removed all PowerCLI and installed a lesser version but the issue was still not resolved.

Current Version of PowerCLI

11.1.0.11289667      VMware.PowerCLI                     PSGallery            This Windows PowerShell module contains VMware.PowerCLI

# Connect-SrmServer -Credential $admcreds -RemoteCredential $admcreds
Connect-SrmServer : 1/4/2019 2:13:47 PM Connect-SrmServer               Unable to connect to the remote server
At line:1 char:1
+ Connect-SrmServer -Credential $admcreds -RemoteCredential $admcreds
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-SrmServer], VimException
    + FullyQualifiedErrorId : ConnectServer_UnhandledException,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer

Connect-SrmServer : 1/4/2019 2:13:51 PM Connect-SrmServer               Unable to connect to the remote server
At line:1 char:1
+ Connect-SrmServer -Credential $admcreds -RemoteCredential $admcreds
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-SrmServer], VimException
    + FullyQualifiedErrorId : ConnectServer_UnhandledException,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer

I will continue to explore other possible changes but considering this time of the year there is little chance vSphere was updated.

Thanks

0 Kudos
Baoth
Enthusiast
Enthusiast

Hi jkav

Did you get any further with this by chance please? I am having the exact same issue in my environment:

PS C:\WINDOWS\system32> Connect-SrmServer

Connect-SrmServer : 15/01/2019 08:28:22 Connect-SrmServer               Unable to connect to the remote server

At line:1 char:1

+ Connect-SrmServer

+ ~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Connect-SrmServer], VimException

    + FullyQualifiedErrorId : ConnectServer_UnhandledException,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer

VERBOSE: 15/01/2019 08:38:49 Connect-SrmServer Finished execution

I've got another thread initially about a different issue, but as a result of using the latest version of PowerCLI and investigating the new error, I came across your thread. I've tried a slightly older PowerCLI version, updating to the latest and performing a fresh install in a different client.

Cheers

0 Kudos
jkav
Contributor
Contributor

I have not made any progress with this. I am having the client open a ticket with VMware so we will see. Initially I thought it might have been an issue a PowerCLI update but I rolled back several versions and still no joy. This had been working and SRM is working so I am perplexed at this point. I may post this in the VMWare Code Slack Group and see if more eyeballs will help Smiley Happy

0 Kudos
Remcodils
Contributor
Contributor

I just received a new laptop at work and have the same issue. "unable to connect" when trying to perform the connect-srmserver command.

I can reach the link https://hostname:port without any issue. So network technical it seems to be ok. From my old laptop it's works fine to make a connection via Powershell/powercli using hte connect-srmserver command.

0 Kudos
Baoth
Enthusiast
Enthusiast

Remcodils​ After you try running connect-srmserver, input these commands:

$exception = $error[0].Exception

$exception | select *

You'll get a a better idea from the output of what the problem is.

0 Kudos
jkav
Contributor
Contributor

Okay here is the fix, at least in my case. PowerCLI 11 breaks it. Without rolling back all of the PowerCLI 11 goodness, you can just roll back the SRM module. I used save-module vmware.vimautomation.srm -MaximumVersion 10.0.0.7893900 -Path c:\etc\modules to get a few versions... then I take the 10.0.0.7893900 folder from the downloaded versions, and copy that to the version in your Module Path (i.e. c:\program files\windowspowershell\modules\VMware.vimautomation.srm) and remove the 11* folder...  connect-srmserver connectivity restored.

My module version list looks like:

Version              Name                                Repository           Description                                                                                                                                                       

-------              ----                                ----------           -----------                                                                                                                                                       

6.7.0.11233116       VMware.DeployAutomation             PSGallery            This Windows PowerShell module contains PowerCLI Auto Deploy cmdlets.                                                                                             

6.7.0.11233116       VMware.ImageBuilder                 PSGallery            This Windows PowerShell module contains PowerCLI ImageBuilder cmdlets.                                                                                            

11.1.0.11289667      VMware.PowerCLI                     PSGallery            This Windows PowerShell module contains VMware.PowerCLI                                                                                                           

6.7.0.10334489       VMware.Vim                          PSGallery            This Windows PowerShell module contains PowerCLI Vim.                                                                                                             

11.0.0.10335701      VMware.VimAutomation.Cis.Core       PSGallery            This Windows PowerShell module contains PowerCLI Cloud Infrastructure Suite cmdlets.                                                                              

11.0.0.10379994      VMware.VimAutomation.Cloud          PSGallery            This Windows PowerShell module contains PowerCLI Cloud cmdlets.                                                                                                   

11.0.0.10334497      VMware.VimAutomation.Common         PSGallery            This Windows PowerShell module contains functionality required by multiple PowerCLI modules.                                                                      

11.0.0.10336080      VMware.VimAutomation.Core           PSGallery            This Windows PowerShell module contains Windows PowerShell cmdlets for managing vSphere.                                                                          

7.6.0.10230451       VMware.VimAutomation.HorizonView    PSGallery            This Windows PowerShell module contains Connect/Disconnect cmdlets for View API service.                                                                          

10.0.0.7893904       VMware.VimAutomation.License        PSGallery            This Windows PowerShell module contains PowerCLI cmdlets for managing VMware product licenses.                                                                    

11.0.0.10364044      VMware.VimAutomation.Nsxt           PSGallery            This Windows PowerShell module contains PowerCLI NSXT cmdlets.                                                                                                    

11.0.0.10334495      VMware.VimAutomation.Sdk            PSGallery            This Windows PowerShell module contains PowerCLI Sdk.                                                                                                             

11.0.0.10380515      VMware.VimAutomation.Security       PSGallery            This Windows PowerShell module contains PowerCLI security management cmdlets.                                                                                     

10.0.0.7893900       VMware.VimAutomation.Srm            PSGallery            This Windows PowerShell module contains PowerCLI SRM cmdlets.                                                                                                     

11.1.0.11273342      VMware.VimAutomation.Storage        PSGallery            This Windows PowerShell module contains PowerCLI storage management cmdlets.                                                                                      

1.3.0.0              VMware.VimAutomation.StorageUtility PSGallery            This Windows PowerShell module contains utility scripts for storage.                                                                                              

11.0.0.10336077      VMware.VimAutomation.Vds            PSGallery            This Windows PowerShell module contains PowerCLI VDS cmdlets.                                                                                                     

11.0.0.10336076      VMware.VimAutomation.Vmc            PSGallery            This Windows PowerShell module contains PowerCLI VMC cmdlets.                                                                                                     

10.0.0.7893921       VMware.VimAutomation.vROps          PSGallery            This Windows PowerShell module contains PowerCLI vROps cmdlets.                                                                                                   

6.5.1.7862888        VMware.VumAutomation                PSGallery            This Windows PowerShell module contains PowerCLI VUM cmdlets.           

jkav
Contributor
Contributor

Yeah that can help but in this case the error is very generic and just an unhandled exception. This issue has been acknowledged by VMware and a PR should be in the works.

0 Kudos
Remcodils
Contributor
Contributor

Thanks a lot jkav, that was indeed the only solution I was planning on trying today. As on my old laptop it's version 10.0.0.7893900 and on my new laptop it's version 11.1.0.11289292. I removed that new version and copied the 10.x version, relaunched powershell and everything is ok.

So it's clearly a bug in that 11.x version, hope they fix it because with the next update I'll do my 10.x version will be overwritten.

0 Kudos
Baoth
Enthusiast
Enthusiast

This worked for me too - thanks!

I just changed the SRM folder rather than everything, and it worked a treat.

0 Kudos
SkNoor
Contributor
Contributor

i tried the same steps. but i am getting version mismatch error.

'VMware.VimAutomation.Srm.Views.Utils.VimClientDelayedResolveProxy' from assembly 'VMware.VimAutomation.Srm.Views, Version=10.0.0.1041, Culture=neutral,

PublicKeyToken=null' does not have an implementation.

Installed Modules:

Version         Name                                Repository

-------         ----                                ----------

6.7.0.11233116  VMware.DeployAutomation             PSRepository

6.7.0.11233116  VMware.ImageBuilder                 PSRepository

11.3.0.13990089 VMware.PowerCLI                     PSRepository

6.7.0.13964812  VMware.Vim                          PSRepository

11.3.0.13964830 VMware.VimAutomation.Cis.Core       PSRepository

11.0.0.10379994 VMware.VimAutomation.Cloud          PSRepository

11.3.0.13964816 VMware.VimAutomation.Common         PSRepository

11.3.0.13964826 VMware.VimAutomation.Core           PSRepository

11.3.0.13976786 VMware.VimAutomation.Hcx            PSRepository

7.6.0.13827661  VMware.VimAutomation.HorizonView    PSRepository

11.3.0.13990093 VMware.VimAutomation.License        PSRepository

11.3.0.13964817 VMware.VimAutomation.Nsxt           PSRepository

11.3.0.13964823 VMware.VimAutomation.Sdk            PSRepository

11.0.0.10380515 VMware.VimAutomation.Security       PSRepository

10.0.0.7893900  VMware.VimAutomation.Srm            PSRepository

11.3.0.13976676 VMware.VimAutomation.Storage        PSRepository

1.3.0.0         VMware.VimAutomation.StorageUtility PSRepository

11.2.0.12483615 VMware.VimAutomation.Vds            PSRepository

11.3.0.13964814 VMware.VimAutomation.Vmc            PSRepository

10.0.0.7893921  VMware.VimAutomation.vROps          PSRepository

6.5.1.7862888   VMware.VumAutomation                PSRepository

PS C:\Users\Administrator> Connect-SrmServer -server DLDVxxxx.xxx.xxx.com -username Administrator@vsphere.local -password xxxxx# -RemoteUser Administrator@vsphere.local -RemotePassword xxxxxx#

Connect-SrmServer : 6/20/2019 3:40:03 AM        Connect-SrmServer               Method 'LoginByBearerToken' in type

'VMware.VimAutomation.Srm.Views.Utils.VimClientDelayedResolveProxy' from assembly 'VMware.VimAutomation.Srm.Views, Version=10.0.0.1041, Culture=neutral,

PublicKeyToken=null' does not have an implementation.

At line:1 char:1

+ Connect-SrmServer -server DLDVxxxx.xxx.xxx.com -username Administrato ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Connect-SrmServer], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer

did you changed anything else. please tell me if i am missing something here.

0 Kudos
JPM00
Contributor
Contributor

I recently upgraded to PowerCLI 11.3 and started running into the same issues with "Unable to connect to the remote server".  I thought it was related to 11.3 in particular, but when I went to the Module folder for SRM, I had two folders, one for a Version 10.x and one for 11.2

Get-Module VMware.VimAutomation.Srm -ListAvailable | Select ModuleBase

I went to the entire Module folder and deleted all of the VMware folders and installed the 11.0 version as a test
Install-Module -Name VMware.PowerCLI -RequiredVersion 11.0.0.10380590
With this I was able to connect to both SRM sites without error. I then upgraded through each release version and it continued working.  I think ultimately there was a conflict with the two folders in the VMware.VimAutomation.Srm module folder and manually deleting all of the VMware modules and installing only the latest resolved the issue for me on two different computers.
0 Kudos