Copy a SharePoint file using Azure Automation PowerShell scripting

Bronze Contributor

Using a PowerShell script in Microsoft Azure Automation I want to copy a file from a location inside site collection A to a location site collection B, e.g. I want to copy https://mytenant.sharepoint.com/sites/mysitecollectionA/siteassets/myfile.zip to https://mytenant.sharepoint.com/sites/mysitecollectionB/siteassets/myfile.zip. How can this be done @Vesa Juvonen @Erwin van Hunen?

 

I prefer a solution using the Office Dev PnP PowerShell modules, but using other PowerShell techniques is also acceptable.

 

I thought about using the Get-SPOFile / Add-SPOFile functions, but these functions require a local path, which I don't have in my Azure Automation PowerShell script. Or am I missing something and can these functions also be used for this?

I am also missing a Copy-SPOFile method which would be useful for this, can that be created to provide this solution?

0 Replies