Home

Connect-MicrosoftTeams Errors

%3CLINGO-SUB%20id%3D%22lingo-sub-153067%22%20slang%3D%22en-US%22%3EConnect-MicrosoftTeams%20Errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-153067%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20powershell%20script%20that%20automatically%20creates%20a%20group%20when%20someone%20creates%20a%20SharePoint%20list%20item.%26nbsp%3B%20Now%2C%20I%20want%20to%20set%20it%20up%20to%20create%20a%20Team%20instead.%20I'm%20running%20the%20following%20code%20trying%20to%20connect%20to%20Microsoft%20Teams%20with%20the%20new%20MicrosoftTeams%20powershell%20module.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%24username%20%3D%20'myuser%40mydomain.com'%3B%0A%24pwdContents%20%3D%20*****%0A%24securePassword%20%3D%20%20convertto-securestring(%24pwdContents)%20-key%20(1..16)%3B%0A%24credential%20%3D%20New-Object%20System.Management.Automation.PSCredential(%24username%2C%20%24securePassword)%0A%0AConnect-MicrosoftTeams%20-AccountId%20%24username%20-Credential%20%24credential%3B%3C%2FPRE%3E%0A%3CP%3EI'm%20getting%20this%20error%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EConnect-MicrosoftTeams%20%3A%20One%20or%20more%20errors%20occurred.%3A%20AADSTS75005%3A%20The%20request%20is%20not%20a%20valid%20SAML%202.0%20protocol%0Amessage.%0ATrace%20ID%3A%2082a820ba-19de-4cf2-87f4-61c21d8d3100%0ACorrelation%20ID%3A%2007667e10-a183-4dc3-8b21-8cf79b172f3e%0ATimestamp%3A%202018-02-06%2020%3A33%3A18Z%0AAt%20line%3A1%20char%3A5%0A%2B%20%20%20%20%20Connect-MicrosoftTeams%20-Credential%20%24credential%3B%0A%2B%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20AuthenticationError%3A%20(%3A)%20%5BConnect-MicrosoftTeams%5D%2C%20AadAuthenticationFailedException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20Connect-MicrosoftTeams%2CMicrosoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams%0A%0AConnect-MicrosoftTeams%20%3A%20One%20or%20more%20errors%20occurred.%0AAt%20line%3A1%20char%3A5%0A%2B%20%20%20%20%20Connect-MicrosoftTeams%20-Credential%20%24credential%3B%0A%2B%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20AuthenticationError%3A%20(%3A)%20%5BConnect-MicrosoftTeams%5D%2C%20AggregateException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20Connect-MicrosoftTeams%2CMicrosoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams%0A%0AConnect-MicrosoftTeams%20%3A%20AADSTS75005%3A%20The%20request%20is%20not%20a%20valid%20SAML%202.0%20protocol%20message.%0ATrace%20ID%3A%2082a820ba-19de-4cf2-87f4-61c21d8d3100%0ACorrelation%20ID%3A%2007667e10-a183-4dc3-8b21-8cf79b172f3e%0ATimestamp%3A%202018-02-06%2020%3A33%3A18Z%0AAt%20line%3A1%20char%3A5%0A%2B%20%20%20%20%20Connect-MicrosoftTeams%20-Credential%20%24credential%3B%0A%2B%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20AuthenticationError%3A%20(%3A)%20%5BConnect-MicrosoftTeams%5D%2C%20AdalServiceException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20Connect-MicrosoftTeams%2CMicrosoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams%0A%0AConnect-MicrosoftTeams%20%3A%20%20Response%20status%20code%20does%20not%20indicate%20success%3A%20400%20(BadRequest).%0AAt%20line%3A1%20char%3A5%0A%2B%20%20%20%20%20Connect-MicrosoftTeams%20-Credential%20%24credential%3B%0A%2B%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20AuthenticationError%3A%20(%3A)%20%5BConnect-MicrosoftTeams%5D%2C%20HttpRequestException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20Connect-MicrosoftTeams%2CMicrosoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams%0A%0AConnect-MicrosoftTeams%20%3A%20%7B%22error%22%3A%22invalid_request%22%2C%22error_description%22%3A%22AADSTS75005%3A%20The%20request%20is%20not%20a%20valid%20SAML%0A2.0%20protocol%20message.%5Cr%5CnTrace%20ID%3A%2082a820ba-19de-4cf2-87f4-61c21d8d3100%5Cr%5CnCorrelation%20ID%3A%0A07667e10-a183-4dc3-8b21-8cf79b172f3e%5Cr%5CnTimestamp%3A%202018-02-06%2020%3A33%3A18Z%22%2C%22error_codes%22%3A%5B75005%5D%2C%22timestamp%22%3A%222018-02-06%0A20%3A33%3A18Z%22%2C%22trace_id%22%3A%2282a820ba-19de-4cf2-87f4-61c21d8d3100%22%2C%22correlation_id%22%3A%2207667e10-a183-4dc3-8b21-8cf79b172f3e%22%7D%0AAt%20line%3A1%20char%3A5%0A%2B%20%20%20%20%20Connect-MicrosoftTeams%20-Credential%20%24credential%3B%0A%2B%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20AuthenticationError%3A%20(%3A)%20%5BConnect-MicrosoftTeams%5D%2C%20Exception%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20Connect-MicrosoftTeams%2CMicrosoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams%0A%0AConnect-MicrosoftTeams%20%3A%20One%20or%20more%20errors%20occurred.%3A%20AADSTS75005%3A%20The%20request%20is%20not%20a%20valid%20SAML%202.0%20protocol%0Amessage.%0ATrace%20ID%3A%2082a820ba-19de-4cf2-87f4-61c21d8d3100%0ACorrelation%20ID%3A%2007667e10-a183-4dc3-8b21-8cf79b172f3e%0ATimestamp%3A%202018-02-06%2020%3A33%3A18Z%0AAt%20line%3A1%20char%3A5%0A%2B%20%20%20%20%20Connect-MicrosoftTeams%20-Credential%20%24credential%3B%0A%2B%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20NotSpecified%3A%20(%3A)%20%5BConnect-MicrosoftTeams%5D%2C%20AadAuthenticationFailedException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.Open.Teams.CommonLibrary.AadAuthenticationFailedException%2CMicrosoft.Open.Teams%0A%20%20%20.CommonLibrary.ConnectMicrosoftTeams%3C%2FPRE%3E%0A%3CP%3EI've%20also%20tried%20using%20an%20access%20token%2C%20which%20appears%20to%20get%20me%20connected%20but%20none%20of%20the%20subsequent%20commands%20work.%3C%2FP%3E%0A%3CPRE%3E%24appid%20%3D%20%22xxxxxxx%22%3B%0A%24client_secret%20%3D%20%22xxxxxx%22%3B%0A%24tenant_id%20%3D%20%22xxxxxx%22%3B%0A%24resource%20%3D%20%22https%3A%2F%2Fgraph.microsoft.com%22%3B%0A%0A%24username%20%3D%20'myusername%40mydomain.com'%0A%24conn%20%3D%20connect-pnpmicrosoftgraph%20-AppId%20%24appid%20-AppSecret%20%24client_secret%20-AADDomain%20%22huroncg.onmicrosoft.com%22%20-Verbose%3B%0A%24access_token%20%3D%20Get-PnPAccessToken%3B%0AConnect-MicrosoftTeams%20-AccountId%20%24username%20-AadAccessToken%20%24access_token%3B%3C%2FPRE%3E%0A%3CP%3EWhen%20I%20do%20this%2C%20the%20connection%20appears%20to%20work%2C%20but%20when%20I%20run%20something%20like%20get-team%2C%20I%20get%20the%20dreaded%20'Object%20not%20set%20to%20an%20instance%20of%20an%20object%20error'%3C%2FP%3E%0A%3CPRE%3EPS%20%26gt%3B%20get-team%0Aget-team%20%3A%20Object%20reference%20not%20set%20to%20an%20instance%20of%20an%20object.%0AAt%20line%3A1%20char%3A1%0A%2B%20get-team%0A%2B%20~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20NotSpecified%3A%20(%3A)%20%5BGet-Team%5D%2C%20NullReferenceException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20System.NullReferenceException%2CMicrosoft.TeamsCmdlets.PowerShell.Custom.GetTeam%3C%2FPRE%3E%0A%3CP%3EWhat%20am%20I%20doing%20wrong%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-153067%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-390182%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-MicrosoftTeams%20Errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390182%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F73968%22%20target%3D%22_blank%22%3E%40Robbert%20van%20Andel%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EHave%20you%20tried%3F%3CBR%20%2F%3E%3CSTRONG%3E%3CFONT%3EConnect-MicrosoftTeams%20-AccountId%20%24userEmail%20-MsAccessToken%20%24token%20-AadAccessToken%20%24token%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3EJust%20give%20in%20the%20token%20everywhere%20you%20can%20%3A)%3C%2Fimg%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAfter%20that%2C%20I%20can%20call%20Get-Team%20and%20get%20a%20list%20of%20all%20Teams...%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-158701%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-MicrosoftTeams%20Errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-158701%22%20slang%3D%22en-US%22%3E%3CP%3EMore%20specifically%2C%20can%20anyone%20confirm%20if%20the%20entire%20protocol%20needs%20to%20be%20SAML%202.0%2C%20or%20just%20the%20token%3F%26nbsp%3B%20Since%20PowerShell%20seems%20to%20be%20using%20the%20WS-Trust%20flow%20for%20Teams%2C%20would%20changing%20the%20token%20to%20SAML%202.0%20(it%20defaults%20to%201.0)%20be%20sufficient%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-155525%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-MicrosoftTeams%20Errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-155525%22%20slang%3D%22en-US%22%3E%3CP%3EI%20ended%20up%20opening%20a%20ticket%20with%20Microsoft.%26nbsp%3B%20It%20turns%20out%20that%20my%20organization's%20Ping%20sign%20in%20system%20doesn't%20support%20SAML%202.0%2C%20which%20the%20Teams%20PowerShell%20API%20requires.%26nbsp%3B%20We%20will%20need%20to%20upgrade%20to%20be%20able%20to%20do%20what%20I'm%20attempting%20to%20do.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-153406%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-MicrosoftTeams%20Errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-153406%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20running%20version%200.9.1.%26nbsp%3B%20I%20can%20do%20connect-microsoftteams%20and%20that%20works%20but%20I'm%20working%20on%20an%20unattended%20script%2C%20so%20leaving%20connect-microsoftteams%20with%20no%20credentials%20won't%20be%20an%20option.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-153181%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-MicrosoftTeams%20Errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-153181%22%20slang%3D%22en-US%22%3E%3CP%3EI%20think%20the%20problem%20is%20that%20you%20are%20trying%20to%20do%20both%20accountid%20and%20credentials.%3C%2FP%3E%0A%3CP%3Ehave%20you%20tried%20only%20just%20to%20run%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EConnect-MicrosoftTeams%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3Band%20are%20you%20running%20the%200.9.1%20commands%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Robbert van Andel
Occasional Contributor

I have a powershell script that automatically creates a group when someone creates a SharePoint list item.  Now, I want to set it up to create a Team instead. I'm running the following code trying to connect to Microsoft Teams with the new MicrosoftTeams powershell module. 

 

$username = 'myuser@mydomain.com';
$pwdContents = *****
$securePassword =  convertto-securestring($pwdContents) -key (1..16);
$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)

Connect-MicrosoftTeams -AccountId $username -Credential $credential;

I'm getting this error

 

 

Connect-MicrosoftTeams : One or more errors occurred.: AADSTS75005: The request is not a valid SAML 2.0 protocol
message.
Trace ID: 82a820ba-19de-4cf2-87f4-61c21d8d3100
Correlation ID: 07667e10-a183-4dc3-8b21-8cf79b172f3e
Timestamp: 2018-02-06 20:33:18Z
At line:1 char:5
+     Connect-MicrosoftTeams -Credential $credential;
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Connect-MicrosoftTeams], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Connect-MicrosoftTeams,Microsoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams

Connect-MicrosoftTeams : One or more errors occurred.
At line:1 char:5
+     Connect-MicrosoftTeams -Credential $credential;
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Connect-MicrosoftTeams], AggregateException
    + FullyQualifiedErrorId : Connect-MicrosoftTeams,Microsoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams

Connect-MicrosoftTeams : AADSTS75005: The request is not a valid SAML 2.0 protocol message.
Trace ID: 82a820ba-19de-4cf2-87f4-61c21d8d3100
Correlation ID: 07667e10-a183-4dc3-8b21-8cf79b172f3e
Timestamp: 2018-02-06 20:33:18Z
At line:1 char:5
+     Connect-MicrosoftTeams -Credential $credential;
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Connect-MicrosoftTeams], AdalServiceException
    + FullyQualifiedErrorId : Connect-MicrosoftTeams,Microsoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams

Connect-MicrosoftTeams :  Response status code does not indicate success: 400 (BadRequest).
At line:1 char:5
+     Connect-MicrosoftTeams -Credential $credential;
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Connect-MicrosoftTeams], HttpRequestException
    + FullyQualifiedErrorId : Connect-MicrosoftTeams,Microsoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams

Connect-MicrosoftTeams : {"error":"invalid_request","error_description":"AADSTS75005: The request is not a valid SAML
2.0 protocol message.\r\nTrace ID: 82a820ba-19de-4cf2-87f4-61c21d8d3100\r\nCorrelation ID:
07667e10-a183-4dc3-8b21-8cf79b172f3e\r\nTimestamp: 2018-02-06 20:33:18Z","error_codes":[75005],"timestamp":"2018-02-06
20:33:18Z","trace_id":"82a820ba-19de-4cf2-87f4-61c21d8d3100","correlation_id":"07667e10-a183-4dc3-8b21-8cf79b172f3e"}
At line:1 char:5
+     Connect-MicrosoftTeams -Credential $credential;
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Connect-MicrosoftTeams], Exception
    + FullyQualifiedErrorId : Connect-MicrosoftTeams,Microsoft.Open.Teams.CommonLibrary.ConnectMicrosoftTeams

Connect-MicrosoftTeams : One or more errors occurred.: AADSTS75005: The request is not a valid SAML 2.0 protocol
message.
Trace ID: 82a820ba-19de-4cf2-87f4-61c21d8d3100
Correlation ID: 07667e10-a183-4dc3-8b21-8cf79b172f3e
Timestamp: 2018-02-06 20:33:18Z
At line:1 char:5
+     Connect-MicrosoftTeams -Credential $credential;
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-MicrosoftTeams], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Microsoft.Open.Teams.CommonLibrary.AadAuthenticationFailedException,Microsoft.Open.Teams
   .CommonLibrary.ConnectMicrosoftTeams

I've also tried using an access token, which appears to get me connected but none of the subsequent commands work.

$appid = "xxxxxxx";
$client_secret = "xxxxxx";
$tenant_id = "xxxxxx";
$resource = "https://graph.microsoft.com";

$username = 'myusername@mydomain.com'
$conn = connect-pnpmicrosoftgraph -AppId $appid -AppSecret $client_secret -AADDomain "huroncg.onmicrosoft.com" -Verbose;
$access_token = Get-PnPAccessToken;
Connect-MicrosoftTeams -AccountId $username -AadAccessToken $access_token;

When I do this, the connection appears to work, but when I run something like get-team, I get the dreaded 'Object not set to an instance of an object error'

PS > get-team
get-team : Object reference not set to an instance of an object.
At line:1 char:1
+ get-team
+ ~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Team], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.TeamsCmdlets.PowerShell.Custom.GetTeam

What am I doing wrong?

 

 

5 Replies

I think the problem is that you are trying to do both accountid and credentials.

have you tried only just to run 

Connect-MicrosoftTeams

 and are you running the 0.9.1 commands?

Highlighted

Yes, running version 0.9.1.  I can do connect-microsoftteams and that works but I'm working on an unattended script, so leaving connect-microsoftteams with no credentials won't be an option.

I ended up opening a ticket with Microsoft.  It turns out that my organization's Ping sign in system doesn't support SAML 2.0, which the Teams PowerShell API requires.  We will need to upgrade to be able to do what I'm attempting to do.

More specifically, can anyone confirm if the entire protocol needs to be SAML 2.0, or just the token?  Since PowerShell seems to be using the WS-Trust flow for Teams, would changing the token to SAML 2.0 (it defaults to 1.0) be sufficient?

@Robbert van Andel 

Have you tried?
Connect-MicrosoftTeams -AccountId $userEmail -MsAccessToken $token -AadAccessToken $token

Just give in the token everywhere you can :)

After that, I can call Get-Team and get a list of all Teams...

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies