Dec 18 2016 10:56 PM - edited Dec 18 2016 10:56 PM
On the #ESPC16 in Vienna someone is showing a way to store credentials in the Windows credential manager and then use is in Powershell to connect to Exchange / SharePoint / Azure… online.
It was a very simple and I will use it for some scheduled tasks.
But i don’t remember how he does it and I didn’t find such a good and simple way in the net.
Anyone has it also seen or use it before?
Dec 19 2016 02:07 AM
It's not exactly the same you asked for but it does the job so might be helpful:
Dec 19 2016 09:52 AM
This should help https://github.com/SharePoint/PnP-PowerShell/wiki/How-to-use-the-Windows-Credential-Manager-to-ease-...
It was written by the very helpful @Erwin van Hunen
Dec 21 2016 01:19 AM
I am using the PasswordVault module for this, and it works pretty great.
I wrote a tiny, crude function that would allow me to export a saved credential to a $CurrentCredential variable to use for automation and such:
function Save-CredentialToVariable ($CredentialLookupString) ######## This function saves a credential from vault to a variable { $global:CurrentCredential = Get-VaultCredential | Where-Object {$_.Resource -match $CredentialLookupString} | ConvertTo-Credential }
Jan 03 2017 06:07 AM
Jan 04 2017 10:04 PM
Jan 05 2017 05:26 AM - edited Jan 05 2017 10:33 AM
Sorry, i can't answer that question. Maybe @Erwin van Hunen can provide some additional insight about how to use this approach with other modules.
Jan 05 2017 09:06 AM
SolutionWe use a class which is available in the PnP Core module to use retrieve credentials from the Windows Credential Manager. That class you can find here :
This would require you to either rewrite that to PowerShell, or use the PnP Core assembly in your project (or simply copy over this class to your own binary PowerShell module code).
Alternatively you could install the PnP PowerShell cmdlets (install-module sharepointpnppowershellonline) and forget about all the other cmdlets and use:
Get-PnPStoredCredential -Name "nameofthecredential" -Type PSCredential
Jan 09 2017 02:36 AM
Jan 05 2017 09:06 AM
SolutionWe use a class which is available in the PnP Core module to use retrieve credentials from the Windows Credential Manager. That class you can find here :
This would require you to either rewrite that to PowerShell, or use the PnP Core assembly in your project (or simply copy over this class to your own binary PowerShell module code).
Alternatively you could install the PnP PowerShell cmdlets (install-module sharepointpnppowershellonline) and forget about all the other cmdlets and use:
Get-PnPStoredCredential -Name "nameofthecredential" -Type PSCredential