Using -credential in script doesnt pass credential

if we use a credential stored in a $secret and then pass this credential to a commandlet, the commandlet doesnt seem to use the credential

we can expand the secret and check it is all ok

running in IIS with service account app pool

Does the cmdlet return an error or just not use the credential?

If you do something like this, does it behave any differently?

$Cred = $Secret:Cred
Start-MyCmdlet -Credential $Cred
1 Like

hi, yes this seems to work.