Nov 05 2018 11:30 AM
We try to provision sites using PowerShell code in Azure Automation and get various errors.
It is worse when we run many concurent sessions but, in the current case, even a single instance fail.
The error we are curently stuck on says something like "unable to find user" (our error is in french)
ERROR: Get-PnPWeb : Impossible de trouver l'utilisateur.At line:57 char:12+ $WEB = Get-PnPWeb+ ~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Get-PnPWeb], ServerException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.GetWeb
What is weird is that everything happens with the same user and that
Connect-PnPOnline works
Get-PnPContext works
But Get-PnPWeb fails.
Any hints on how to debug that?
By the way, we run the same commands from our own ISE session it works.
@Erwin van Hunen I see your name everywhere in the GitHub so I mention you in case you could help.
Nov 05 2018 02:33 PM
Hi Benoit,
The account you're using when running in ISE is the same as what you're using with Connect-PnPOnline when running in your runbook?
Nov 05 2018 03:33 PM
I just tried it myself and did in sequence:
Connect-PnPOnline -Url etc. etc.
$context = Get-PnPContext
$web = Get-PnPWeb
$web.Title
and I did not receive any error messages or issues and it showed the title of the web in the output. I'm more thinking there is an issue with the web you're connecting to? Like no access with the account you're using in your runbook?
Nov 05 2018 05:21 PM
Erwin,
Yes, same account. It didn't make sense for us because we always connect with the same user credentials.
The strange thing is that the same code runs correctly most of the times but sometimes errors occurs. It was one of the first occurence where the error was constant on azure and not present locally.
We also had 403 errors from SPO but these are not repeatable.
We changed the code a little (but connect with the same commands sequence) and restarted the job. We then had a lot less failures in the ±2500 sites that were provisionned in our test environment.
Thanks for caring.