What is the Microsoft Teams Protection PowerShell in Microsoft 365 organization?

Copper Contributor

Exchange Online Protection PowerShell has a url:

        https://ps.protection.outlook.com/powershell-liveid/

        or

        https://ps.protection.outlook.de/powershell-liveid/

 

But i want to user power shell by remote host,i can`t find any Protection PowerShell url which can work success in Microsoft Teams.

I need the url to start code in c# project  with System.Management.Automation.Runspaces.WSManConnectionInfo(remoteUrl,shellUrl,credential);

Please help me to fix it.Thanks a lot~

5 Replies

There is none. Exchange/SfB use PowerShell remoting, Teams uses direct calls against the Graph API endpoints: https://docs.microsoft.com/en-us/graph/api/resources/teams-api-overview?view=graph-rest-1.0

@Vasil Michev  But i need to Manage the Policies about The Microsoft Teams,the Graph API don`t have any api about Set Team Policies.So i need to user Power shell remote host.The Policies Setting Power shell cmdlet is on the SFB power shell site

企业微信截图_1603241975383.png

and only a little cmdlet on the Teams power shell site.

企业微信截图_1603242003894.png

Policies are managed via SfB cmdlets, no need for anything Teams PowerSHell related there. If you want to establish a session outside of the module, use the https://admin0e.online.lync.com/OcsPowershellOAuth?AdminDomain=tenant.onmicrosoft.com endpoint, or the newer https://api.interfaces.records.teams.microsoft.com/OcsPowershellOAuth/admin0e.online.lync.com?AdminD... one.

@Vasil Michev 

WSManConnectionInfo connectionInfo = new WSManConnectionInfo(
    new Uri("https://admin0e.online.lync.com/OcsPowershellOAuth? 
    AdminDomain=tenant.onmicrosoft.com"),
    "http://schemas.microsoft.com/powershell/Microsoft.Teams",
    TeamPSHelper.credential)
{
    AuthenticationMechanism = AuthenticationMechanism.Basic,
    SkipCACheck = true,
    SkipCNCheck = true,
    MaximumConnectionRedirectionCount = 4
};
using (var runspace = RunspaceFactory.CreateRunspace(connectionInfo))
{
    runspace.Open();   // throw error at here !!!!!!!!!

    var result = TeamPSHelper.ConnectTeamSessionCmdlet(runspace);

    //TeamPSHelper.GetTeamSettingsCmdlet(runspace);

    TeamPSHelper.DisconnectTeamSessionCmdlet(runspace);
}


I use this url to create runspace,but return error.Please help me to have a look error,why be error?the url "https://admin0e.online.lync.com/OcsPowershellOAuth?AdminDomain=tenant.onmicrosoft.com" or "https://api.interfaces.records.teams.microsoft.com/OcsPowershellOAuth/admin0e.online.lync.com?AdminD..." is invalid?

@Vasil Michev 

 

Any idea why i can't connect to the second url? The first one is being blocked as microsoft deprecated it, but the second results in error that says:

 

Connecting to remote server api.interfaces.records.teams.microsoft.com failed with the following error message : The WinRM client cannot process the request. The authentication mechanism requested by the client is not supported by the server or unencrypted traffic is disabled in the service configuration. Verify the unencrypted traffic setting in the service configuration or specify one of the authentication mechanisms supported by the server. To use Kerberos, specify the computer name as the remote destination. Also verify that the client computer and the destination computer are joined to a domain. To use Basic, specify the computer name as the remote destination, specify Basic authentication and provide user name and password. Possible authentication mechanisms reported by server: For more information, see the about_Remote_Troubleshooting Help topic.