Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

Export-M365DSCConfiguration failing on various resources in default selection list

Open RobBiddle opened this issue 6 years ago • 16 comments

Details of the scenario you tried and the problem that is occurring

Running Export-M365DSCConfiguration and using the default resource selections is failing.

Verbose logs showing the problem

EXOInboundConnector & EXOOutboundConnector fail with the following error:

{InvalidData} System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'ResourceName' because it is an empty string. 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete()

SSCComplianceSearchAction run against a tenant with existing cases results in this error:

{NotSpecified} System.Management.Automation.MethodInvocationException: Exception calling "IndexOf" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex" ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex at System.String.IndexOf(String value, Int32 startIndex, Int32 count, StringComparison comparisonType) at CallSite.Target(Closure , CallSite , String , String , Object ) --- End of inner exception stack trace --- 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete()

Suggested solution to the issue

The DSC configuration that is used to reproduce the issue (as detailed as possible)

# insert configuration here

The operating system the target node is running

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

Version of the DSC module that was used ('dev' if using current dev branch)

1.20.730.2 Microsoft365DSC pulled from master branch

RobBiddle avatar Aug 03 '20 21:08 RobBiddle

same as #713

nlangsto avatar Aug 04 '20 09:08 nlangsto

@nglangsto & @RobBiddle can you confirm that you are only passing in the Tenant Admin and password parameters from the GUI? Thanks

NikCharlebois avatar Aug 04 '20 11:08 NikCharlebois

That's a yes from me, with MFA prompt after, all very simple and 'default'. Happy to do screen share, I have spare time in 1hr.

nlangsto avatar Aug 04 '20 12:08 nlangsto

Hello, same problem here with the Inbound and Outbound connectors. Same OS And we are passing only the tenant admin and password from the GUI

bogdanpaste avatar Aug 04 '20 12:08 bogdanpaste

Thanks folks, we are trying to get a repro on our end. If you launch the GUI, only select EXOInboundConnector & EXOOutboundConnector and only provide Tenant Admin and Password, do you get the error on every run? Thanks

NikCharlebois avatar Aug 04 '20 14:08 NikCharlebois

Yep, errors

PS C:\Users\micro> Export-M365DSCConfiguration WARNING: The names of some imported commands from the module 'Microsoft.PowerApps.Administration.PowerShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb. WARNING: The names of some imported commands from the module 'SharePointPnPPowerShellOnline' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb. [1/4] Extracting [EXOInboundConnector]...Using ConnectionUri:'https://outlook.office365.com/powershell-liveid/', in the environment:'O365Default'. Using ConnectionUri:'https://outlook.office365.com/powershell-liveid/', in the environment:'O365Default'.

|---[1/3] From Conrad IP❌ Logging a new Error

PS C:\Users\micro>

[2020/08/04 03:52:25] {InvalidData} System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'ResourceName' because it is an empty string. 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() ""

nlangsto avatar Aug 04 '20 14:08 nlangsto

same when only selecting EXOAvailabilityAddressSpace

PS C:\Users\micro> Export-M365DSCConfiguration [1/1] Extracting [EXOAvailabilityAddressSpace]... |---[1/1] domixxxxxxxxxxxxxxx.uk❌ Logging a new Error PS C:\Users\micro>

[2020/08/04 03:57:56] {InvalidData} System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'ResourceName' because it is an empty string. 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() ""

nlangsto avatar Aug 04 '20 14:08 nlangsto

We managed to repro, and identified the source of the issue, at least for the EXO resources.

@RobBiddle We also believe we have a fix for the SC Compliance Search Action, but will ask you to test once the PR is approved and merged.

NikCharlebois avatar Aug 04 '20 15:08 NikCharlebois

Reopening since it was automatically closed from PR merge. @nlangsto could you please grab the latest version from GitHub (Dev Branch), and confirm it if works. Thanks

NikCharlebois avatar Aug 04 '20 15:08 NikCharlebois

sorry, didnt work for me.

ran Install-M365DSCDevBranch with admin, closed ps then ran Export-M365DSCConfiguration with only EXOAvailabilityAddressSpace selected

PS C:\WINDOWS\system32> Export-M365DSCConfiguration [1/1] Extracting [EXOAvailabilityAddressSpace]... |---[1/1] domxxxxxxxxxxxuk❌ Logging a new Error

[2020/08/04 05:48:53] {InvalidData} System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'ResourceName' because it is an empty string. 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() ""

then ran same for EXOInboundConnector/outbound

same error

PS C:\WINDOWS\system32> Export-M365DSCConfiguration [1/2] Extracting [EXOInboundConnector]... |---[1/3] Inbound from Website❌ Logging a new Error PS C:\WINDOWS\system32>

[2020/08/04 05:50:13] {InvalidData} System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'ResourceName' because it is an empty string. 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() ""

nlangsto avatar Aug 04 '20 16:08 nlangsto

@NikCharlebois looks like those changes fixed extraction for EXOInboundConnector & EXOOutboundConnector, thanks!

SCComplianceSearchAction is still failing At C:\Users\rbiddle\Office365DSC\Modules\Microsoft365DSC\DSCResources\MSFT_SCComplianceSearchAction\MSFT_SCComplianceSearchAction.psm1:485 char:17

  •     $return $null
    
  •             ~~~~~
    

Unexpected token '$null' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken

Import-Module : The specified module 'C:\Users\rbiddle\Office365DSC\Modules\Microsoft365DSC\DSCResources\MSFT_SCComplianceSearchAction\MSFT_SCComplianceSearchAction.psm1' was not loaded because no valid module file was found in any module directory. At C:\Users\rbiddle\Office365DSC\Modules\Microsoft365DSC\modules\M365DSCReverse.psm1:339 char:9

  •     Import-Module $resource.FullName | Out-Null
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ResourceUnavailable: (C:\Users\rbiddl...archAction.psm1:String) [Import-Module], FileNotFoundException
    • FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

That error seems to only be part of the problem. I haven't quite groked that resource module but it looks like line: https://github.com/NikCharlebois/Microsoft365DSC/blob/94fafc3d17c06165bfa70482b4e2b5f2792f69e6/Modules/Microsoft365DSC/DSCResources/MSFT_SCComplianceSearchAction/MSFT_SCComplianceSearchAction.psm1#L485 should probably be changed to either $result = $null or return $null

If I change it to $result = $null it then throws:

{NotSpecified} System.Management.Automation.MethodInvocationException: Exception calling "IndexOf" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex" ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex at System.String.IndexOf(String value, Int32 startIndex, Int32 count, StringComparison comparisonType) at CallSite.Target(Closure , CallSite , String , String , Object ) --- End of inner exception stack trace --- 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete()

If I change that line to return $null then it throws:

{InvalidData} System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'Action'. The argument "Preview" does not belong to the set "Export,Purge,Retention" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again. ---> System.Management.Automation.ValidationMetadataException: The argument "Preview" does not belong to the set "Export,Purge,Retention" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again. at System.Management.Automation.ValidateSetAttribute.ValidateElement(Object element) at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags) --- End of inner exception stack trace --- 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) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete()

RobBiddle avatar Aug 04 '20 16:08 RobBiddle

Sorry, tried again today updating dev branch again

[12/103] Extracting [EXOAtpPolicyForO365]... |---[1/1] ✅ [13/103] Extracting [EXOAvailabilityAddressSpace]...❌ Logging a new Error ✅ [14/103] Extracting [EXOAvailabilityConfig]...❌ Logging a new Error PS C:\a_dsc>

nlangsto avatar Aug 05 '20 08:08 nlangsto

@NikCharlebois FYI I pulled down the latest from the master branch. 1.20.805.1 Same error for SCComplianceSearchAction:

{InvalidData}
System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'Action'. The argument "Preview" does not belong to the set "Export,Purge,Retention" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again. ---> System.Management.Automation.ValidationMetadataException: The argument "Preview" does not belong to the set "Export,Purge,Retention" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
   at System.Management.Automation.ValidateSetAttribute.ValidateElement(Object element)
   at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete()

The Verbose console output shows:

VERBOSE: Get-TargetResource Result:
 Action=Export; ActionScope=$null; EnableDedupe=False; Ensure=Present; FileTypeExclusionsForUnindexedItems=$null;
GlobalAdminAccount=System.Management.Automation.PSCredential; IncludeCredential=True; IncludeSharePointDocumentVersions=$null;
RetryOnError=False; SearchName=146184_1

RobBiddle avatar Aug 06 '20 23:08 RobBiddle

Any update? DSC is unusable for me. Cheers

nlangsto avatar Sep 01 '20 09:09 nlangsto

This has been fixed within the latest version 1.20.903.1. Thanks

NikCharlebois avatar Sep 02 '20 18:09 NikCharlebois

Sorry, not fixed for me. Using todays dev branch. Ive opened up another case as I cannot comment on this one.

On Wed, 2 Sep 2020 at 19:38, Nik Charlebois [email protected] wrote:

This has been fixed within the latest version 1.20.903.1. Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/Microsoft365DSC/issues/729#issuecomment-685924250, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIEWMGBJRL44NMBEJV4ONKTSD2GLJANCNFSM4PTXQBFQ .

--


Neil Langston +447957336344

nlangsto avatar Sep 02 '20 19:09 nlangsto