Closed daniel-pfaeffli closed 4 years ago
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
This is also related to #2725 - ill close down my ticket.
Hello. I am also facing this issue. My scenario: I am running this from an Azure Automation PowerShell runbook, SharePointPnPPowerShellOnline module version 3.22.2006.2
First I run:
$connectGraph = Connect-PnPOnline -ClientId "<my ClientID>" -ClientSecret $clientSecret -AADDomain "<my domain>.nl"
All seems OK.
Then I run:
$group = Get-PnPUnifiedGroup -Identity $CustomerNumber
That's when I get the following error:
Get-PnPUnifiedGroup : Unable to find an entry point named 'GetPerAdapterInfo' in DLL 'iphlpapi.dll'. At line:492 char:14 + $group = Get-PnPUnifiedGroup -Identity $CustomerNumber +
~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [Get-PnPUnifiedGroup], EntryPointNotFoundException + FullyQualifiedErrorId : System.EntryPointNotFoundException,SharePointPnP.PowerShell.Commands.Graph.GetUnifiedGroup
When I run this command locally on my device (same module version), it runs fine.
Thanks guys for reporting it. I can reproduce it as well on an Azure Runbook. As of now I have no idea what could be causing this. If any of you have an idea what could be the cause, please share to help in troubleshooting this.
For now, please revert to using the May 2020 release for your Runbook scripts.
Hi @KoenZomers - I think you may have solved it in another area in a previous PR, this problem affected connections to SharePoint too which was fixed in the June release, this is the Graph call may need the same code fix.
Interesting @pkbullock. I indeed find reports going back to Februari 2018 where this is being mentioned. I did quite a major overhaul of all authentication methods in the June 2020 release which makes it a bit hard to track down what could lead to this issue. Also because, as everyone states, locally it works fine and debugging from an Azure Runbook, as far as I am aware, is impossible. I've spent some time yesterday on trying to remove some components from the code, building a new internal release, uploading it to Azure Runbooks, waiting for it to be extracted and trying it out again. It's a very time consuming process and a shot in the dark, so doesn't really help.
With the wonderful help of @robinmeure we managed to find the cause of the problem to be an updated MSAL library underneath which contains tracking code for the usage and tries to request the IP address of the machine to uniquely identify the source of the request. Trying to retrieve the IP address is what crashes in Azure Runbooks.
We're looking into a solution now. To be continued.
Fixed with PR https://github.com/pnp/PnP-PowerShell/pull/2735
If you want to try this out before it gets released with the next PnP PowerShell release, download this build and import it into your Azure Runbook: SharePointPnPPowerShellOnline.zip
Don't forget to delete your existing reference to the June 2020 release of PnP PowerShell first.
Hey @KoenZomers and @robinmeure - Graph calls in Azure Automation with PnP PowerShell using Certificates - that worked a treat with the attached version, thank you!!
Thanks for confirming @pkbullock. Closing this issue assuming it will be resolved for everyone. Feel free to reopen if its not resolved.
Found out that the fix makes it work for Azure Runbooks, but will break Initialize-PnPPowerShellAuthentication. Submitted a PR with MSAL to hopefully get this addressed on their side. Attached a preview build of PnP PowerShell with a custom build of MSAL in which this fixed.
Reporting an Issue or Missing Feature
Expected behavior
"Get-PnpAccessToken" as well as "Get-PnPGraphAccessToken" should return the current token.
Actual behavior
Locally "Get-PnpAccessToken" as well as "Get-PnPGraphAccessToken" are working like a charm.
As soon as the script is running in a runbook (AzureSandbox) the cmdlet fails with
_Get-PnPAccessToken : Unable to find an entry point named 'GetPerAdapterInfo' in DLL 'iphlpapi.dll'_.
Both, locally and in azure automation, the connection is done via the same certificate and aad app.
Connect-PnPOnline -CertificatePath $certPath -CertificatePassword $secPassword -Tenant $aadDomain -ClientId $clientID -Url $SiteUrl
Steps to reproduce behavior
Connect-PnPOnline -CertificatePath $certPath -CertificatePassword $secPassword -Tenant $aadDomain -ClientId $clientID -Url $SiteUrl $token = GetGet-PnpAccessToken
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
Locally 3.22.2006.1 (no side by side) Automation: 3.22.2006.1
How did you install the PnP-PowerShell Cmdlets?