Code Monkey home page Code Monkey logo

Comments (11)

iainbrighton avatar iainbrighton commented on August 28, 2024

I'm thinking that dropping the -Password parameter from the Set-LabVMDefaults cmd completely. Specifying the password on the Start-LabConfiguration (and associated) cmdlet(s) would keep the password from being easily discoverable on disk and easily support the [PSCredential] type.

As a side note; it's currently very easy to specify a different password in a configuration to the actual local administrator password that is currently set during the SYSPREP process. I think it would be beneficial to have to specify the local admin password when creating a lab/VM.

from lability.

csandfeld avatar csandfeld commented on August 28, 2024

Sound good to me. I think that would be quite intuitive as well.

from lability.

iainbrighton avatar iainbrighton commented on August 28, 2024

So having a -Password and/or -Credential parameter on Start-LabConfiguration, and removing -Password from Set-LabVMDefaults would be OK? It will remove the requirement of trying to store credentials securely, probably unsuccessfully!

from lability.

csandfeld avatar csandfeld commented on August 28, 2024

Yes absolutely. And a Credential param would be sweet, giving the option to provide any existing credential object you might have already. Would fit my needs very well indeed.

from lability.

csandfeld avatar csandfeld commented on August 28, 2024

Since it prompts for credentials, and expects a pscredential object, I am wondering if it would make more sense to:

  • Name the parameter 'Credential' (to align with common standards)
  • Include a helpful message and prepopulate the User name when prompting for credential

Example:

Get-Credential -Message 'Enter password to be used for the local administrator accounts' -UserName Administrator

I would be happy to make those changes and create a pull request - if you agree that is

from lability.

iainbrighton avatar iainbrighton commented on August 28, 2024

I'm with you on this one. However, I did play with various options, including using [System.Security.SecureString] instead of a [PSCredential].

Here's what I tried and how I ended up where we are.

  • It was originally -Password [System.Secure.String]
    • I got fed up converting text to secure strings!
  • I then changed it to -Credential [PSCredential]
    • This permits prompting for credential with (Get-Credential) on the parameters
    • The problem with this is, if you hit escape on the credential prompt, you end up with null credentials
  • I changed the -Credential parameter to Mandatory to fix the "hitting escape" issue
    • Unfortunately it then ignores the -UserName and -Message parameters!
    • MS don't make it easy, do they?!
  • I then renamed it to -Password [PSCredential]
    • I think naming it -Password better reflects that the username portion isn't used

Having said that, I'm open to changing its name back to -Credential if you still think it's worthwhile?!
On the mandatory requirement, I guess we could add a check in the begin { } block for this and throw if the PSCredential parameter is null?

I've just tested the SecureString implementation, and it does prompt?! How did I miss this [shakes head]?! Should we change the -Password parameter to a SecureString? People can use a PSCredential object if they want? We could have a parameter set if we want to cover all bases?

from lability.

csandfeld avatar csandfeld commented on August 28, 2024

It's nice that SecureString does prompt, however it still does not allow for any informative text, and you will still need to do string conversion (or use [pscredential].GetNetworkCredential().Password) to supply a value for the parameter. No obvious solution here I guess.

I will see if I can come up with something clever (even though if there is something clever to do about it, you would probably have found it already)

from lability.

iainbrighton avatar iainbrighton commented on August 28, 2024

I'm happy to leave it as a [PSCredential] and I don't see a need to change it. The question is whether we rename the parameter back to -Credential (consistency with most other cmdlets) or leave it as -Password (more descriptive of it's actual purpose)? Choices, choices..

We could have both? If we're going to have informative Get-Credential text we would need to do a null check. Ensuring that we have a password via either would only add a couple of lines.. Thoughts?

from lability.

csandfeld avatar csandfeld commented on August 28, 2024

These are thoughts rather than requirements (at the end of the day, it's your baby). But I would opt for "all of the above"

  • Consistent naming
  • Descriptive text
  • Null check
  • A SecureString password parameter

I think consistent naming and type of parameters will make it more intuitive for users.

from lability.

iainbrighton avatar iainbrighton commented on August 28, 2024

@csandfeld Just one more commit for today! Does the https://github.com/VirtualEngine/Lab/commits/Issue16 branch work for you?

In short it:

  • Renames -Password [PSCredential] parameter back to -Credential [PSCredential]
    • Defaults to -Credential if nothing is specified
    • Should prompt for credentials with a message if not supplied
    • Will error if you push escape or specify an empty password
  • Adds -Password [SecureString] parameter

I would like you to have a look before I merge it into the dev branch..

Forgot to say that this branch includes all today's commits too!

from lability.

csandfeld avatar csandfeld commented on August 28, 2024

Thank you Iain, the password/credential feature works a treat, and I find it much more intuitive this time. Good job! 👍

from lability.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.