May 2018
Beginner
532 pages
14h 1m
English
There are times when it will be convenient to store the username and password you want to use to connect, such as when running an unattended automated script.
You can use the -Credential parameter to pass credentials into the Connect-MsolService command. This parameter takes an object of type PSCredential. This can be done easily with the Get-Credential command. However, as you've seen previously, this command requires input from the user. To create a PSCredential object without user interaction, you will need to have a username and a password stored in a SecureString object.
You can easily create a secure password as follows:
$SecurePassword = Read-Host -Prompt "Enter password" -AsSecureString
However, ...
Read now
Unlock full access