Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export-M365Configuration -Workloads OD - The current connection holds no SharePoint context #5165

Open
csancheznt opened this issue Oct 8, 2024 · 0 comments

Comments

@csancheznt
Copy link

Description of the issue

I have the current version of M365DSC installed with PNP modules 2.12.0 and 1.12.0 installed. I registered and app, gave it consent and added it to SharePoint Online as a trusted app. I run the following command "Export-M365DSCConfiguration -Workloads OD -ApplicationId "hidden" -TenantId "hidden.onmicrosoft.com" -Components @("SPOAccessControlSettings") -Path C:\DSC -FileName OneDrive.ps1 -Credential $creds" to get an export of the OneDrive settings and the error I get is "System.InvalidOperationException: The current connection holds no SharePoint context. Please use one of the Connect-PnPOnline commands which uses the -Url argument to connect.
".
at PnP.PowerShell.Commands.PnPSharePointCmdlet.BeginProcessing()
at PnP.PowerShell.Commands.Base.PnPAdminCmdlet.BeginProcessing()
at System.Management.Automation.Cmdlet.DoBeginProcessing()
at System.Management.Automation.CommandProcessorBase.DoBegin()
"Error retrieving data:"
at Get-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\DSCResources\MSFT_ODSettings\MSFT_ODSettings.psm1: line 128
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\DSCResources\MSFT_ODSettings\MSFT_ODSettings.psm1: line 669
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\Modules\M365DSCReverse.psm1: line 682
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\Modules\M365DSCUtil.psm1: line 1439
at , : line 1

Microsoft 365 DSC Version

1.24.1002.1

Which workloads are affected

OneDrive for Business

The DSC configuration

No response

Verbose logs showing the problem

2024/10/08 08:27:18]
{NotSpecified}
System.InvalidOperationException: The current connection holds no SharePoint context. Please use one of the Connect-PnPOnline commands which uses the -Url argument to connect.
   at PnP.PowerShell.Commands.PnPSharePointCmdlet.BeginProcessing()
   at PnP.PowerShell.Commands.Base.PnPAdminCmdlet.BeginProcessing()
   at System.Management.Automation.Cmdlet.DoBeginProcessing()
   at System.Management.Automation.CommandProcessorBase.DoBegin()
"Error retrieving data:"
at Get-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\DSCResources\MSFT_ODSettings\MSFT_ODSettings.psm1: line 128
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\DSCResources\MSFT_ODSettings\MSFT_ODSettings.psm1: line 669
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\Modules\M365DSCReverse.psm1: line 682
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.1002.1\Modules\M365DSCUtil.psm1: line 1439
at <ScriptBlock>, <No file>: line 1

Environment Information + PowerShell Version

OsName               : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}



PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.4894
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4894
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant