Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

New-M365DSCReportFromConfiguration fails with html or excel parameters. No report generation is possible.

Open horgasz2023 opened this issue 2 years ago • 2 comments

Description of the issue

Cannot generate report in html or excel format. Tons of warnings and 30% CPU usage with 3GB memory for the powershell process. Nothing generated.

Microsoft 365 DSC Version

1.23.1213.1

Which workloads are affected

Azure Active Directory

The DSC configuration

# Generated by Microsoft365DSC from https://export.microsoft365dsc.com on 12/19/2023, 10:24:24 AM
# Visit https://microsoft365dsc.com for more information

# Getting application information for Application + Secret authentication
$ApplicationId = Read-Host -Prompt 'Application Id'
$ApplicationSecret = Read-Host -Prompt 'Application Secret'
$TenantId = Read-Host -Prompt 'Tenant Id'

# Exporting resources using application
Export-M365DSCConfiguration -Components @("AADAdministrativeUnit", "AADApplication", "AADAttributeSet", "AADAuthenticationContextClassReference", "AADAuthenticationMethodPolicy", "AADAuthenticationMethodPolicyAuthenticator", "AADAuthenticationMethodPolicyEmail", "AADAuthenticationMethodPolicyFido2", "AADAuthenticationMethodPolicySms", "AADAuthenticationMethodPolicySoftware", "AADAuthenticationMethodPolicyTemporary", "AADAuthenticationMethodPolicyVoice", "AADAuthenticationMethodPolicyX509", "AADAuthenticationStrengthPolicy", "AADAuthorizationPolicy", "AADConditionalAccessPolicy", "AADCrossTenantAccessPolicy", "AADCrossTenantAccessPolicyConfigurationDefault", "AADCrossTenantAccessPolicyConfigurationPartner", "AADEntitlementManagementAccessPackage", "AADEntitlementManagementAccessPackageAssignmentPolicy", "AADEntitlementManagementAccessPackageCatalog", "AADEntitlementManagementAccessPackageCatalogResource", "AADEntitlementManagementConnectedOrganization", "AADExternalIdentityPolicy", "AADGroup", "AADGroupLifecyclePolicy", "AADGroupsNamingPolicy", "AADGroupsSettings", "AADNamedLocationPolicy", "AADRoleDefinition", "AADRoleEligibilityScheduleRequest", "AADRoleSetting", "AADSecurityDefaults", "AADServicePrincipal", "AADSocialIdentityProvider", "AADTenantDetails", "AADTokenLifetimePolicy", "AADUser") -ApplicationId $ApplicationId -ApplicationSecret $ApplicationSecret -TenantId $TenantId

Verbose logs showing the problem

PS C:\Windows\system32> New-M365DSCReportFromConfiguration -Type html -ConfigurationPath C:\M365DSC\M365DSC_export_full.ps1 -OutputPath C:\M365DSC\Report.xlsx
WARNING: ConvertTo-DSCObject: "xxxxxx" (line 183485): Unexpected token 'xxxxxx' in expression or statement.
WARNING: ConvertTo-DSCObject: "{" (line 16): Missing closing '}' in statement block or type definition.
WARNING: ConvertTo-DSCObject: "{" (line 7): Missing closing '}' in statement block or type definition.
WARNING: ConvertTo-DSCObject: "xxx";
WARNING: ConvertTo-DSCObject: "&" (line 506958): The ampersand (&) character is not allowed. The & operator is reserved for future use


 ApplicationId        = $ConfigurationData.NonNodeData.ApplicationId;
            ApplicationSecret    = New-Object System.Management.Automation.PSCredential ('ApplicationSecret', (ConvertTo-SecureString 
$ConfigurationData.NonNodeData.ApplicationSecret -AsPlainText -Force));
            Description          = "Application' in expression or statement.
WARNING: ConvertTo-DSCObject: "Technical" (line 211231): Unexpected token 'Technical' in expression or statement.
WARNING: ConvertTo-DSCObject: "&" (line 211265): The ampersand (&) character is not allowed. The & operator is reserved for future use
; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
WARNING: ConvertTo-DSCObject: "" (line 211282): Missing closing ')' in expression.
WARNING: ConvertTo-DSCObject: ")" (line 211282): Unexpected token ')' in expression or statement.
WARNING: ConvertTo-DSCObject: 
; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
WARNING: ConvertTo-DSCObject: "&" (line 506958): The ampersand (&) character is not allowed. The & operator is reserved for future use
; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
WARNING: ConvertTo-DSCObject: "&" (line 507023): The ampersand (&) character is not allowed. The & operator is reserved for future use
; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
WARNING: ConvertTo-DSCObject: "&" (line 507028): The ampersand (&) character is not allowed. The & operator is reserved for future use
; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.

Environment Information + PowerShell Version

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

Key   : PSVersion

PS C:\Windows\system32> Install-Module Microsoft365DSC -Force
Update-M365DSCDependencies
Installing DSCParser version {1.4.0.1}
Installing ExchangeOnlineManagement version {3.4.0}
Installing Microsoft.Graph.Applications version {2.11.1}
Installing Microsoft.Graph.Beta.DeviceManagement version {2.11.1}
Installing Microsoft.Graph.Beta.Devices.CorporateManagement version {2.11.1}
Installing Microsoft.Graph.Beta.DeviceManagement.Administration version {2.11.1}
Installing Microsoft.Graph.Beta.DeviceManagement.Enrollment version {2.11.1}
Installing Microsoft.Graph.Beta.Identity.DirectoryManagement version {2.11.1}
Installing Microsoft.Graph.Beta.Identity.Governance version {2.11.1}
Installing Microsoft.Graph.Beta.Identity.SignIns version {2.11.1}
Installing Microsoft.Graph.Beta.Reports version {2.11.1}
Installing Microsoft.Graph.Beta.Teams version {2.11.1}
Installing Microsoft.Graph.DeviceManagement.Administration version {2.11.1}
Installing Microsoft.Graph.Beta.DirectoryObjects version {2.11.1}
Installing Microsoft.Graph.Groups version {2.11.1}
Installing Microsoft.Graph.Planner version {2.11.1}
Installing Microsoft.Graph.Users version {2.11.1}
Installing Microsoft.Graph.Users.Actions version {2.11.1}
Installing MicrosoftTeams version {5.8.0}
Installing MSCloudLoginAssistant version {1.1.3}

PS C:\Windows\system32> Get-Module Microsoft365DSC -ListAvailable | select ModuleBase, Version

ModuleBase                                                             Version    
----------                                                             -------    
C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1213.1 1.23.1213.1
Value : 5.1.19041.3803
Name  : PSVersion

Key   : PSEdition
Value : Desktop
Name  : PSEdition

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name  : PSCompatibleVersions

Key   : BuildVersion
Value : 10.0.19041.3803
Name  : BuildVersion

Key   : CLRVersion
Value : 4.0.30319.42000
Name  : CLRVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion

horgasz2023 avatar Dec 19 '23 09:12 horgasz2023

We also experience this issue but the reports do eventually generate. In our tenant we see the following:

  • Unexpected token
  • There is an incomplete property assignment block in the instance definition

And a lot of

  • The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
  • quotation marks ("&") to pass it as part of a string.

dbrinkmann123 avatar May 07 '24 13:05 dbrinkmann123

@dbrinkmann123 @horgasz2023 Can you provide us a minimal set of DSC configuration that is affected by that issue? Would be best if there is a DSC configuration for each of the mentioned errors.

FabienTschanz avatar May 17 '24 06:05 FabienTschanz

Closing because of inactivity.

FabienTschanz avatar Feb 14 '25 08:02 FabienTschanz