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

Fail to backup after exception on SPOApp component #4557

Open
gitbpotalan opened this issue Apr 15, 2024 · 3 comments
Open

Fail to backup after exception on SPOApp component #4557

gitbpotalan opened this issue Apr 15, 2024 · 3 comments

Comments

@gitbpotalan
Copy link

Description of the issue

Workload SPO backup seems to progress versus SPO component fail to backup and shutdown the backup process when exception occurs
I just want the process to keep going even if it encounters an error

image

I tried Export-M365DSCConfiguration -ErrorAction Continue and even -ErrorActionPreference Continue at the beginning of the script but nothing works

Microsoft 365 DSC Version

1.24.403.1

Which workloads are affected

SharePoint Online

The DSC configuration

$Components += @("SPOAccessControlSettings", "SPOApp", "SPOBrowserIdleSignout", "SPOHomeSite", "SPOHubSite", "SPOOrgAssetsLibrary", "SPOPropertyBag", "SPOSearchManagedProperty", "SPOSearchResultSource", "SPOSharingSettings", "SPOSite", "SPOSiteAuditSettings", "SPOSiteDesign", "SPOSiteDesignRights", "SPOSiteGroup", "SPOSiteScript", "SPOStorageEntity", "SPOTenantCdnEnabled", "SPOTenantCdnPolicy", "SPOTenantSettings", "SPOTheme", "SPOUserProfileProperty")

Foreach($Component in $(($AllComponents | ?{$_.Service -eq $Service}).Components)) {
Export-M365DSCConfiguration -CertificateThumbprint $cert.Thumbprint -TenantId $TenantId -ApplicationId $ApplicationId -Path "$DSCExport\$Service`_$FormattedDateForDirectoryFormat" -FileName "$Component.ps1" -Components @("$Component")
}

Verbose logs showing the problem

Connecting to {PnP}...✅
[1/1] Extracting [SPOApp] using {CertificateThumbprint}...

    |---[1/2] ses-tree-view.sppkg✅
    |---[2/2] ❌
 Error Log created at {file://C:/scripts/DSC/20120-M365DSC-ErrorLog.log}
⌛ Export took {2 seconds}
Join-Path : Cannot find path 'C:\Users\BPOULA~1.EXT\AppData\Local\Temp\ses-tree-view.sppkg' because it does not exist.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\Modules\M365DSCReverse.psm1:816 char:37
+ ...             $filePath = Join-Path $env:Temp $fileToCopy.Name -Resolve
+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\BPOULA...tree-view.sppkg:String) [Join-Path], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.JoinPathCommand

Partial Export file was saved at: C:\Users\BPOULA~1.EXT\AppData\Local\Temp\52dc648f-0126-497f-b722-babbb1ee11d5.partial.ps1
Copy-Item : Cannot bind argument to parameter 'Path' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\Modules\M365DSCReverse.psm1:818 char:41
+                         Copy-Item -Path $filePath -Destination $destP ...
+                                         ~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Copy-Item], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.CopyItemCommand

Environment Information + PowerShell Version

OsName               : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PSVersion                      5.1.20348.2227
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.2227
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
@gitbpotalan gitbpotalan changed the title SharePoint component SPOApp fail to extract Fail to backup after exception on SPOApp component Apr 16, 2024
@cpc-alruba
Copy link

cpc-alruba commented Apr 16, 2024

Having the exact same issue with DSC version 1.24.403.1. In my case, I'm working to extract entire SPO workload with Default mode. The issue started a couple of weeks ago, the last successful export we had for SPO workload was April 1st then we start noticing this issue.

I updated all dependencies and removed the old ones too to no avail. Surprisingly, its only failing when extracting SPO workload and still works fine with other workloads such as EXO and Teams.

Main issues we noticed before the script fail prematurely are:

  1. Failure to extract some of the SPOApp component
  2. Failure to extract some of the SPOHubSite component with error (Get-MgGroup .... objects are not present (Not found)
  3. a Join-Path error after extract complete due to missing an app path then script ends prematurely and fail to export the results

Error logs from today's export attempt:

[2024/04/16 09:12:38] {InvalidOperation} System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
"Error during Export:"
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\DSCResources\MSFT_SPOApp\MSFT_SPOApp.psm1: line 395
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\Modules\M365DSCReverse.psm1: line 649
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.403.1\Modules\M365DSCUtil.psm1: line 1349
at , C:\Scripts\M365DSCAutomation-SharePoint.ps1: line 52
at , : line 1
TenantId: *******************
`
image

image

@cpc-alruba
Copy link

@andikrueger is this something you can help with?

@cpc-alruba
Copy link

Workaround Solution: I had to disable the error handling CmdLets under the "M365DSCReverse.psm1" file to allow the script to continue to run without interruption!

image

Still have to deal with why I'm getting access denied when exporting the "Get-MgAdminSharepointSetting" despite having the API permission "Organization.Read.All" in my service principal!

image
image

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

2 participants