Add-PnPFile : Access denied. You do not have permission to perform this action or access this resour

Copper Contributor
I am trying to upload a file (actually copy a file from a local machine) to folder in OneDrive for Business
 

$UserName="user@domain"

$pwd ="StrongPassword"

$SiteUrl = "https://domaincorp.sharepoint.com/sites/testing"

$encpassword = convertto-securestring -String $pwd -AsPlainText -Force

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $encpassword

Connect-PnPOnline -Url $SiteUrl -Credentials $cred

echo "connected"

Add-PnPFile -Path '.\localFileName.docx' -Folder 'Documents'

 

I get : Add-PnPFile : Access denied. You do not have permission to perform this action or access this resource.
 
I'am global admin in O365 and in Azure Portal
0 Replies