Get-PnPFile Fails When Called From Azure Runbook #2585
Unanswered
dremillard
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Surprised no one has encountered this fairly common scenario. I would have thought it should work in an Azure Runbook, so it seemed like a bug. It would be interesting to know if anyone has gotten it to work. Anyone? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Use PnP.PowerShell version 1.7.0 with PowerShell 7.2 and Az runtime version to ~4, Hopefully it will work, latest PnP version are unstable with Az runbook |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
I'm trying to download a file from SharePoint Online using Get-PnPFile. I'm using an Azure App Registration and Cert Thumbprint to connect. It works fine when I do it from my laptop but fails with a "file not found 404" when I do it from a PowerShell runbook in Azure.
I'm running PowerShell 7 and PnP.PowerShell version 1.12. (Other things break if I use PowerShell 5).
Connect statement is like:
$Conn = Connect-PnPOnline -Url $SiteURL -ClientId $ClientID -Tenant $TenantID -Thumbprint $Thumbprint -ReturnConnection
Get-PnPFile statement is like:
Get-PnPFile -Url $SiteTemplateURL -Path c:\temp -FileName $SiteTemplateFile -AsFile -Connection $Conn
From examples I've seen online, $SiteTemplateURL seems to need a server relative address like "/sites/sitename/libraryname/documentname.xml". I've also tried just "/libraryname/documentname.xml" to no avail.
I've also tried putting a variable in front like:
$status = Get-PnPFile -Url $SiteTemplateURL -Path c:\temp -FileName $SiteTemplateFile -AsFile -Connection $Conn
I've also tried something I found in a Tony Redmond article:
$status = (Get-PnPFile -Url $SiteTemplateURL -Path c:\temp -FileName $SiteTemplateFile -AsFile -Connection $Conn | Out-Null)
Any ideas on why it would work on my laptop but not in an Azure Runbook? Anyone bump into this before?
Thanks in advance,
Dave
Beta Was this translation helpful? Give feedback.
All reactions