How to fix "The remote server returned an error: (404) Not Found." in PowerShell when Connected to MicrosoftTeams and Requestion Application Access Policies

William Oquendo 5 Reputation points
2023-08-18T21:11:25.2033333+00:00

QUESTION: What do I need to do in order to GET and UPDATE my Application Access Policies. I need the ability to update a Global Access Policy to include the APP ID of my newly created Microsoft Graph APP Registration.

ISSUE: I see the following error when I am connected to Microsoft Teams and try to request my Application Access Policies:

PS C:\WINDOWS\system32> Get-CsApplicationAccessPolicy
Get-CsApplicationAccessPolicy : The remote server returned an error: (404) Not Found.
At line:1 char:1
+ Get-CsApplicationAccessPolicy
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-CsApplicationAccessPolicy], WebException
    + FullyQualifiedErrorId : System.Net.WebException,Microsoft.Teams.ConfigApi.Cmdlets.GetCsApplicationAccessPolicy

Details:

Here's some details for what I have done prior to seeing this error above.

  1. I recently created a new "free" Microsoft Azure Admin Account.
  2. In Azure Admin Portal, I created a new APP Registration for MS Graph and granted the API Permissions below User's image
  3. In Windows PowerShell, I ran the command below to connect to Microsoft Teams. When connected I see the Tenant ID that is associated with my "free" Azure Admin Account.
Connect-MicrosoftTeams
  1. Now Connected, I attempted to retrieve any existing application access policies. (I also tried to create a new access policy, but see the same result).
Get-CsApplicationAccessPolicy

Once the above command is input I see the following error

Get-CsApplicationAccessPolicy : The remote server returned an error: (404) Not Found. At line:1 char:1 + Get-CsApplicationAccessPolicy + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : NotSpecified: (:) [Get-CsApplicationAccessPolicy], WebException     + FullyQualifiedErrorId : System.Net.WebException,Microsoft.Teams.ConfigApi.Cmdlets.GetCsApplicationAccessPolicy
Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. msft-gu 1,355 Reputation points
    2023-08-19T02:01:56.5733333+00:00

    Hi William Oquendo,

    Good day and thank you for your question. I replicated this on my end, but I haven't encountered an issue.

    User's image

    Please make sure that you have the prerequisites first:

    • Windows PowerShell 5.1
    • .NET Framework 4.7.2

    To add, I also tested this on a Global Administrator account and a Teams Administrator account.

    Please let me know if you're still encountering an issue after checking the information above.

    If I answered your question, please upvote and accept it as an answer. Have a great day ahead!


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.