Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TeamsTeam: w/o owners -> incomplete export ("Cannot index into a null array") #3759

Closed
Fuerst2718 opened this issue Oct 6, 2023 · 0 comments · Fixed by #3865 or #3871
Closed

TeamsTeam: w/o owners -> incomplete export ("Cannot index into a null array") #3759

Fuerst2718 opened this issue Oct 6, 2023 · 0 comments · Fixed by #3865 or #3871
Labels
Bug Something isn't working Teams

Comments

@Fuerst2718
Copy link

Description of the issue

If a TeamsTeam has no owners (may happen if all the owner-accounts are removed from Azure-AD), during the export an errormessage is generated and the data exported for the ownerless team are incomplete (Names/identifiers below anonymized)

Team “TeamWithOutOwner” (the one without an owner)

PS C:\Users\anon\AppData\Local\Temp> Get-TeamUser -GroupId $((Get-TeamByName "TeamWithOutOwner").GroupId)|select UserId,Role

UserId                               Role  
------                               ----  
bb403152-1718-4592-ba15-c31f06f78aff member
c914768e-0207-4b1a-acd7-a9ea5d4d5d00 member
…

Members of Team “TeamWithOwner” (another one with an owner)

PS C:\Users\anon\AppData\Local\Temp> Get-TeamUser -GroupId $((Get-TeamByName "TeamWithOwner").GroupId)|select UserId,Role

UserId                               Role  
------                               ----  
00d3e00e-e962-406f-afff-882e36ad2b72 owner 
e800e0d1-1663-41ec-b3b4-98099ee0fd77 member
7cab7a56-7e3f-4d6c-a4d0-24961fc63cb4 member
…

Members of "TeamWithOutOwner"

PS C:\Users\anon\AppData\Local\Temp> Get-TeamUser -GroupId $((Get-TeamByName "TeamWithOutOwner").GroupId)|select UserId,Role

UserId                               Role  
------                               ----  
bb403152-1718-4592-ba15-c31f06f78aff member
c914768e-0207-4b1a-acd7-a9ea5d4d5d00 member
83435055-f13c-44b5-abbc-6db97175265c member
1cf2c031-252c-4ea7-8ae6-c85457ddc390 member
d48acd34-0905-4e45-8604-c9a11c5179a3 member
fc24784d-0406-4138-8ddb-bf69534251d7 member

Output from the exported file (ownerless team only 4 properties)

…
        TeamsTeam "TeamsTeam-TeamWithOutOwner"
        {
            Credential           = $Credscredential;
            DisplayName          = "TeamWithOutOwner";
            Ensure               = "Absent";
            GroupID              = "af9d3806-7ee3-4369-bcc5-3eae4a826c51";
        }
        TeamsTeam "TeamsTeam-TeamWithOwner"
        {
            AllowAddRemoveApps                = $True;
            AllowChannelMentions              = $True;
            AllowCreateUpdateChannels         = $True;
            AllowCreateUpdateRemoveConnectors = $True;
            AllowCreateUpdateRemoveTabs       = $True;
            AllowCustomMemes                  = $True;
            AllowDeleteChannels               = $True;
            AllowGiphy                        = $True;
            AllowGuestCreateUpdateChannels    = $False;
            AllowGuestDeleteChannels          = $False;
            AllowOwnerDeleteMessages          = $True;
            AllowStickersAndMemes             = $True;
            AllowTeamMentions                 = $True;
            AllowUserDeleteMessages           = $True;
            AllowUserEditMessages             = $True;
            Credential                        = $Credscredential;
            Description                       = "TeamWithOwner";
            DisplayName                       = "TeamWithOwner";
            Ensure                            = "Present";
            GiphyContentRating                = "moderate";
            GroupID                           = "bd54bd6a-a2ae-4052-9632-ad74389a466d";
            MailNickName                      = "teamswithowner";
            Owner                             = "[email protected]";
            ShowInTeamsSearchAndSuggestions   = $False;
            Visibility                        = "Private";
        } 

…

Message regarding entry in the Error Log

    |---[97/133] MD´s Teams Group✅
    |---[98/133] TeamWithOutOwner Error Log created at {file://C:/Users/anon/AppData/Local/Temp/6524-M365DSC-ErrorLog.log}
✅
    |---[99/133] TeamWithOwner✅

The corresponding message in the log is

[2023-10-05 10:48:53]
{InvalidOperation}
System.Management.Automation.RuntimeException: Cannot index into a null array.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at Get-TargetResource(Closure , FunctionContext )
"Error retrieving data:"
at Get-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1004.1\DSCResources\MSFT_TeamsTeam\MSFT_TeamsTeam.psm1: line 179
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1004.1\DSCResources\MSFT_TeamsTeam\MSFT_TeamsTeam.psm1: line 701
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1004.1\modules\M365DSCReverse.psm1: line 615
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1004.1\modules\M365DSCUtil.psm1: line 1312
at ExportM365DSCConfiguration, C:\Scripts\M365\e.ps1: line 344
at <ScriptBlock>, C:\Scripts\M365\e.ps1: line 774
[email protected]
TenantId: company.onmicrosoft.com

Microsoft 365 DSC Version

1.23.1004.1

Which workloads are affected

Teams

The DSC configuration

No response

Verbose logs showing the problem

No response

Environment Information + PowerShell Version

OsName               : Microsoft Windows Server 2016 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 14393.4825.amd64fre.rs1_release.211202-1611
OsLanguage           : en-US
OsMuiLanguages       : {en-US, de-DE}

Key   : PSVersion
Value : 5.1.14393.4583
Name  : PSVersion

Key   : PSEdition
Value : Desktop
Name  : PSEdition

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name  : PSCompatibleVersions

Key   : BuildVersion
Value : 10.0.14393.4583
Name  : BuildVersion

Key   : CLRVersion
Value : 4.0.30319.42000
Name  : CLRVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion
@andikrueger andikrueger added Bug Something isn't working Teams labels Oct 6, 2023
@desmay desmay mentioned this issue Oct 6, 2023
@andikrueger andikrueger linked a pull request Oct 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Teams
Projects
None yet
2 participants