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

Assert-M365DSCBlueprint error with ver 1.23.405.1 using cert auth #3153

Closed
martincaddick opened this issue Apr 11, 2023 · 3 comments · Fixed by #3155 or #3161
Closed

Assert-M365DSCBlueprint error with ver 1.23.405.1 using cert auth #3153

martincaddick opened this issue Apr 11, 2023 · 3 comments · Fixed by #3155 or #3161
Labels
Bug Something isn't working Core Engine

Comments

@martincaddick
Copy link
Contributor

Script script.txt using Assert-M365DSCBlueprint and certificate thumbprint auth works with 1.23.322.1. Fails with 1.23.405.1

Exported ODsettings are very basic but all exports fail with the same errors
od.ps1.txt

PS C:\github\M365DSC\Assess> .\CompareTargetWithBlueprint.ps1
Generate blueprint assessment for OD.ps1
VERBOSE: Dependencies were already successfully validated.
VERBOSE: GET file:///C:/Source/OD.m365 with 0-byte payload
VERBOSE: received 1704-byte response of content type application/octet-stream
Selected BluePrint contains (1) components to assess.
Initiating the Export of those (1) components from the tenant...
Export-M365DSCConfiguration : Cannot validate argument on parameter 'Credential'. The argument is null, empty, or an element of the argument collection contains a null
value. Supply a collection that does not contain any null values and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.405.1\modules\M365DSCUtil.psm1:2663 char:25
+             -Credential $Credentials `
+                         ~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Export-M365DSCConfiguration], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Export-M365DSCConfiguration

New-M365DSCDeltaReport : Cannot find file specified in parameter Source: C:\Users\LOCALA~1\AppData\Local\Temp\c54d7565-72e6-46c0-bf33-ecf7a9306a74.ps1. Please make sure
the file exists!
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.405.1\modules\M365DSCUtil.psm1:2674 char:9
+         New-M365DSCDeltaReport -Source $ExportPath `
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-M365DSCDeltaReport

Processing time for OD.ps1 is 00:00:21.5608381
Processing time was 00:00:21.5608381
PS C:\github\M365DSC\Assess>
@ricmestre
Copy link
Contributor

That's because the newly added ValidateScript doesn't work with parameters of type System.Management.Automation.PSCredential set to null so it cannot be used there as it is. Another one was also added to $TenantId which doesn't fail even if null even though it should, but that's a different topic for the PS team. See PowerShell/PowerShell#12557 for more info.

On both parameters the validation script uses Write-Warning but it won't be displayed since there's no way to tell the script we need to run in Verbose mode, instead if Write-Host is used it works.

@ricmestre
Copy link
Contributor

Actually I didn't have the warnings being displayed because $WarningPreference was set to "SilentlyContinue" which Export-M365DSCConfiguration does right at the top of the function, and I ran it before, so it depends on how it's set.

@andikrueger
Copy link
Collaborator

Thanks for reporting. I did add a comment to the PR #3155 . I would look into the export function for properly passing the parameters to the export function - if this is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Core Engine
Projects
None yet
3 participants