AADApplication: Error Parsing HTML Report - Resource 'MSFT_MicrosoftGraphAppRole' requires that a value of type 'String' be provided for property 'Value'
Description of the issue
When generating an HTML Report for the Resource AADApplication it fails with the error:
ConvertTo-DSCObject : Error parsing DSC configuration: Exception calling "ConvertToDscObject" with "4" argument(s): "Error parsing configuration: Resource 'MSFT_MicrosoftGraphAppRole' requires that a value of type 'String' be provided for property 'Value'."
Microsoft 365 DSC Version
1.26.408.1
Which workloads are affected
Azure Active Directory (Entra ID)
The DSC configuration
AppId = "ad1eae0f-XXXXXXXXXXXXXXXXXXXXXXX";
ApplicationId = 25f7a27f-XXXXXXXXXXXXXXXXXXXXXXX;
ApplicationTemplateId = "dee2cdc2-XXXXXXXXXXXXXXXXXXXXXXX";
AppRoles = @(
MSFT_MicrosoftGraphappRole{
AllowedMemberTypes = @("User")
Description = "msiam_access"
DisplayName = "msiam_access"
Id = "7af25167-XXXXXXXXXXXXXXXXXXXXXXX"
IsEnabled = $True
Origin = "Application"
}
MSFT_MicrosoftGraphappRole{
AllowedMemberTypes = @("User")
Description = "User"
DisplayName = "User"
Id = "8d17fe88-XXXXXXXXXXXXXXXXXXXXXXX"
IsEnabled = $True
Origin = "Application"
}
);
Verbose logs showing the problem
ConvertTo-DSCObject : Error parsing DSC configuration: Exception calling "ConvertToDscObject" with "4" argument(s):
"Error parsing configuration: Resource 'MSFT_MicrosoftGraphAppRole' requires that a value of type 'String' be provided
for property 'Value'."
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.26.408.1\Modules\M365DSCReport.psm1:1895 char:22
+ $parsedContent = ConvertTo-DSCObject @params
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,ConvertTo-DSCObject
Exception calling "ConvertToDscObject" with "4" argument(s): "Error parsing configuration: Resource
'MSFT_MicrosoftGraphAppRole' requires that a value of type 'String' be provided for property 'Value'."
At C:\Program Files\WindowsPowerShell\Modules\DSCParser\3.0.0.2\DSCParser.psm1:164 char:13
+ $result = [DSCParser.CSharp.DscParser]::ConvertToDscObjec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidOperationException
Environment Information + PowerShell Version
OsName : Microsoft Windows Server 2022 Datacenter Azure Edition
OsOperatingSystemSKU : 407
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage : en-US
OsMuiLanguages : {en-US}
Key : PSVersion
Value : 5.1.20348.4294
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.20348.4294
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
As the error implies the property Value is missing from your blueprint, did you create it manually or exported it with an old M365DSC version? It's highly likely you exported this before Value was changed from Write to Required so you need to take a new export which includes that property.
@FabienTschanz I bet this resource also reports a drift because of Id just like the one I've reported on #7062 which is mildly annoying if you have to scavenge through every single resource and all their CIM instances and having to exclude the properties individually so that they're not compared.
@ricmestre Gotcha. I should probably update my PR from two minutes ago to always exclude Id per default and make the resources explicitly include it that really require it. How does that sound?
That probably will fix a ton thank you, but I still think there will always be an odd duck here and there like Identity or something similar, this wasn't a problem before with the old comparison engine as far as I can remember?
As the error implies the property Value is missing from your blueprint, did you create it manually or exported it with an old M365DSC version? It's highly likely you exported this before Value was changed from Write to Required so you need to take a new export which includes that property.
Hi @ricmestre I did a fresh DSC Export with the current DSC Version and tried to generate the HTML Report for it.
@ricmestre The only affected resources with child instances that have the Id parameter are the ones for the authentication methods. I suggest we exclude Id and Identity for now and watch if they drift - The main key comparison should still catch them for the comparison.
Regarding the other issue that the value is empty... Microsoft outdid themselves again. How do you create an app role with an empty value? No idea, but it's there. You cannot update it without assigning it a value. Please don't ask me why that is.
I need to check now if we can somewhat fix this.
Yeah I saw your PR let's hope that covers most of the false positives and yeah graph api can sometimes make your blood boil, someone just forgot to set value as required in their metadata...
@FabienTschanz is there a way for me to manually patch the ComplexObjectConverter.cs file so that I can test this fix before the official release?
You can download the source code, patch the file, build the module, generate the SchemaDefinition.json and then try it. Or you ping me on LinkedIn and I‘ll share a zip with a version for you to test.
Just tested the fix: works like a charm!
I also have this issue, hope the official release is soon :)