macOS PowerShell Connect-PnPOnline fails due to advapi32.dll?

1.2k Views Asked by At

When I try to run the following command:

PS /Users/<user>> Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/<site>

I get this error:

Connect-PnPOnline: Unable to load shared library 'Advapi32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libAdvapi32.dll, 1): image not found

What is "Advapi32.dll", and how can I resolve this?

My environment:
macOS 10.15.3
PowerShell 7.0.0, installed using homebrew (as described here)
SharepointPnpPowerShellOnline, installed like this: Install-Module SharePointPnPPowerShellOnline.

1

There are 1 best solutions below

0
Wren Keber On

Workaround here is to use tbe device login approach, which would be

Connect-PnPOnline -PnPO365ManagementShell

And it worked like a charm for me.

This approach would ask you to use a browser to enter the code and authenticate in the browser.

Helpful context and source: https://www.erwinmcm.com/cross-platform-pnp-powershell/