Effective December 3, NetApp adopts Microsoft’s Business-to-Customer (B2C) identity management to simplify and provide secure access to NetApp resources.
For accounts that did not pre-register (prior to Dec 3), access to your NetApp data may take up to 1 hour as your legacy NSS ID is synchronized to the new B2C identity.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

Usage of WFAInputPassword

mszafran

Hi,

 

 

I'm trying to use WFA to call the VSC commandlets in VSC 6.0.   I have a question on how to pass a password.    When I try to grab the password from the input and use it,  i get various errors.  I tried Get-WFAInputPassword but I get the below error.  Can anyone help with a code sample?

 

Thanks

 

Mike

 

 

2015-04-26 12:55:31,880 ERROR [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (http-executor-threads - 59) [VSC_Create_DataStore] Cannot bind argument to parameter 'EncryptedPassword' because it is null.

 

import-module VSC
Get-WFALogger -Info -message ("Username " + $vscUser)
Get-WFALogger -Info -message (" Password: " + $vscPass)
$passwordp = Get-WfaInputPassword -EncryptedPassword $vcsPass
$password = ConvertTo-SecureString -AsPlainText -Force $passwordp

$creds = New-Object System.Management.Automation.PSCredential $vscUser, $password
Connect-VSCserver $vscServer -Credential $creds

$SystemID = Get-VscStorageSystemId -ipAddress $Cluster
Get-WFALogger -Info -message (" System ID of " + $Cluster + " is " + $SystemID)

3 REPLIES 3

sinhaa

Mike,

 

Some points here:

 

  1. You need to declare parameter $vcsPass of type Password in your command. See example in WFA developer's guide on how to use it.

 

2.   $passwordp = Get-WfaInputPassword -EncryptedPassword $vcsPass

 

This itself returns the $password in SecureString format and hence you do not need the line: $password = ConvertTo-SecureString -AsPlainText -Force $passwordp

 

Just use the $passwordp to create your credential object : $creds = New-Object System.Management.Automation.PSCredential $vscUser, $passwordp

 

 

sinhaa

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

mszafran

Sinhaa,

 

Thanks for the reply.  I've been trying different combinations with various error messages.  Using the Get-WfaInputPassword -EncryptedPassword $vcsPass_Password  still produces errors.   The $vscPass is now an encrypted string but not one the PSCredential likes.

 

My parameter:

 


[parameter(Mandatory=$true, HelpMessage="Specify an VSC password.")]
[Alias("vscPass_Password")] [string]$vscPass,

 

import-module VSC
Get-WFALogger -Info -message ("Username " + $vscUser)
Get-WFALogger -Info -message (" Password: " + $vscPass)

$creds = New-Object System.Management.Automation.PSCredential $vscUser, $vscPass
Connect-VSCserver $VSCHost -Credential $creds

 

Log messages:

 

2015-04-27 08:44:10,583 INFO [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (http-executor-threads - 27) [VSC_Create_DataStore] Username mszafran@netappusps.demo
2015-04-27 08:44:10,630 INFO [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (http-executor-threads - 24) [VSC_Create_DataStore] Password: cZlo6RBVImU/8+d3KfGOqg==
2015-04-27 08:44:10,724 ERROR [com.netapp.wfa.command.execution.instance.impl.ExecutionInstanceDaoImpl] (http-executor-threads - 29) [VSC_Create_DataStore] Cannot find an overload for "PSCredential" and the argument count: "2".

 

sinhaa

The correct code should be:

====

 

[parameter(Mandatory=$true, HelpMessage="Specify an VSC password.")]
[Alias("vscPass_Password")] [string]$vscPass,

 

import-module VSC
Get-WFALogger -Info -message ("Username " + $vscUser)
Get-WFALogger -Info -message (" Password: " + $vscPass)

 

#Get the password in Secure String format.

$vcsPass_Sec= Get-WfaInputPassword -EncryptedPassword $vcsPass

$creds = New-Object System.Management.Automation.PSCredential $vscUser, $vscPass_Sec
Connect-VSCserver $VSCHost -Credential $creds

 

====

 

sinhaa

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public