Set-Team Inconsistent Errors/Authorization

%3CLINGO-SUB%20id%3D%22lingo-sub-1383144%22%20slang%3D%22en-US%22%3ESet-Team%20Inconsistent%20Errors%2FAuthorization%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1383144%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20write%20some%20powershell%20to%20manage%20Teams.%26nbsp%3B%20I%20am%20using%20the%20latest%201.0.6%20MicrosoftTeams%20module%2C%20updated%20just%20now%20to%20see%20if%20it%20would%20resolve%20my%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%2C%20if%20I%20run%20this%20and%20then%20run%20the%20second%20line%20over%20and%20over%2C%20it%20will%20succeed%20and%20randomly%20fail%20and%20then%20succeed%20again.%26nbsp%3B%20It%20isn't%20this%20property%20in%20particular%3B%20I%20am%20working%20on%20a%20script%20with%208%20different%20allow%20properties%20and%20each%20run%20a%20different%20one%20or%20two%20will%20fail%20but%20on%20the%20next%20run%20they%20work%20and%20other%20lines%20fail.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24groupid%20%3D%20(Get-Team%20-DisplayName%20'CA-IT-Test').groupid%3C%2FP%3E%3CP%3ESet-Team%20-GroupID%20%24groupid%20-AllowCreateUpdateRemoveTabs%20%24false%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETypical%20error%20message%3A%3C%2FP%3E%3CP%3ESet-Team%20%3A%20Error%20occurred%20while%20executing%3CBR%20%2F%3ECode%3A%20Unauthorized%3CBR%20%2F%3EMessage%3A%20Unauthorized%3CBR%20%2F%3EInnerError%3A%3CBR%20%2F%3ERequestId%3A%2073c502fd-9478-48fa-a0c9-2d08aca59e2e%3CBR%20%2F%3EDateTimeStamp%3A%202020-05-12T15%3A44%3A44%3CBR%20%2F%3EHttpStatusCode%3A%20Unauthorized%3CBR%20%2F%3EAt%20line%3A1%20char%3A1%3CBR%20%2F%3E%2B%20Set-Team%20-GroupID%20%24groupid%20-AllowCreateUpdateRemoveTabs%20%24false%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5BSet-Team%5D%2C%20ApiException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.TeamsCmdlets.PowerShell.Custom.ErrorHandling.ApiException%2CMicrosoft.TeamsCmdlets.PowerShell.Custom.SetTeam%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1383144%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Frequent Visitor

I am trying to write some powershell to manage Teams.  I am using the latest 1.0.6 MicrosoftTeams module, updated just now to see if it would resolve my issue.

 

For example, if I run this and then run the second line over and over, it will succeed and randomly fail and then succeed again.  It isn't this property in particular; I am working on a script with 8 different allow properties and each run a different one or two will fail but on the next run they work and other lines fail.

 

$groupid = (Get-Team -DisplayName 'CA-IT-Test').groupid

Set-Team -GroupID $groupid -AllowCreateUpdateRemoveTabs $false

 

Typical error message:

Set-Team : Error occurred while executing
Code: Unauthorized
Message: Unauthorized
InnerError:
RequestId: 73c502fd-9478-48fa-a0c9-2d08aca59e2e
DateTimeStamp: 2020-05-12T15:44:44
HttpStatusCode: Unauthorized
At line:1 char:1
+ Set-Team -GroupID $groupid -AllowCreateUpdateRemoveTabs $false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-Team], ApiException
+ FullyQualifiedErrorId : Microsoft.TeamsCmdlets.PowerShell.Custom.ErrorHandling.ApiException,Microsoft.TeamsCmdlets.PowerShell.Custom.SetTeam

0 Replies