Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

TeamsOnlineVoicemailPolicy: MaximumRecordingLength type not correct in module

Open ricmestre opened this issue 7 months ago • 1 comments

Description of the issue

@FabienTschanz Seems that you've changed the type of property MaximumRecordingLength from String to SInt32 in the schema file but missed changing it in the module so now I have a config with an integer but it fails when trying to deploy it, this resource was working before the breaking change.

Microsoft 365 DSC Version

1.26.408.1

Which workloads are affected

Teams

The DSC configuration

TeamsOnlineVoicemailPolicy "TeamsOnlineVoicemailPolicy-TeamsOnlineVoicemailPolicy_1"
        {
            ApplicationId                       = $TeamsApplicationId;
            CertificateThumbprint               = $TeamsCertThumbprint;
            EnableEditingCallAnswerRulesSetting = $True;
            EnableTranscription                 = $False;
            EnableTranscriptionProfanityMasking = $False;
            EnableTranscriptionTranslation      = $True;
            Ensure                              = "Present";
            Identity                            = "TeamsOnlineVoicemailPolicy_1";
            MaximumRecordingLength              = 300;
            ShareData                           = "Defer";
            TenantId                            = $OrganizationName;
        }

Verbose logs showing the problem

{"code":"ClientError","message":" Maximum recording length must be between \"30\" - \"600\" seconds.","action":"Please refer to documentation. CorrelationId: REDACTED","errorCode":40013,"innerError":{"ErrorCode":"OnlineVoicemailMaximumRecordingLengthOutOfRange","ErrorCodeMetadata":{"ParameterList":["30","600"]}}}

Environment Information + PowerShell Version

Win11/PS5.1

ricmestre avatar Apr 12 '26 20:04 ricmestre

Proposed fix is now available in PR #7058: https://github.com/Microsoft365DSC/Microsoft365DSC/pull/7058

What was fixed

  • Aligned MaximumRecordingLength type in MSFT_TeamsOnlineVoicemailPolicy.psm1 from String to Int32 (Get/Set/Test parameters).
  • Fixed conversion logic to interpret the integer value as seconds via New-TimeSpan -Seconds ... before calling Teams cmdlets.
  • Added targeted unit-test assertions to verify the cmdlets receive the expected TimeSpan value.

This addresses the schema/module mismatch and the invalid conversion behavior causing deployment failures for values like 300.

Shirshaw64p avatar Apr 13 '26 02:04 Shirshaw64p