From 42ce614e86b3deb4c7bc0860b0760985bfc8ec6f Mon Sep 17 00:00:00 2001 From: stvnmbr1 Date: Wed, 12 May 2021 15:39:58 +0200 Subject: [PATCH 01/12] Update MSFT_EXOManagementRole.schema.mof Edit parameter description so it reflects code execution. When "updating" a management role, the role is first deleted and recreated. At this point deployments break if Parent=Null --- .../MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof index b53c20527a..7cd190a60d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof @@ -2,7 +2,7 @@ class MSFT_EXOManagementRole : OMI_BaseResource { [Key, Description("The Name parameter specifies the name of the role. The maximum length of the name is 64 characters.")] String Name; - [Write, Description("The Parent parameter specifies the identity of the role to copy.")] String Parent; + [Write, Description("The Parent parameter specifies the identity of the role to copy. Mandatory for management role creation/update or when Ensure=Present. Non-mandatory for Ensure=Absent")] String Parent; [Write, Description("The Description parameter specifies the description that's displayed when the management role is viewed using the Get-ManagementRole cmdlet.")] String Description; [Write, Description("Specify if the Management Role should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; [Write, Description("Credentials of the Exchange Global Admin"), EmbeddedInstance("MSFT_Credential")] string GlobalAdminAccount; From 22403af5d549c68a654accc6761bbd3824a5e6f8 Mon Sep 17 00:00:00 2001 From: stvnmbr1 Date: Wed, 19 May 2021 09:04:22 +0200 Subject: [PATCH 02/12] Update MSFT_EXOManagementRole.psm1 add Mandatory to Parent var --- .../MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 index d6254d63ae..dc3038e6a3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource [System.String] $Name, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Parent, From 47020c118e23e770d6f696d5b63882ad0d2fb9f9 Mon Sep 17 00:00:00 2001 From: stvnmbr1 Date: Wed, 19 May 2021 09:05:50 +0200 Subject: [PATCH 03/12] Update MSFT_EXOManagementRole.schema.mof add key --- .../MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof index 7cd190a60d..cc0da587bc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.schema.mof @@ -2,7 +2,7 @@ class MSFT_EXOManagementRole : OMI_BaseResource { [Key, Description("The Name parameter specifies the name of the role. The maximum length of the name is 64 characters.")] String Name; - [Write, Description("The Parent parameter specifies the identity of the role to copy. Mandatory for management role creation/update or when Ensure=Present. Non-mandatory for Ensure=Absent")] String Parent; + [Key, Description("The Parent parameter specifies the identity of the role to copy. Mandatory for management role creation/update or when Ensure=Present. Non-mandatory for Ensure=Absent")] String Parent; [Write, Description("The Description parameter specifies the description that's displayed when the management role is viewed using the Get-ManagementRole cmdlet.")] String Description; [Write, Description("Specify if the Management Role should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; [Write, Description("Credentials of the Exchange Global Admin"), EmbeddedInstance("MSFT_Credential")] string GlobalAdminAccount; From c7f30d9b9bc17cf6c2545b3bf7c51feba630da94 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Thu, 27 May 2021 13:31:50 -0400 Subject: [PATCH 04/12] Teams Fix --- CHANGELOG.md | 1 + .../MSFT_TeamsCallingPolicy.psm1 | 1 + .../MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 | 1 + .../MSFT_TeamsChannelTab.psm1 | 1 + .../MSFT_TeamsChannelsPolicy.psm1 | 1 + .../MSFT_TeamsClientConfiguration.psm1 | 5 +++++ .../MSFT_TeamsEmergencyCallRoutingPolicy.psm1 | 1 + .../MSFT_TeamsEmergencyCallingPolicy.psm1 | 1 + .../MSFT_TeamsGuestCallingConfiguration.psm1 | 4 ++++ .../MSFT_TeamsGuestMeetingConfiguration.psm1 | 4 ++++ .../MSFT_TeamsGuestMessagingConfiguration.psm1 | 5 +++++ .../MSFT_TeamsMeetingBroadcastConfiguration.psm1 | 5 +++++ .../MSFT_TeamsMeetingBroadcastPolicy.psm1 | 1 + .../MSFT_TeamsMeetingConfiguration.psm1 | 5 +++++ .../MSFT_TeamsMeetingPolicy.psm1 | 1 + .../MSFT_TeamsMessagingPolicy.psm1 | 1 + .../MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 | 1 + .../MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 | 1 + .../MSFT_TeamsTenantDialPlan.psm1 | 1 + .../MSFT_TeamsUpgradeConfiguration.psm1 | 5 +++++ .../MSFT_TeamsUpgradePolicy.psm1 | 1 + .../MSFT_TeamsUser/MSFT_TeamsUser.psm1 | 1 + .../MSFT_TeamsVoiceRoute.psm1 | 1 + .../MSFT_TeamsVoiceRoutingPolicy.psm1 | 1 + .../Microsoft365DSC/Modules/M365DSCReverse.psm1 | 15 +++++++++++++++ 25 files changed, 65 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa22bea8e2..12e464c0d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Change log for Microsoft365DSC + 1.21.526.2 * EXOSafeAttachmentRule * Fixed issue #1213 Policy X already has rule Y associated with it diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 index e3bd26a88c..7d6c2cb975 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsCallingPolicy/MSFT_TeamsCallingPolicy.psm1 @@ -484,6 +484,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 index 3a87fb0b81..d5530c2b15 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 @@ -411,6 +411,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 index e0abbc38b6..6626835038 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelTab/MSFT_TeamsChannelTab.psm1 @@ -548,6 +548,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 index 85d7d11b7d..bfb7057f30 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannelsPolicy/MSFT_TeamsChannelsPolicy.psm1 @@ -294,6 +294,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 index 39dac221d7..61d98c3c6f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsClientConfiguration/MSFT_TeamsClientConfiguration.psm1 @@ -366,6 +366,10 @@ function Export-TargetResource [System.Management.Automation.PSCredential] $GlobalAdminAccount ) + + $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` + -InboundParameters $PSBoundParameters + #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") $data = [System.Collections.Generic.Dictionary[[String], [String]]]::new() @@ -398,6 +402,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 index 912a1e3834..202efecc48 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallRoutingPolicy/MSFT_TeamsEmergencyCallRoutingPolicy.psm1 @@ -348,6 +348,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 index eea2100da5..d955463c43 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsEmergencyCallingPolicy/MSFT_TeamsEmergencyCallingPolicy.psm1 @@ -330,6 +330,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 index 709741df13..e991f4edb0 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestCallingConfiguration/MSFT_TeamsGuestCallingConfiguration.psm1 @@ -173,6 +173,9 @@ function Export-TargetResource [System.Management.Automation.PSCredential] $GlobalAdminAccount ) + $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` + -InboundParameters $PSBoundParameters + #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") $data = [System.Collections.Generic.Dictionary[[String], [String]]]::new() @@ -206,6 +209,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 index b4d7c70664..4c1817f6d2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMeetingConfiguration/MSFT_TeamsGuestMeetingConfiguration.psm1 @@ -198,6 +198,9 @@ function Export-TargetResource [System.Management.Automation.PSCredential] $GlobalAdminAccount ) + $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` + -InboundParameters $PSBoundParameters + #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") $data = [System.Collections.Generic.Dictionary[[String], [String]]]::new() @@ -230,6 +233,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 index 82f871441b..2cc1544ff2 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsGuestMessagingConfiguration/MSFT_TeamsGuestMessagingConfiguration.psm1 @@ -277,6 +277,10 @@ function Export-TargetResource [System.Management.Automation.PSCredential] $GlobalAdminAccount ) + + $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` + -InboundParameters $PSBoundParameters + #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") $data = [System.Collections.Generic.Dictionary[[String], [String]]]::new() @@ -309,6 +313,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 index 5f0790607a..f4e045ac9a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastConfiguration/MSFT_TeamsMeetingBroadcastConfiguration.psm1 @@ -238,6 +238,10 @@ function Export-TargetResource [System.Management.Automation.PSCredential] $GlobalAdminAccount ) + + $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` + -InboundParameters $PSBoundParameters + #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") $data = [System.Collections.Generic.Dictionary[[String], [String]]]::new() @@ -275,6 +279,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 index 62596df921..6b5d5d0cbc 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingBroadcastPolicy/MSFT_TeamsMeetingBroadcastPolicy.psm1 @@ -306,6 +306,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 index d853fe5122..489fc311d4 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingConfiguration/MSFT_TeamsMeetingConfiguration.psm1 @@ -332,6 +332,10 @@ function Export-TargetResource [System.Management.Automation.PSCredential] $GlobalAdminAccount ) + + $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` + -InboundParameters $PSBoundParameters + #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") $data = [System.Collections.Generic.Dictionary[[String], [String]]]::new() @@ -364,6 +368,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 index 0f1113fff1..9138b15899 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 @@ -832,6 +832,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 index eef660328c..0da32d28b3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMessagingPolicy/MSFT_TeamsMessagingPolicy.psm1 @@ -500,6 +500,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 index 74eb668a97..72158118cb 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsPstnUsage/MSFT_TeamsPstnUsage.psm1 @@ -246,6 +246,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 index cfa3a1758e..7c9de81f91 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 @@ -733,6 +733,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 index 8bc6a084d4..c4272c7fd6 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTenantDialPlan/MSFT_TeamsTenantDialPlan.psm1 @@ -450,6 +450,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 index 7b41584e14..c725aabcd4 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradeConfiguration/MSFT_TeamsUpgradeConfiguration.psm1 @@ -183,6 +183,10 @@ function Export-TargetResource [System.Management.Automation.PSCredential] $GlobalAdminAccount ) + + $ConnectionMode = New-M365DSCConnection -Platform 'MicrosoftTeams' ` + -InboundParameters $PSBoundParameters + #region Telemetry $ResourceName = $MyInvocation.MyCommand.ModuleName.Replace("MSFT_", "") $data = [System.Collections.Generic.Dictionary[[String], [String]]]::new() @@ -215,6 +219,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 index 5b075d7981..2ae01196cf 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 @@ -245,6 +245,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 index fa13d2cca8..1b616b93ad 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 @@ -551,6 +551,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 index c568853229..3617e33a73 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoute/MSFT_TeamsVoiceRoute.psm1 @@ -347,6 +347,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 index 8f0df48384..0bc4286689 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsVoiceRoutingPolicy/MSFT_TeamsVoiceRoutingPolicy.psm1 @@ -288,6 +288,7 @@ function Export-TargetResource } catch { + Write-Host $Global:M365DSCEmojiRedX try { Write-Verbose -Message $_ diff --git a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 index ff15299e72..1a8b6ab1a6 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 @@ -563,6 +563,21 @@ function Start-M365DSCConfigurationExtract Write-Host "}" #endregion + $sessions = Get-PSSession | Where-Object -FilterScript {$_.Name -like "SfBPowerShellSessionViaTeamsModule_*" -or ` + $_.Name -like "ExchangeOnlineInternalSession*"} + foreach ($session in $sessions) + { + try + { + Write-Verbose -Message "Closing PSSession {$($session.Name)}" + Remove-PSSession $session | Out-Null + } + catch + { + Write-Verbose -Message $_ + } + } + $shouldOpenOutputDirectory = !$Quiet #region Prompt the user for a location to save the extract and generate the files if ([System.String]::IsNullOrEmpty($Path)) From 84a08bbf66c32d8d6c78db8e206c8c1b24500fa4 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Thu, 27 May 2021 13:37:19 -0400 Subject: [PATCH 05/12] Update Microsoft365DSC.psd1 --- Modules/Microsoft365DSC/Microsoft365DSC.psd1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 index 227b4d17a6..bce6f2e4dd 100644 --- a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 +++ b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 2021-05-26 +# Generated on: 2021-05-27 @{ @@ -11,7 +11,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '1.21.526.2' + ModuleVersion = '1.21.526.3' # Supported PSEditions # CompatiblePSEditions = @() @@ -93,7 +93,7 @@ }, @{ ModuleName = "MSCloudLoginAssistant" - RequiredVersion = "1.0.52" + RequiredVersion = "1.0.53" }, @{ ModuleName = "PnP.PowerShell" From 970073f82fdc6cb7f0edfe9393ddd037fd6c5dcf Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Mon, 31 May 2021 08:45:11 -0400 Subject: [PATCH 06/12] Fixes to AADMSGroup --- .../MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 | 45 ++++++++++--------- .../MSFT_AADMSGroup.schema.mof | 2 +- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 index 4b4caee65c..01806b1aec 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 @@ -8,6 +8,10 @@ function Get-TargetResource [System.String] $DisplayName, + [Parameter(Mandatory = $true)] + [System.String] + $MailNickname, + [Parameter()] [System.String] $Id, @@ -41,10 +45,6 @@ function Get-TargetResource [System.Boolean] $IsAssignableToRole, - [Parameter()] - [System.String] - $MailNickname, - [Parameter()] [ValidateSet('Public', 'Private', 'HiddenMembership')] [System.String] @@ -184,6 +184,10 @@ function Set-TargetResource [System.String] $DisplayName, + [Parameter(Mandatory = $true)] + [System.String] + $MailNickname, + [Parameter()] [System.String] $Id, @@ -217,10 +221,6 @@ function Set-TargetResource [System.Boolean] $IsAssignableToRole, - [Parameter()] - [System.String] - $MailNickname, - [Parameter()] [ValidateSet('Public', 'Private', 'HiddenMembership')] [System.String] @@ -259,15 +259,17 @@ function Set-TargetResource Add-M365DSCTelemetryEvent -Data $data #endregion - $currentGroup = Get-TargetResource @PSBoundParameters $currentParameters = $PSBoundParameters - $currentParameters.Remove("ApplicationId") - $currentParameters.Remove("TenantId") - $currentParameters.Remove("CertificateThumbprint") - $currentParameters.Remove("GlobalAdminAccount") - $currentParameters.Remove("Ensure") - - if ($Ensure -eq 'Present' -and $GroupTypes.Contains("Unified") -and $MailEnabled -eq $false) + $currentGroup = Get-TargetResource @PSBoundParameters + $currentParameters.Remove("ApplicationId") | Out-Null + $currentParameters.Remove("TenantId") | Out-Null + $currentParameters.Remove("CertificateThumbprint") | Out-Null + $currentParameters.Remove("GlobalAdminAccount") | Out-Null + $currentParameters.Remove("Ensure") | Out-Null + + if ($Ensure -eq 'Present' -and ` + ($null -ne $GroupTypes -and $GroupTypes.Contains("Unified")) -and ` + ($null -ne $MailEnabled -and $MailEnabled -eq $false)) { Write-Verbose -Message "Cannot set mailenabled to false if GroupTypes is set to Unified when creating group." throw "Cannot set mailenabled to false if GroupTypes is set to Unified when creating a group." @@ -275,8 +277,10 @@ function Set-TargetResource if ($Ensure -eq 'Present' -and $currentGroup.Ensure -eq 'Present') { + Write-Verbose -Message "Group {$DisplayName} exists and it should." try { + Write-Verbose -Message "Updating settings by ID for group {$DisplayName}" if ($true -eq $currentParameters.ContainsKey("IsAssignableToRole")) { Write-Verbose -Message "Cannot set IsAssignableToRole once group is created." @@ -288,6 +292,7 @@ function Set-TargetResource } else { + Write-Verbose -Message "Updating settings for group {$DisplayName}" Set-AzureADMSGroup @currentParameters } } @@ -333,6 +338,10 @@ function Test-TargetResource [System.String] $DisplayName, + [Parameter(Mandatory = $true)] + [System.String] + $MailNickname, + [Parameter()] [System.String] $Id, @@ -366,10 +375,6 @@ function Test-TargetResource [System.Boolean] $IsAssignableToRole, - [Parameter()] - [System.String] - $MailNickname, - [Parameter()] [ValidateSet('Public', 'Private', 'HiddenMembership')] [System.String] diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.schema.mof index 3a58b93ff5..adafab3828 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.schema.mof @@ -2,6 +2,7 @@ class MSFT_AADMSGroup : OMI_BaseResource { [Key, Description("DisplayName of the AADMS Group")] String DisplayName; + [Key, Description("Specifies a mail nickname for the group.")] String MailNickname; [Write, Description("Specifies a description for the group.")] String Description; [Write, Description("Specifies an ID for the group.")] String Id; [Write, Description("Specifies that the group is a dynamic group. To create a dynamic group, specify a value of DynamicMembership.")] String GroupTypes[]; @@ -10,7 +11,6 @@ class MSFT_AADMSGroup : OMI_BaseResource [Write, Description("Specifies whether the group is security enabled. For security groups, this value must be $True.")] Boolean SecurityEnabled; [Write, Description("Specifies whether this group is mail enabled. Currently, you cannot create mail enabled groups in Azure AD.")] Boolean MailEnabled; [Write, Description("Specifies whether this group can be assigned a role. Only available when creating a group and can't be modified after group is created.")] Boolean IsAssignableToRole; - [Write, Description("Specifies a mail nickname for the group. If MailEnabled is $False you must still specify a mail nickname.")] String MailNickname; [Write, Description("This parameter determines the visibility of the group's content and members list."), ValueMap{"Public","Private","HiddenMembership"}, Values{"Public","Private","HiddenMembership"}] String Visibility; [Write, Description("Specify if the Azure AD Group should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; [Write, Description("Credentials of the Azure Active Directory Admin"), EmbeddedInstance("MSFT_Credential")] String GlobalAdminAccount; From a191c5e121f0da211504ab2469c437aff487071a Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Tue, 1 Jun 2021 08:15:44 -0400 Subject: [PATCH 07/12] Fix --- CHANGELOG.md | 13 ++++++++++--- .../MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 | 8 ++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12e464c0d7..3e645a5d21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Change log for Microsoft365DSC -1.21.526.2 +# 1.21.602.1 + +* TeamsChannel + * Fixed an issue where content was dedup and boolean + values were appended to the exported content; + +# 1.21.526.2 + * EXOSafeAttachmentRule * Fixed issue #1213 Policy X already has rule Y associated with it if rule exists already @@ -15,7 +22,7 @@ * EXOTransportRule * Fix #1230 Changed ExceptIfSenderInRecipientList to array -1.21.519.2 +# 1.21.519.2 * AzureADRoleDefinition * Fix an issue where deprecated roles were not increasing @@ -31,7 +38,7 @@ * Forces a Global load of the new MicrosoftTeams module for Teams resources; -1.21.519.1 +#1.21.519.1 * TeamsClientConfiguration * Fixed an issue where the RestrictedSenderList was not properly diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 index d5530c2b15..0062bb8d48 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsChannel/MSFT_TeamsChannel.psm1 @@ -383,15 +383,15 @@ function Export-TargetResource if ($ConnectionMode -eq 'Credential') { $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $result.Remove("ApplicationId") - $result.Remove("TenantId") - $result.Remove("CertificateThumbprint") + $result.Remove("ApplicationId") | Out-Null + $result.Remove("TenantId") | Out-Null + $result.Remove("CertificateThumbprint") | Out-Null } else { $result.Remove("GlobalAdminAccount") } - $currentDSCBlock += " TeamsChannel " + (New-Guid).ToString() + "`r`n" + $currentDSCBlock = " TeamsChannel " + (New-Guid).ToString() + "`r`n" $currentDSCBlock += " {`r`n" $content = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot if ($ConnectionMode -eq 'Credential') From 151f0ed2340d3c7eedf244b5af91c6b92643a18c Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 2 Jun 2021 09:40:32 -0400 Subject: [PATCH 08/12] Several Fixes for Export --- CHANGELOG.md | 7 +++++ .../MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 | 1 + .../MSFT_EXOTransportRule.psm1 | 5 ++++ .../MSFT_SPOSiteScript.psm1 | 8 ++++++ .../MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 | 8 +++--- .../MSFT_TeamsUpgradePolicy.psm1 | 10 ++++++- .../MSFT_TeamsUser/MSFT_TeamsUser.psm1 | 28 +++++++++---------- .../Modules/M365DSCReverse.psm1 | 5 ++-- 8 files changed, 51 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e645a5d21..c5c2af8206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,16 @@ # 1.21.602.1 +* AADMSGroups + * Fix for the export where the MailNickName was being prompted; * TeamsChannel * Fixed an issue where content was dedup and boolean values were appended to the exported content; +* TeamsUpgradePolicy + * Improved performance retrieving users assigned to policy; +* MISC + * Fix for Teams authentication. Improvements on session + reuse. # 1.21.526.2 diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 index 01806b1aec..122796762a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADMSGroup/MSFT_AADMSGroup.psm1 @@ -478,6 +478,7 @@ function Export-TargetResource $Params = @{ GlobalAdminAccount = $GlobalAdminAccount DisplayName = $group.DisplayName + MailNickName = $group.MailNickName Id = $group.Id ApplicationId = $ApplicationId TenantId = $TenantId diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 index 3dab3af3ff..f648a51cc3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 @@ -2523,6 +2523,10 @@ function Export-TargetResource [array]$AllTransportRules = Get-TransportRule $dscContent = "" $i = 1 + if ($AllTransportRules.Length -eq 0) + { + Write-Host $Global:M365DSCEmojiGreenCheckMark + } foreach ($TransportRule in $AllTransportRules) { Write-Host " |---[$i/$($AllTransportRules.Count)] $($TransportRule.Name)" -NoNewline @@ -2555,6 +2559,7 @@ function Export-TargetResource { try { + Write-Host $Global:M365DSCEmojiRedX Write-Verbose -Message $_ $tenantIdValue = "" if (-not [System.String]::IsNullOrEmpty($TenantId)) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 index 1921abf610..9d3c3a8328 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSiteScript/MSFT_SPOSiteScript.psm1 @@ -428,6 +428,14 @@ function Export-TargetResource { [array]$siteScripts = Get-PnPSiteScript -ErrorAction Stop + if ($siteScripts.Length -eq 0) + { + Write-Host $Global:M365DSCEmojiGreenCheckMark + } + else + { + Write-Host "`r`n" -NoNewline + } foreach ($script in $siteScripts) { Write-Host " [$i/$($siteScripts.Length)] $($script.Title)" diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 index 7c9de81f91..ac60e781b0 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsTeam/MSFT_TeamsTeam.psm1 @@ -701,21 +701,21 @@ function Export-TargetResource $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" } - $result.Remove("GroupID") + $result.Remove("GroupID") | Out-Null if ("" -eq $result.Owner) { - $result.Remove("Owner") + $result.Remove("Owner") | Out-Null } $currentDSCBlock = " TeamsTeam " + (New-Guid).ToString() + "`r`n" $currentDSCBlock += " {`r`n" $content = Get-DSCBlock -Params $result -ModulePath $PSScriptRoot if ($ConnectionMode -eq 'Credential') { - $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "GlobalAdminAccount" + $currentDSCBlock += Convert-DSCStringParamToVariable -DSCBlock $content -ParameterName "GlobalAdminAccount" } else { - $currentDSCBlock = $content + $currentDSCBlock += $content } $currentDSCBlock += " }`r`n" if ($currentDSCBlock.ToLower().Contains("@" + $organization.ToLower())) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 index 2ae01196cf..1a4a497676 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 @@ -40,7 +40,15 @@ function Get-TargetResource { $policy = Get-CsTeamsUpgradePolicy -Identity $Identity ` -ErrorAction SilentlyContinue - [array]$users = Get-CsOnlineUser | Where-Object -Filter { $_.TeamsUpgradePolicy -eq $Identity } + + try + { + [array]$users = Get-CsOnlineUser -Filter "TeamsUpgradePolicy -eq '$Identity'" + } + catch + { + [array]$users = Get-CsOnlineUser | Where-Object -Filter { $_.TeamsUpgradePolicy -eq $Identity } + } if ($null -eq $policy) { diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 index 1b616b93ad..095ae4ca79 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUser/MSFT_TeamsUser.psm1 @@ -184,13 +184,13 @@ function Set-TargetResource Write-Verbose -Message "Retrieve team GroupId: $($team.GroupId)" $CurrentParameters = $PSBoundParameters - $CurrentParameters.Remove("TeamName") + $CurrentParameters.Remove("TeamName") | Out-Null $CurrentParameters.Add("GroupId", $team.GroupId) - $CurrentParameters.Remove("GlobalAdminAccount") - $CurrentParameters.Remove("ApplicationId") - $CurrentParameters.Remove("TenantId") - $CurrentParameters.Remove("CertificateThumbprint") - $CurrentParameters.Remove("Ensure") + $CurrentParameters.Remove("GlobalAdminAccount") | Out-Null + $CurrentParameters.Remove("ApplicationId") | Out-Null + $CurrentParameters.Remove("TenantId") | Out-Null + $CurrentParameters.Remove("CertificateThumbprint") | Out-Null + $CurrentParameters.Remove("Ensure") | Out-Null if ($Ensure -eq "Present") { @@ -201,7 +201,7 @@ function Set-TargetResource { if ($Role -eq "Member" -and $CurrentParameters.ContainsKey("Role")) { - $CurrentParameters.Remove("Role") + $CurrentParameters.Remove("Role") | Out-Null Write-Verbose -Message "Removed role parameter" } Remove-TeamUser @CurrentParameters @@ -265,7 +265,7 @@ function Test-TargetResource if ($null -eq $Role) { - $CurrentValues.Remove("Role") + $CurrentValues.Remove("Role") | Out-Null } Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)" @@ -452,13 +452,13 @@ function Export-TargetResource if ($ConnectionMode -eq 'Credential') { $result.GlobalAdminAccount = Resolve-Credentials -UserName "globaladmin" - $result.Remove("ApplicationId") - $result.Remove("TenantId") - $result.Remove("CertificateThumbprint") + $result.Remove("ApplicationId") | Out-Null + $result.Remove("TenantId") | Out-Null + $result.Remove("CertificateThumbprint") | Out-Null } else { - $result.Remove("GlobalAdminAccount") + $result.Remove("GlobalAdminAccount") | Out-Null } $currentDSCBlock = " TeamsUser " + (New-Guid).ToString() + "`r`n" $currentDSCBlock += " {`r`n" @@ -521,12 +521,12 @@ function Export-TargetResource { $partialResult = Receive-Job -Name $job.name $result += $partialResult - Remove-Job -Name $job.name + Remove-Job -Name $job.name | Out-Null $jobsCompleted++ } elseif ($job.JobStateInfo.State -eq 'Failed') { - Remove-Job -Name $job.name + Remove-Job -Name $job.name | Out-Null Write-Warning "{$($job.name)} failed" break } diff --git a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 index 1a8b6ab1a6..5914dd6bda 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 @@ -435,7 +435,8 @@ function Start-M365DSCConfigurationExtract ($ComponentsToExtract -contains $resourceName -or $ComponentsToExtract -contains ("chck" + $resourceName))) -or $AllComponents -or ` ($null -eq $ComponentsToExtract -and $null -eq $Workloads) -and ` - ($ComponentsToExtractSpecified -or -not $ComponentsToSkip.Contains($resourceName))) + ($ComponentsToExtractSpecified -or -not $ComponentsToSkip.Contains($resourceName)) -and ` + $resourcesNotSupported -notcontains $ResourceModule.Name.Split('.')[0].Replace('MSFT_', '')) { $ResourcesToExport += $ResourceModule } @@ -491,7 +492,7 @@ function Start-M365DSCConfigurationExtract { $parameters.Add("CertificatePassword", $CertificatePassword) } - if ($ComponentsToSkip -notcontains $resourceName) + if ($ComponentsToSkip -notcontains $resource.Name.Split('.')[0].Replace('MSFT_', '')) { Write-Host "[$i/$($ResourcesToExport.Length)] Extracting [$($resource.Name.Split('.')[0].Replace('MSFT_', ''))]..." -NoNewline $exportString = "" From 13a69ca331da45e954220fb8a6d5b335f534e2ee Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 2 Jun 2021 12:29:36 -0400 Subject: [PATCH 09/12] Fixes for unit tests --- .../MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 | 4 +++- Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 index 7a524f2ff9..a6e27aff0d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRole/MSFT_EXOManagementRole.psm1 @@ -357,7 +357,7 @@ function Export-TargetResource try { - [array]$AllManagementRoles = Get-ManagementRole -ErrorAction Stop + [array]$AllManagementRoles = Get-ManagementRole | Where-Object -FilterScript {$_.Parent -ne $null} $dscContent = "" @@ -382,6 +382,7 @@ function Export-TargetResource CertificateThumbprint = $CertificateThumbprint CertificatePassword = $CertificatePassword CertificatePath = $CertificatePath + Parent = $ManagementRole.Parent } $Results = Get-TargetResource @Params $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` @@ -403,6 +404,7 @@ function Export-TargetResource { try { + Write-Host $Global:M365DSCEmojiRedX Write-Verbose -Message $_ $tenantIdValue = "" if (-not [System.String]::IsNullOrEmpty($TenantId)) diff --git a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 index 5914dd6bda..ca24dc8a37 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 @@ -104,11 +104,11 @@ function Start-M365DSCConfigurationExtract } $ComponentsToSkip = @() - if ($Mode -eq 'Default') + if ($Mode -eq 'Default' -and $null -eq $ComponentsToExtract) { $ComponentsToSkip = $Global:FullComponents } - elseif ($Mode -eq 'Lite') + elseif ($Mode -eq 'Lite' -and $null -eq $ComponentsToExtract) { $ComponentsToSkip = $Global:DefaultComponents + $Global:FullComponents } From ce3eb7619e92f1edda6a4709e38dab85fa6ecc25 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 2 Jun 2021 14:18:21 -0400 Subject: [PATCH 10/12] Update Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 --- .../Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 index 0f5aa4da47..6149dfb01c 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 @@ -72,7 +72,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-CsTeamsUpgradePolicy -MockWith { return @{ - Identity = 'Islands' + Identity = 'Test Policy' Description = 'This is a configuration drift' NotifySfBUsers = $false } @@ -80,7 +80,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-CsOnlineUser -MockWith { return @{ - UserPrincipalName = 'John.Smith@contoso.onmicrosoft.com' + UserPrincipalName = 'Bob.Houle@contoso.onmicrosoft.com' TeamsUpgradePolicy = "Global" } } @@ -96,7 +96,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } - Context -Name "When the policy already exsits and IS in the Desired State" -Fixture { + Context -Name "When the policy already exists and IS in the Desired State" -Fixture { BeforeAll { $testParams = @{ Identity = 'Islands' From 364ecd88c206e4a91da5826fc0fdccd2bc504758 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 2 Jun 2021 14:49:25 -0400 Subject: [PATCH 11/12] Release 1.21.602.1 --- CHANGELOG.md | 2 ++ Modules/Microsoft365DSC/Microsoft365DSC.psd1 | 23 ++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e645a5d21..dcd83d9bfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # 1.21.602.1 +* EXOManagementRole + * BREAKING: Now requires the Parent property as Mandatory; * TeamsChannel * Fixed an issue where content was dedup and boolean values were appended to the exported content; diff --git a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 index bce6f2e4dd..07b94974a1 100644 --- a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 +++ b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 2021-05-27 +# Generated on: 2021-06-02 @{ @@ -11,7 +11,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '1.21.526.3' + ModuleVersion = '1.21.602.1' # Supported PSEditions # CompatiblePSEditions = @() @@ -177,20 +177,11 @@ IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true' # ReleaseNotes of this module - ReleaseNotes = " - * EXOSafeAttachmentRule - * Fixed issue #1213 Policy X already has rule Y associated with it - if rule exists already - * MSFT_IntuneDeviceCompliancePolicyAndroid - * New resource - * MSFT_IntuneDeviceCompliancePolicyAndroidWorkProfile - * New resource - * MSFT_IntuneDeviceCompliancePolicyMacOS - * New resource - * MSFT_IntuneDeviceCompliancePolicyiOs - * New resource - * EXOTransportRule - * Fix #1230 Changed ExceptIfSenderInRecipientList to array" + ReleaseNotes = "* EXOManagementRole + * BREAKING: Now requires the Parent property as Mandatory; + * TeamsChannel + * Fixed an issue where content was dedup and boolean + values were appended to the exported content;" # Flag to indicate whether the module requires explicit user acceptance for install/update # RequireLicenseAcceptance = $false From 8c1655d607d9f94fe349057037d204b08ecbe63d Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Wed, 2 Jun 2021 14:50:41 -0400 Subject: [PATCH 12/12] Update Microsoft365DSC.psd1 --- Modules/Microsoft365DSC/Microsoft365DSC.psd1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 index 07b94974a1..4e37f2fa84 100644 --- a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 +++ b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 @@ -177,11 +177,18 @@ IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true' # ReleaseNotes of this module - ReleaseNotes = "* EXOManagementRole + ReleaseNotes = "* AADMSGroups + * Fix for the export where the MailNickName was being prompted; + * EXOManagementRole * BREAKING: Now requires the Parent property as Mandatory; * TeamsChannel * Fixed an issue where content was dedup and boolean - values were appended to the exported content;" + values were appended to the exported content; + * TeamsUpgradePolicy + * Improved performance retrieving users assigned to policy; + * MISC + * Fix for Teams authentication. Improvements on session + reuse." # Flag to indicate whether the module requires explicit user acceptance for install/update # RequireLicenseAcceptance = $false