What I would like is to logon to sharepoint with powershell using the CSOM-module and using the Credential Manager where I have safely stored the password.
This is a working code to logon to sharepoint
Try
{
$Credentials = New-Object
Microsoft.SharePoint.Client.SharePointOnlineCredentials($user,(ConvertTo-SecureString $pass -AsPlainText -Force))
$Context = New-Object
Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Context.Credentials = $Credentials
}
Catch
{
exit
}
But how can I use the credential manager. I have installed the module en made this:
#$managedCred = Get-StoredCredential -Target SharepointOnline
Does anyone know the solution.
Gr P