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

TeamsAppSetupPolicy - Type Casting issue - Unable to create the policy with 'PinnedMessageBarApp', 'AppPresetList' & 'AppPresetMeeting'. #5752

Open
subhashvinjamuri opened this issue Feb 11, 2025 · 1 comment

Comments

@subhashvinjamuri
Copy link
Contributor

Description of the issue

Trying to create/update TeamsAppSetupPolicy with & without specifying either of 'PinnedMessageBarApp' & 'AppPresetMeeting'. Eventhough I used the apps that supports these configurations (confirmed from UI in teams admin), while I am setting up them in conifguration, it erros out saying
##########
Unable to cast object of type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.AppPreset' to type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.AppPresetMeeting'.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProcessRecordFailed,Microsoft.Teams.Policy.Administration.Cmdlets.Core.SetTeamsAppSetupPolicyCmdlet
+ PSComputerName : localhost

The PowerShell DSC resource '[TeamsAppSetupPolicy]TeamsAppSetupPolicy-DSC Test App setup' with SourceInfo
'D:\Setup\M365DSC\CorpDev\DSC-MOF\Extract\Teams\Appsetup\M365TenantConfig_Teams-NoMsgbarOnlyPresetMeetlist.ps1::22::9::TeamsAppSetupPolicy' threw one or more non-terminating errors while running the Set-TargetResource
functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost

The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost
###########
Unable to cast object of type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.PinnedApp' to type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.PinnedMessageBarApp'.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProcessRecordFailed,Microsoft.Teams.Policy.Administration.Cmdlets.Core.SetTeamsAppSetupPolicyCmdlet
+ PSComputerName : localhost

Microsoft 365 DSC Version

1.25.122.1

Which workloads are affected

Teams

The DSC configuration

TeamsAppSetupPolicy "TeamsAppSetupPolicy-DSC Test App setup"
        {
            AllowSideLoading      = $False;
            AllowUserPinning      = $True;
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            AppPresetMeetingList  = @("0e3bedea-4720-48b5-9e13-5a1ce1387d45");
	    PinnedMessageBarApps  = @("0e3bedea-4720-48b5-9e13-5a1ce1387d45");
	    AppPresetList=@("95de633a-083e-42f5-b444-a4295d8e9314");
            PinnedAppBarApps      = @("b5abf2ae-c16b-4310-8f8a-d3bcdb52f162","a63f7012-8cc9-42d5-99c3-e35f526fab17","14d6962d-6eeb-4f48-8890-de55454bb136","86fcd49b-61a2-4701-b771-54728cd291fb","2a84919f-59d8-4441-a975-2a8c2643b741","ef56c0de-36fc-4ef8-b417-3d82ba9d073c");
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Description           = "for DSC testing";
            Ensure                = "Present";
            Identity              = "DSC Test App setup";
            TenantId              = $OrganizationName;
        }

Verbose logs showing the problem

Unable to cast object of type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.AppPreset' to type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.AppPresetMeeting'.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProcessRecordFailed,Microsoft.Teams.Policy.Administration.Cmdlets.Core.SetTeamsAppSetupPolicyCmdlet
    + PSComputerName        : localhost
 
The PowerShell DSC resource '[TeamsAppSetupPolicy]TeamsAppSetupPolicy-DSC Test App setup' with SourceInfo 
'D:\Setup\M365DSC\CorpDev\DSC-MOF\Extract\Teams\Appsetup\M365TenantConfig_Teams-NoMsgbarOnlyPresetMeetlist.ps1::22::9::TeamsAppSetupPolicy' threw one or more non-terminating errors while running the Set-TargetResource 
functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : localhost
 
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost
###########
Unable to cast object of type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.PinnedApp' to type 'Microsoft.Teams.Policy.Administration.Cmdlets.Core.PinnedMessageBarApp'.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProcessRecordFailed,Microsoft.Teams.Policy.Administration.Cmdlets.Core.SetTeamsAppSetupPolicyCmdlet
    + PSComputerName        : localhost

Environment Information + PowerShell Version

OsName               : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Key   : PSVersion
Value : 5.1.17763.6766
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.17763.6766
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
@subhashvinjamuri
Copy link
Contributor Author

@NikCharlebois - I see the issue is at below line of code during casting. all of the types are being casted as Preset/PinnedAp , instead of their respective type as per : https://learn.microsoft.com/en-us/powershell/module/teams/set-csteamsappsetuppolicy?view=teams-ps#syntax
Please confirm.
Below lines need to be changed with their respective app type casting.

https://github.com/microsoft/Microsoft365DSC/blob/Master/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsAppSetupPolicy/MSFT_TeamsAppSetupPolicy.psm1#L254

$appPresetMeetingValues += [Microsoft.Teams.Policy.Administration.Cmdlets.Core.AppPreset]::New($appInstance)

subhashvinjamuri added a commit to subhashvinjamuri/Microsoft365DSC that referenced this issue Feb 11, 2025
subhashvinjamuri added a commit to subhashvinjamuri/Microsoft365DSC that referenced this issue Feb 11, 2025
This was referenced Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant