Cast issue on app id when running New-CsApplicationAccessPolicy

Pradeep Patel 1 Reputation point
2022-01-25T17:00:13.147+00:00

Hi,

I've run into an error after following this document (https://learn.microsoft.com/en-us/graph/cloud-communication-online-meeting-application-access-policy) 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
'System.String'."

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.
13,685 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.
4,039 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,628 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Pradeep Patel 1 Reputation point
    2022-01-27T12:04:38.313+00:00

    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
    Connect-MicrosoftTeams

    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 https://blog.matrixpost.net/teams-powershell-several-cmdlet-doesnt-work-errounable-to-cast-object-of-type-system-management-automation-pslistmodifier-to-type-system-string/, which explains the issue in more detail.


  2. Limitless Technology 39,901 Reputation points
    2022-01-28T08:54:17.33+00:00

    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:

    https://learn.microsoft.com/en-us/microsoftteams/teams-powershell-install

    --------------------------------------------------------------------------------------------------------------------------------

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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.