Open wfi-jonas opened 1 month ago
Does this happen only when using -ManagedIdentity to connect ? Can you test it with certificate authentication just as a test ?
I’ve never used anything else when running in functions or runbooks. Locally on my machine with interactive both versions where working fine, provisioning was done in 2-6 seconds.
@wfi-jonas - can you do a perf on just the connect-pnponline
with managed identity and let us know ? We did bump the MSAL to the latest version, so maybe that could be the issue ?
What do you mean by perf?
@wfi-jonas - sorry I meant , can you just measure the difference in connect-pnponline between these 2 versions ?
Sorry but that doesn’t make sense. In my measure script above I don’t take into account the time it takes to connect because I saw there was no delay there. So I only measured what I found was the causing the delay.
Is new-pnpsite perhaps targeting different urls? In the changelog I didn’t see any update for this command, but perhaps some change slipped in between 2.3.0 and 2.5.0. Perhaps some dependency on this command?
Hm I don’t see anything wrong in this change..
The only change that we have done is update MSAL.NET that we use for authentication to the latest version . We were using an older version which had security vulnerabilities, so we bumped it to the latest version. No other change was done related to site provisioning.
@wfi-jonas - can you please try again with tomorrow's or latest nightly builds again ? We made some changes to token fetching and other things, maybe that helps ?
hello @gautamdsheth , I'm currently not in the office. I'll test this later this week. Thank you for looking into this!
Reporting an Issue or Missing Feature
I have a provisioning script for sites that uses new-PnPsite in an Azure Function App. When I upgraded my script to use 2.5.0 instead of 2.3.0, the function times out. When I rollback it works perfectly fine and create the site within seconds.
In order to test more I created a simple measure script with only the command new-pnpsite that I ran locally and in the Azure Function App to measure the delay, these are the results (3 tests for each version):
Locally 2.3.0 : 4s37 4s03 4s36 2.5.0 : 4s49 3s89 3s09
Azure function app 2.3.0 : 2s03 5s26 6s65 2.5.0 : timeout (2m40s) timeout (2m40s) timeout (2m40s)
Expected behavior
The site gets created in 2-6 seconds.
Actual behavior
timeout of the function after 2minutes 40 seconds.
Steps to reproduce behavior
Azure function app relevant details:
The script I used to test:
param($Request, $TriggerMetadata) import-module pnp.powershell -RequiredVersion "2.5.0" $c = connect-pnponline -url "https://tenantname-admin.sharepoint.com" -ManagedIdentity -returnconnection try{ $title ="Engine Test 27" $url = "https://tenant name.sharepoint.com/sites/$($title -replace ' ','')" $owner = "my email" $sitedesign = "any design id, or remove it as it doesn't affect the delay" $lcid = 1043 $measure = measure-command { $request = new-pnpsite -connection $c -title $title -sitedesignid $sitedesign -Lcid $lcid -owner $owner -url $url -Type CommunicationSite -wait write-output $request } write-output $measure.TotalSeconds }catch{ write-output $Error[0].Exception -ForegroundColor Red $streamReader = [System.IO.StreamReader]::new($_.Exception.Response.GetResponseStream()) $ErrResp = $streamReader.ReadToEnd() $streamReader.Close() write-output $ErrResp -ForegroundColor Red }
What is the version of the Cmdlet module you are running?
Tested with PnP PowerShell 2.5.0 and 2.3.0.
Which operating system/environment are you running PnP PowerShell on?