I’ve noticed something new with PowerShell 7.4.4 and MicroSoftTeams Module 6.1.0+ and errors.
I’ve been writing and maintaining a PowerShell script that uses the MST PS Module to log in and manage certain aspects of the MST Tenant. This has been ongoing for several years now, and all’s right in the world. I handle all of the errors that the MST module throws with my own routines and log those to disk via my logging function. Recently, I’ve noticed a new addition: a Correlation ID being regurgitated with every error. For example, this command:
$script:sipDomains = (Get-CsTenant -ErrorAction SilentlyContinue -ErrorVariable myError ).SipDomain | Out-Null
$myError | Format-List -Force
when given a valid login to the MST tenant that does not have access to the Get-CsTenant command, generates this error:
Correlation id for this request : 6ddc5d19-6413-4aff-a78b-99946a33640c
Exception : Microsoft.Teams.ConfigAPI.Cmdlets.Generated.Runtime.RestException`1[Microsoft.Teams.ConfigAPI.Cmdlets.Generated.Mod
els.IApiError]: Access Denied.
TargetObject : { Select = , Defaultpropertyset = Extended }
CategoryInfo : InvalidOperation: ({ Select = , Defaul…rtyset = Extended }:<>f__AnonymousType67`2) [Get-CsTenant], RestException`1
FullyQualifiedErrorId : Forbidden,Microsoft.Teams.ConfigApi.Cmdlets.GetCsTenant
ErrorDetails : Access Denied.
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Get-CsTenantObou<Process>, C:UsersP1332365OneDrive -
OptusDocumentsPowerShellModulesMicrosoftTeams6.1.0internalMerged_internal.ps1: line 15927
at Get-CsTenantPoint<Process>, C:UsersP1332365OneDrive -
OptusDocumentsPowerShellModulesMicrosoftTeams6.1.0customMerged_custom_PsExt.ps1: line 2983
at Get-CsTenantPoint<Process>, C:UsersP1332365OneDrive -
OptusDocumentsPowerShellModulesMicrosoftTeams6.1.0exportsProxyCmdletDefinitionsWithHelp.ps1: line 44992
at Get-CsTenant<Process>, C:UsersP1332365OneDrive -
OptusDocumentsPowerShellModulesMicrosoftTeams6.1.0exportsProxyCmdletDefinitionsWithHelp.ps1: line 11327
at <ScriptBlock>, C:TempOptusPS_ToolsOMEGAomega.ps1: line 1017
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}
PSMessageDetails :
I can handle the error information; the Correlation ID, I can not suppress nor hide. It messes up the display of my script and makes a right sloppy mess of the screen overall.
Can anyone tell me anything about this? I believe it has something to do with logging and being able to use the GUID to look through maybe windows events or something, but I’m not really interested in that.
My ask here is how to block the display of the Correlation ID on an error from a PowerShell cmdlet