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

%3CLINGO-SUB%20id%3D%22lingo-sub-1800093%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20Microsoft%20Teams%20Protection%20PowerShell%20in%20Microsoft%20365%20organization%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1800093%22%20slang%3D%22en-US%22%3E%3CP%3EThere%20is%20none.%20Exchange%2FSfB%20use%20PowerShell%20remoting%2C%20Teams%20uses%20direct%20calls%20against%20the%20Graph%20API%20endpoints%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fteams-api-overview%3Fview%3Dgraph-rest-1.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fteams-api-overview%3Fview%3Dgraph-rest-1.0%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1801903%22%20slang%3D%22zh-CN%22%3ERe%3A%20What%20is%20the%20Microsoft%20Teams%20Protection%20PowerShell%20in%20Microsoft%20365%20organization%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1801903%22%20slang%3D%22zh-CN%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev.%3C%2FA%3E%26nbsp%3B%20But%20i%20need%20to%20Manage%20the%20Policies%20about%20The%20Microsoft%20Teams%2C%20the%20%3CSPAN%3EGraph%20API%20don't%20have%20any%20api%20set%20team%20Policies.So%20i%20need%20to%20user%20Power%20shell%20remote%20host.%20The%20Policies%20Set%20Power%20shell%20cmdlet%20is%20on%20the%20SFB%20power%20shell%20site.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_1603241975383.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228188i383B049F98B4AA4F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_1603241975383.png%22%20alt%3D%22Corporate%20WeChat%20screenshots.%201603241975383.png.%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eand%20only%20a%20little%20cmdlet%20on%20the%20Teams%20power%20shell%20site.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_1603242003894.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228189i1D99A10DCC1F4A35%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_1603242003894.png%22%20alt%3D%22Corporate%20WeChat%20Screenshots%20.%20.%20.%201603242003894.png.%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1798594%22%20slang%3D%22en-US%22%3EWhat%20is%20the%20Microsoft%20Teams%20Protection%20PowerShell%20in%20Microsoft%20365%20organization%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1798594%22%20slang%3D%22en-US%22%3E%3CP%3EExchange%20Online%20Protection%20PowerShell%20has%20a%20url%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fps.protection.outlook.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fps.protection.outlook.com%2F%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-pscommand%22%3Epowershell-liveid%3C%2FSPAN%3E%3CSPAN%3E%2F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20or%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fps.protection.outlook.de%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fps.protection.outlook.de%2F%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-pscommand%22%3Epowershell-liveid%3C%2FSPAN%3E%3CSPAN%3E%2F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20i%20want%20to%20user%20power%20shell%20by%20remote%20host%2Ci%20can%60t%20find%20any%26nbsp%3BProtection%20PowerShell%20url%20which%20can%20work%20success%20in%20Microsoft%20Teams.%3C%2FP%3E%3CP%3EI%20need%20the%20url%20to%20start%20code%20in%20c%23%20project%26nbsp%3B%20with%26nbsp%3BSystem.Management.Automation.Runspaces.WSManConnectionInfo(remoteUrl%2CshellUrl%2Ccredential)%3B%3C%2FP%3E%3CP%3EPlease%20help%20me%20to%20fix%20it.Thanks%20a%20lot~%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1798594%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHow-to%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1802346%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20Microsoft%20Teams%20Protection%20PowerShell%20in%20Microsoft%20365%20organization%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1802346%22%20slang%3D%22en-US%22%3E%3CP%3EPolicies%20are%20managed%20via%20SfB%20cmdlets%2C%20no%20need%20for%20anything%20Teams%20PowerSHell%20related%20there.%20If%20you%20want%20to%20establish%20a%20session%20outside%20of%20the%20module%2C%20use%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fadmin0e.online.lync.com%2FOcsPowershellOAuth%3FAdminDomain%3Dtenant.onmicrosoft.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fadmin0e.online.lync.com%2FOcsPowershellOAuth%3FAdminDomain%3Dtenant.onmicrosoft.com%3C%2FA%3E%26nbsp%3Bendpoint%2C%20or%20the%20newer%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fapi.interfaces.records.teams.microsoft.com%2FOcsPowershellOAuth%2Fadmin0e.online.lync.com%3FAdminDomain%3Ddomain.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fapi.interfaces.records.teams.microsoft.com%2FOcsPowershellOAuth%2Fadmin0e.online.lync.com%3FAdminDomain%3Ddomain.com%3C%2FA%3E%26nbsp%3Bone.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1806553%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20Microsoft%20Teams%20Protection%20PowerShell%20in%20Microsoft%20365%20organization%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1806553%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EWSManConnectionInfo%20connectionInfo%20%3D%20new%20WSManConnectionInfo(%0A%20%20%20%20new%20Uri(%22https%3A%2F%2Fadmin0e.online.lync.com%2FOcsPowershellOAuth%3F%20%0A%20%20%20%20AdminDomain%3Dtenant.onmicrosoft.com%22)%2C%0A%20%20%20%20%22http%3A%2F%2Fschemas.microsoft.com%2Fpowershell%2FMicrosoft.Teams%22%2C%0A%20%20%20%20TeamPSHelper.credential)%0A%7B%0A%20%20%20%20AuthenticationMechanism%20%3D%20AuthenticationMechanism.Basic%2C%0A%20%20%20%20SkipCACheck%20%3D%20true%2C%0A%20%20%20%20SkipCNCheck%20%3D%20true%2C%0A%20%20%20%20MaximumConnectionRedirectionCount%20%3D%204%0A%7D%3B%0Ausing%20(var%20runspace%20%3D%20RunspaceFactory.CreateRunspace(connectionInfo))%0A%7B%0A%20%20%20%20runspace.Open()%3B%20%20%20%2F%2F%20throw%20error%20at%20here%20!!!!!!!!!%0A%0A%20%20%20%20var%20result%20%3D%20TeamPSHelper.ConnectTeamSessionCmdlet(runspace)%3B%0A%0A%20%20%20%20%2F%2FTeamPSHelper.GetTeamSettingsCmdlet(runspace)%3B%0A%0A%20%20%20%20TeamPSHelper.DisconnectTeamSessionCmdlet(runspace)%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3EI%20use%20this%20url%20to%20create%20runspace%2Cbut%20return%20error.Please%20help%20me%20to%20have%20a%20look%20error%2Cwhy%20be%20error%3Fthe%20url%20%22%3CA%20href%3D%22https%3A%2F%2Fadmin0e.online.lync.com%2FOcsPowershellOAuth%3FAdminDomain%3Dtenant.onmicrosoft.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fadmin0e.online.lync.com%2FOcsPowershellOAuth%3FAdminDomain%3Dtenant.onmicrosoft.com%3C%2FA%3E%22%20or%20%22%3CA%20href%3D%22https%3A%2F%2Fapi.interfaces.records.teams.microsoft.com%2FOcsPowershellOAuth%2Fadmin0e.online.lync.com%3FAdminDomain%3Ddomain.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fapi.interfaces.records.teams.microsoft.com%2FOcsPowershellOAuth%2Fadmin0e.online.lync.com%3FAdminDomain%3Ddomain.com%3C%2FA%3E%22%20is%20invalid%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional 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.