Active IQ Unified Manager Discussions

Fetching credentials via pattern

THORSTEN_KRAUSE
6,405 Views

Hello,

 

Ilike to use a pattern for some credentials.

 

The pattern would be:

??-testsrv?

 

But once I fetch them from within a command:

$mysrv = "as-testsrv2"

$mycreds = Get-WfaCredentials -Host $mysrv -ErrorAction stop

Invoke-NaSsh -Name $mysrv  -Command $(ls -la) -Credential $mycreds

 

--> I get a permission denied.

 

--> If I put

as-testsrv2

directly into the credentials list it works fine.

 

Can anybody help here?

 

Thanks!

1 ACCEPTED SOLUTION

THORSTEN_KRAUSE
6,313 Views

Hey,

 

my version is 3.0

 

found the problem, there was another pattern which was conflicting  with that pattern.

For me that solves the problem,

but I think a better error message would be feasible

or a check for potential conflicts when a credential entry is added.

 

Greets Thorsten

 

View solution in original post

7 REPLIES 7

trentino123
6,396 Views

Do you have a credential not Exact but Pattern like *testsrv* ?

 

 

 

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

 

@THORSTEN_KRAUSE wrote:

Hello,

 

Ilike to use a pattern for some credentials.

 

The pattern would be:

??-testsrv?

 

But once I fetch them from within a command:

$mysrv = "as-testsrv2"

$mycreds = Get-WfaCredentials -Host $mysrv -ErrorAction stop

Invoke-NaSsh -Name $mysrv  -Command $(ls -la) -Credential $mycreds

 

--> I get a permission denied.

 

--> If I put

as-testsrv2

directly into the credentials list it works fine.

 

Can anybody help here?

 

Thanks!


 

sinhaa
6,388 Views

Using * will work here but star will match other patters as well which you may not want. 

 

Save the pattern as : [a-z]{2}-testsrv[0-9]{1}

 

You can have a Test Command to check if your Credentials are actually working or not. Below WFA PoSH code can be of great help to see if your pattern can actually get you the desired credemtials.

 

### Begin ###

 

param
(
[parameter(Mandatory=$true, HelpMessage="Host Name")]
[string]$Host

)
$cd=Get-WfaCredentials $Host
if(!$cd)
{
get-WfaLogger -info -Message "Not found"
}
else
{

$pass=ConvertFromSecureToPlain -SecurePassword $cd.Password

Get-WfaLogger -info -Message $cd.UserName
Get-WfaLogger -info -Message $pass
}

 

##End ##

 

sinhaa

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

THORSTEN_KRAUSE
6,368 Views

Hi,

 

thanks for your help.

 

Seems the pattern function doesn't work at all.

 

I just tried it:

 

have a server called "test" --> using "Exact" --> fetching with your script works

 

changing just from "Exact" to "Pattern" --> error 500

also trying "Pattern" with tes* doesn't work.

 

Does that work for you?

sinhaa
6,364 Views

They all work well Thorsten., can you try again in a freshly opened browser.

 

Select: Type: Other

             Match: pattern

             Server: tes*

            Give username and Password

 

 

Now in the command testing code try get credentials for "test". Does it not work?

 

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

THORSTEN_KRAUSE
6,360 Views

unfortunately still not working for me, completely closed all instances of Firefox 34.0 and started new one:

 

12:40:11.707 INFO  [test credential fetching] ### Command 'test credential fetching' ###
12:40:54.312 ERROR  [test credential fetching] Could not get credentials for test. Cause: The remote server returned an error: (500) Internal Server Error.. The remote server returned an error: (500) Internal Server Error.
12:40:56.091 ERROR  [test credential fetching] Command failed for Workflow 'test_ cred fetch' with error : Could not get credentials for test. Cause: The remote server returned an error: (500) Internal Server Error.. The remote server returned an error: (500) Internal Server Error.
12:40:56.138 INFO  [test credential fetching] ***** Workflow Execution Failed *****

sinhaa
6,335 Views

woaah!!.. Thats very strange. Can you provide the following details?

 

  1. What is your WFA version, ports its running on?
  2. Can you try to get the Credentials using REST api ApiExecution Resource?
  3. Can you try to restart your WFA server service.

sinhaa

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

THORSTEN_KRAUSE
6,314 Views

Hey,

 

my version is 3.0

 

found the problem, there was another pattern which was conflicting  with that pattern.

For me that solves the problem,

but I think a better error message would be feasible

or a check for potential conflicts when a credential entry is added.

 

Greets Thorsten

 

Public