Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

ODSettings: member 'DisableAddToOneDrive' is not valid

Open ssoabx opened this issue 1 year ago • 4 comments

Description of the issue

Running the latest DSC release I'm getting the terminating error on the property DisableAddToOneDrive when running New-M365DSCReportFromConfiguration with a freshly exported configuration.

The release notes only mention DisplayNamesOfFileViewers being a new property in the ODSettings resource when DisableAddToOneDrive was also added but not to the schema.

PR: https://github.com/microsoft/Microsoft365DSC/commit/0e37da3a6e3fed087305ab0a83ed3e8a393854bf

Microsoft 365 DSC Version

1.25.1112.1

Which workloads are affected

OneDrive for Business

The DSC configuration

Configuration M365TenantConfig
{
    param (
    )

    $OrganizationName = $ConfigurationData.NonNodeData.OrganizationName

    Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.25.1112.1'

    Node localhost
    {
        ODSettings "ODSettings"
        {
            ApplicationId                             = $ConfigurationData.NonNodeData.ApplicationId;
            BlockMacSync                              = $False;
            CertificateThumbprint                     = $ConfigurationData.NonNodeData.CertificateThumbprint;
            DisableAddToOneDrive                      = $False;
            DisableReportProblemDialog                = $False;
            DisplayNamesOfFileViewers                 = $True;
            DomainGuids                               = @();
            Ensure                                    = "Present";
            ExcludedFileExtensions                    = @();
            IsSingleInstance                          = "Yes";
            NotificationsInOneDriveForBusinessEnabled = $True;
            ODBAccessRequests                         = "Unspecified";
            ODBMembersCanShare                        = "Unspecified";
            OneDriveForGuestsEnabled                  = $False;
            OneDriveStorageQuota                      = 1048576;
            OrphanedPersonalSitesRetentionPeriod      = 30;
            TenantId                                  = $OrganizationName;
            TenantRestrictionEnabled                  = $False;
        }
    }
}

M365TenantConfig -ConfigurationData .\ConfigurationData.psd1

Verbose logs showing the problem

VERBOSE: Loading file 'D:\a\1\s\DSC\<placeholder>\Export-Config\M365TenantConfig.ps1'
Error parsing configuration: At line:20800 char:13
+             DisableAddToOneDrive                      = $False;
+             ~~~~~~~~~~~~~~~~~~~~
The member 'DisableAddToOneDrive' is not valid. Valid members are
'Access***s', 'ApplicationId', 'BlockMacSync', 'CertificatePassword', 'CertificatePath', 'CertificateThumbprint', 
'Credential', 'DependsOn', 'DisableReportProblemDialog', 'DisplayNamesOfFileViewers', 'DomainGuids', 'Ensure', 
'ExcludedFileExtensions', 'GrooveBlockOption', 'IsSingleInstance', 'ManagedIdentity', 
'NotificationsInOneDriveForBusinessEnabled', 'ODBAccessRequests', 'ODBMembersCanShare', 'OneDriveForGuestsEnabled', 
'OneDriveStorageQuota', 'OrphanedPersonalSitesRetentionPeriod', 'PsDscRunAsCredential', 'TenantId', 
'TenantRestrictionEnabled'.
At C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.20\Modules\DSCParser.psm1:490 char:9
+         throw "$($errorPrefix)Error parsing configuration: $parseErro ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Error parsing c...ictionEnabled'.:String) [], RuntimeException
    + FullyQualifiedErrorId : Error parsing configuration: At line:20800 char:13
+             DisableAddToOneDrive                      = $False;
+             ~~~~~~~~~~~~~~~~~~~~
The member 'DisableAddToOneDrive' is not valid. Valid members are
    'Access***s', 'ApplicationId', 'BlockMacSync', 'CertificatePassword', 'CertificatePath', 'CertificateThumbprint' 
   , 'Credential', 'DependsOn', 'DisableReportProblemDialog', 'DisplayNamesOfFileViewers', 'DomainGuids', 'Ensure', '  
  ExcludedFileExtensions', 'GrooveBlockOption', 'IsSingleInstance', 'ManagedIdentity', 'NotificationsInOneDriveForBu   
 sinessEnabled', 'ODBAccessRequests', 'ODBMembersCanShare', 'OneDriveForGuestsEnabled', 'OneDriveStorageQuota', 'Or    
phanedPersonalSitesRetentionPeriod', 'PsDscRunAsCredential', 'TenantId', 'TenantRestrictionEnabled'.

Environment Information + PowerShell Version


ssoabx avatar Nov 12 '25 22:11 ssoabx

Thanks for the quick fix. Was meaning to add it later. Works fine now!

ssoabx avatar Nov 12 '25 23:11 ssoabx

@FabienTschanz It's probably a good idea to add to the unit tests a check if the parameters from Get/Set/Test match between them but also check if they're present in associated schema. As a next step an additional step could be added to also check if the parameter types match, again first between the functions from the module and also against the schema.

Get-Command {Get,Set,Test}-TargetResource | % Parameters -> This gets the parameters of the functions of the module Get-MofSchemaObject -> This parses the schema file and returns it as an object and is present in M365DSCDocGenerator.psm1 module

ricmestre avatar Nov 13 '25 12:11 ricmestre

The schemas are already parsed/checked as part of the QA tests in https://github.com/microsoft/Microsoft365DSC/blob/Dev/Tests/QA/Microsoft365DSC.Resources.Tests.ps1, but the check against the defined parameters in the associated module is missing.

ricmestre avatar Nov 13 '25 12:11 ricmestre

So true. I felt the pain again… Got so many ideas on how to make our life easier, just need the time to do it all. Thanks for the inputs, appreciate it.

FabienTschanz avatar Nov 13 '25 21:11 FabienTschanz