Cast issue on app id when running New-CsApplicationAccessPolicy

Pradeep Patel 1 Reputation point


I've run into an error after following this document ( when trying to set up an application access policy in powershell. This is the cmdlet that was run, which produced the error,

New-CsApplicationAccessPolicy -Identity "MeetingsPolicy" -AppIds "<app-id>" -Description "MeetingsPolicy"

The error received in powershell is the following,

"New-CsApplicationAccessPolicy : Unable to cast object of type 'System.Management.Automation.PSListModifier' to type

Can anyone help shed any light on what is the problem here and how to fix it please?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,470 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,816 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,344 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Pradeep Patel 1 Reputation point

    So it turned out the Microsoft Teams cmdlet module version 3.1.0 has issues in there when installed with no previous version. I had to install the 2.3.2-preview version first, which allowed the cmdlets to work. I then updated this version to 3.1.0 and it works fine.

    So the steps you need to take are the following,
    i) Remove the teams module from powershell,
    Uninstall-Module MicrosoftTeams -Allversions

    ii) Install the older version first,
    Install-Module -Name MicrosoftTeams -RequiredVersion 2.3.2-preview -AllowPrerelease

    iii) Connect to teams

    v) Update to the latest version (Optional)
    Update-Module -Name MicrosoftTeams

    Run cmdlet and it should work now.

    Credit to Marcus Rath for his post here, which explains the issue in more detail.

  2. Limitless Technology 39,331 Reputation points

    Hello PradeepPatel

    Could you verify that you have the lastest Powershell, and Teams Modile versions? It is highly probable the there is some object update missing:


    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments