TeamsTeam: No Errors Showing in Resource on Failure
Description of the issue
When you run the TeamsTeam resource, errors can occur but they don't appear in the normal output, the verbose output or in the error field in (Get-DscConfigurationStatus).ResourcesNotInDesiredState.
There is currently an issue creating new Teams from scratch (#4383) in which the required M365 Group is not created. This should throw an exception in the command and ideally terminate as it can't continue without it. But it doesn't, you can see in the verbose output: Adding Owner {} to Group {}. Both Owner and Group should have values but the script was unable to Create / find them, which should mean it cannot continue and it should inform the user that this is why it failed..
I've looked in the module and I can't see anything obvious which is ignoring errors. I also tried to put a throw command into the TeamsTeam Module next to the New-MgGroup command in hopes that would report the error, but it has not... I'm wondering if this is something specific to DSC / M365DSC that I'm unaware of and hopefully is a simple fix? Running the same commands outside of DSC throws a terminating error as expected.
Any help would be appreciated and can work on a PR if anyone knows what would need changing.
Microsoft 365 DSC Version
1.24.221.1
Which workloads are affected
Teams
The DSC configuration
Configuration Teams
{
param (
)
$OrganizationName = $ConfigurationData.NonNodeData.OrganizationName
Import-DscResource -ModuleName 'Microsoft365DSC'
Node localhost
{
TeamsTeam 'TechOps' {
DisplayName = "TestTeam1"
Description = "Team for Testing"
Visibility = "Private"
MailNickName = "TestTeam1"
Owner = @("[email protected]")
Ensure = "Present"
TenantId = $OrganizationName;
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
}
}
}
Teams -ConfigurationData .\ConfigurationData.psd1
Verbose logs showing the problem
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. VERBOSE: An LCM method call arrived from computer LAPTOP-JIM8LRGT with user sid S-1-12-1-3228587383-1342040634-78774695-3344876676. VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ Start Set ] VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ Start Resource ] [[TeamsTeam]TestTeam1] VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ Start Test ] [[TeamsTeam]TestTeam1] VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Testing configuration of Team TestTeam1 VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Getting configuration of Team TestTeam1 VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Checking for existence of Team TestTeam1 VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] GroupID was NOT specified VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Done performing authorization VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Executing Get-Team for parameters GroupId: , User: , Archived: , Visibility: , DisplayName: TestTeam1, MailNickName: VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Retrieving groups list VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Done retrieving groups, getting team properties VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Done processing Get-Team VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Teams with displayname TestTeam1 doesn't exist VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Current Values: ApplicationId=*** CertificateThumbprint=*** Description=Team for Testing DisplayName=TestTeam1 Ensure=Absent MailNickName=TestTeam1 Owner=([email protected]) TenantId=*** Verbose=True Visibility=Private VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Target Values: ApplicationId=*** CertificateThumbprint=***
Description=Team for Testing
DisplayName=TestTeam1
Ensure=Present
MailNickName=TestTeam1
Owner=([email protected])
TenantId=***
Verbose=True
Visibility=Private
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Test-TargetResource returned False
VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ End Test ] [[TeamsTeam]TestTeam1] in 0.5010 seconds.
VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ Start Set ] [[TeamsTeam]TestTeam1]
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Setting configuration of Team TestTeam1
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Getting configuration of Team TestTeam1
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Checking for existence of Team TestTeam1
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] GroupID was NOT specified
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Done performing authorization
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Executing Get-Team for parameters GroupId:
, User: , Archived: , Visibility: , DisplayName: TestTeam1, MailNickName:
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Retrieving groups list
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Done retrieving groups, getting team
properties
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Done processing Get-Team
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Teams with displayname TestTeam1 doesn't
exist
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Creating team TestTeam1
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Connection mode:
ServicePrincipalWithThumbprint
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Retrieving Group Owner {}
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Adding Owner {} to Group {}
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Adding Owner - Sleeping for 15 seconds
VERBOSE: [LAPTOP-JIM8LRGT]: [[TeamsTeam]TestTeam1] Creating Team - Sleeping for 15 seconds
VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ End Set ] [[TeamsTeam]TestTeam1] in 30.7390 seconds.
VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ End Resource ] [[TeamsTeam]TestTeam1]
VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ End Set ]
VERBOSE: [LAPTOP-JIM8LRGT]: LCM: [ End Set ] in 31.3260 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 31.391 seconds
Environment Information + PowerShell Version
OsName : Microsoft Windows 10 Business
OsOperatingSystemSKU : 48
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-GB
OsMuiLanguages : {en-GB, en-US, ja-JP}