diff --git a/CHANGELOG.md b/CHANGELOG.md index 471ee31c64..713693878f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * O365OrgSettings * Added support for the PlannerAllowCalendarSharing property for Planner. * Added support for the Microsoft 365 installation options. + * Added support for the Viva Insights and Briefing email settings. * SCProtectionAlert * Prevents extracting system rules. FIXES [#3224](https://github.com/microsoft/Microsoft365DSC/issues/3224) @@ -115,7 +116,6 @@ * AADCrossTenantAccessPolicyConfigurationPartner * Initial release FIXES [#3253](https://github.com/microsoft/Microsoft365DSC/issues/3253) - * IntuneSettingCatalogCustomPolicyWindows10 * Initial release FIXES [#2692](https://github.com/microsoft/Microsoft365DSC/issues/2692), diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.psm1 index 0fe090c59b..a1599c4ae3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.psm1 @@ -21,6 +21,26 @@ function Get-TargetResource [System.Boolean] $PlannerAllowCalendarSharing, + [Parameter()] + [System.Boolean] + $MicrosoftVivaBriefingEmail, + + [Parameter()] + [System.Boolean] + $VivaInsightsWebExperience, + + [Parameter()] + [System.Boolean] + $VivaInsightsDigestEmail, + + [Parameter()] + [System.Boolean] + $VivaInsightsOutlookAddInAndInlineSuggestions, + + [Parameter()] + [System.Boolean] + $VivaInsightsScheduleSendSuggestions, + [Parameter()] [System.Boolean] $AdminCenterReportDisplayConcealedNames, @@ -77,6 +97,9 @@ function Get-TargetResource $ConnectionModeTasks = New-M365DSCConnection -Workload 'Tasks' ` -InboundParameters $PSBoundParameters + $ConnectionMode = New-M365DSCConnection -Workload 'ExchangeOnline' ` + -InboundParameters $PSBoundParameters + #Ensure the proper dependencies are installed in the current environment. Confirm-M365DSCDependencies @@ -104,6 +127,16 @@ function Get-TargetResource $CortanaId = '0a0a29f9-0a25-49c7-94bf-c53c3f8fa69d' $CortanaEnabledValue = Get-MgServicePrincipal -Filter "appId eq '$CortanaId'" -Property 'AccountEnabled' + # Microsoft Viva Briefing Email + $vivaBriefingEmailValue = $false + $currentBriefingConfig = Get-DefaultTenantBriefingConfig + if ($currentBriefingConfig.IsEnabledByDefault -eq 'opt-in') + { + $vivaBriefingEmailValue = $true + } + + # Viva Insightss settings + $currentVivaInsightsSettings = Get-DefaultTenantMyAnalyticsFeatureConfig $MRODeviceManagerService = 'ebe0c285-db95-403f-a1a3-a793bd6d7767' try { @@ -140,20 +173,25 @@ function Get-TargetResource } return @{ - IsSingleInstance = 'Yes' - CortanaEnabled = $CortanaEnabledValue.AccountEnabled - M365WebEnableUsersToOpenFilesFrom3PStorage = $M365WebEnableUsersToOpenFilesFrom3PStorageValue.AccountEnabled - PlannerAllowCalendarSharing = $PlannerSettings.allowCalendarSharing - AdminCenterReportDisplayConcealedNames = $AdminCenterReportDisplayConcealedNamesValue.displayConcealedNames - InstallationOptionsUpdateChannel = $installationOptions.updateChannel - InstallationOptionsAppsForWindows = $appsForWindowsValue - InstallationOptionsAppsForMac = $appsForMacValue - Credential = $Credential - ApplicationId = $ApplicationId - TenantId = $TenantId - ApplicationSecret = $ApplicationSecret - CertificateThumbprint = $CertificateThumbprint - Managedidentity = $ManagedIdentity.IsPresent + IsSingleInstance = 'Yes' + CortanaEnabled = $CortanaEnabledValue.AccountEnabled + PlannerAllowCalendarSharing = $PlannerSettings.allowCalendarSharing + AdminCenterReportDisplayConcealedNames = $AdminCenterReportDisplayConcealedNamesValue.displayConcealedNames + InstallationOptionsUpdateChannel = $installationOptions.updateChannel + InstallationOptionsAppsForWindows = $appsForWindowsValue + InstallationOptionsAppsForMac = $appsForMacValue + MicrosoftVivaBriefingEmail = $vivaBriefingEmailValue + M365WebEnableUsersToOpenFilesFrom3PStorage = $M365WebEnableUsersToOpenFilesFrom3PStorageValue.AccountEnabled + VivaInsightsWebExperience = $currentVivaInsightsSettings.IsDashboardEnabled + VivaInsightsDigestEmail = $currentVivaInsightsSettings.IsDigestEmailEnabled + VivaInsightsOutlookAddInAndInlineSuggestions = $currentVivaInsightsSettings.IsAddInEnabled + VivaInsightsScheduleSendSuggestions = $currentVivaInsightsSettings.IsScheduleSendEnabled + Credential = $Credential + ApplicationId = $ApplicationId + TenantId = $TenantId + ApplicationSecret = $ApplicationSecret + CertificateThumbprint = $CertificateThumbprint + Managedidentity = $ManagedIdentity.IsPresent } } catch @@ -190,6 +228,26 @@ function Set-TargetResource [System.Boolean] $PlannerAllowCalendarSharing, + [Parameter()] + [System.Boolean] + $MicrosoftVivaBriefingEmail, + + [Parameter()] + [System.Boolean] + $VivaInsightsWebExperience, + + [Parameter()] + [System.Boolean] + $VivaInsightsDigestEmail, + + [Parameter()] + [System.Boolean] + $VivaInsightsOutlookAddInAndInlineSuggestions, + + [Parameter()] + [System.Boolean] + $VivaInsightsScheduleSendSuggestions, + [Parameter()] [System.Boolean] $AdminCenterReportDisplayConcealedNames, @@ -283,6 +341,22 @@ function Set-TargetResource -AccountEnabled:$CortanaEnabled } + # Microsoft Viva Briefing Email + Write-Verbose -Message "Updating Microsoft Viva Briefing Email settings." + $briefingValue = 'opt-out' + if ($MicrosoftVivaBriefingEmail) + { + $briefingValue = 'opt-in' + } + Set-DefaultTenantBriefingConfig -PrivacyMode $briefingValue | Out-Null + + # Viva Insights + Write-Verbose -Message "Updating Viva Insights settings." + Set-DefaultTenantMyAnalyticsFeatureConfig -Feature "Dashboard" -IsEnabled $VivaInsightsWebExperience | Out-Null + Set-DefaultTenantMyAnalyticsFeatureConfig -Feature "Digest-email" -IsEnabled $VivaInsightsDigestEmail | Out-Null + Set-DefaultTenantMyAnalyticsFeatureConfig -Feature "Add-In" -IsEnabled $VivaInsightsOutlookAddInAndInlineSuggestions | Out-Null + Set-DefaultTenantMyAnalyticsFeatureConfig -Feature "Scheduled-send" -IsEnabled $VivaInsightsScheduleSendSuggestions | Out-Null + $AdminCenterReportDisplayConcealedNamesEnabled = Get-M365DSCOrgSettingsAdminCenterReport Write-Verbose "$($AdminCenterReportDisplayConcealedNamesEnabled.displayConcealedNames) = $AdminCenterReportDisplayConcealedNames" if ($AdminCenterReportDisplayConcealedNames -ne $AdminCenterReportDisplayConcealedNamesEnabled.displayConcealedNames) @@ -376,6 +450,26 @@ function Test-TargetResource [System.Boolean] $PlannerAllowCalendarSharing, + [Parameter()] + [System.Boolean] + $MicrosoftVivaBriefingEmail, + + [Parameter()] + [System.Boolean] + $VivaInsightsWebExperience, + + [Parameter()] + [System.Boolean] + $VivaInsightsDigestEmail, + + [Parameter()] + [System.Boolean] + $VivaInsightsOutlookAddInAndInlineSuggestions, + + [Parameter()] + [System.Boolean] + $VivaInsightsScheduleSendSuggestions, + [Parameter()] [System.Boolean] $AdminCenterReportDisplayConcealedNames, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.schema.mof index ffc41f5b35..d49b6d575c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365OrgSettings/MSFT_O365OrgSettings.schema.mof @@ -4,6 +4,11 @@ class MSFT_O365OrgSettings : OMI_BaseResource [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; [Write, Description("Allow Cortana in windows 10 (version 1909 and earlier), and the Cortana app on iOS and Android, to access Microsoft-hosted data on behalf of people in your organization.")] Boolean CortanaEnabled; [Write, Description("Let users open files stored in third-party storage services in Microsoft 365 on the Web.")] Boolean M365WebEnableUsersToOpenFilesFrom3PStorage; + [Write, Description("Specifies whether or not to let people in your organization receive Briefing email from Microsoft Viva.")] Boolean MicrosoftVivaBriefingEmail; + [Write, Description("Specifies whether or not to allow users to have access to use the Viva Insights web experience.")] Boolean VivaInsightsWebExperience; + [Write, Description("Specifies whether or not to allow users to have access to use the Viva Insights digest email feature.")] Boolean VivaInsightsDigestEmail; + [Write, Description("Specifies whether or not to allow users to have access to use the Viva Insights Outlook add-in and inline suggestions.")] Boolean VivaInsightsOutlookAddInAndInlineSuggestions; + [Write, Description("Specifies whether or not to allow users to have access to use the Viva Insights schedule send suggestions feature.")] Boolean VivaInsightsScheduleSendSuggestions; [Write, Description("Allow Planner users to publish their plans and assigned tasks to Outlook or other calendars through iCalendar feeds.")] Boolean PlannerAllowCalendarSharing; [Write, Description("Controls whether or not the Admin Center reports will conceale user, group and site names.")] Boolean AdminCenterReportDisplayConcealedNames; [Write, Description("Defines how often you want your users to get feature updates for Microsoft 365 apps installed on devices running Windows"), ValueMap{"current","monthlyEnterprise","semiAnnual"}, Values{"current","monthlyEnterprise","semiAnnual"}] String InstallationOptionsUpdateChannel; diff --git a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 index 5a78145f1d..92c0169c9e 100644 --- a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 +++ b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 @@ -6,7 +6,7 @@ }, @{ ModuleName = 'ExchangeOnlineManagement' - RequiredVersion = '3.1.0' + RequiredVersion = '3.2.0' }, @{ ModuleName = 'Microsoft.Graph.Applications' diff --git a/Modules/Microsoft365DSC/Modules/M365DSCStubsUtility.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCStubsUtility.psm1 index 238b81d440..0f130945e3 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCStubsUtility.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCStubsUtility.psm1 @@ -48,7 +48,8 @@ function New-M365DSCStubFiles if ($null -eq $Workloads) { $workloads = @( - @{Name = 'ExchangeOnline'; ModuleName = 'ExchangeOnlineManagement'; CommandName = 'Get-Mailbox' }, + @{Name = 'ExchangeOnline'; ModuleName = 'ExchangeOnlineManagement';}, # This is the main EXO module with new cmdlets. + @{Name = 'ExchangeOnline'; ModuleName = 'ExchangeOnlineManagement'; CommandName = 'Get-Mailbox' }, # This is the EXO Proxy @{Name = 'MicrosoftGraph'; ModuleName = 'Microsoft.Graph.Applications'; }, @{Name = 'MicrosoftGraph'; ModuleName = 'Microsoft.Graph.Authentication'; }, @{Name = 'MicrosoftGraph'; ModuleName = 'Microsoft.Graph.DeviceManagement'; }, @@ -207,20 +208,15 @@ function New-M365DSCStubFiles { $ParamType = 'PSObject' } - elseif ($ParamType.StartsWith('Microsoft.Teams.') -or ` - $ParamType.StartsWith("System.Management.Automation.PSListModifier``1[Microsoft.")) - { - $ParamType = 'PSObject' - } elseif ($ParamType.StartsWith('Microsoft.Rtc.')) { $ParamType = 'PSObject' } - elseif ($ParamType.StartsWith('Microsoft.SharePoint.') -or ` - $ParamType.StartsWith('Microsoft.Online') -or ` + elseif ($ParamType.StartsWith('Microsoft.') -or ` $ParamType.StartsWith('PnP.') -or ` $ParamType.StartsWith("System.Nullable``1[Microsoft.") -or ` - $ParamType.StartsWith("System.Nullable``1[PnP.")) + $ParamType.StartsWith("System.Nullable``1[PnP.") -or ` + $ParamType.StartsWith("System.Management.Automation.PSListModifier``1[Microsoft.")) { $ParamType = 'PSObject' } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgSettings.Tests.ps1 index 79c2f1f2b4..f64f1caad3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgSettings.Tests.ps1 @@ -39,6 +39,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MgServicePrincipal -MockWith { } + Mock -CommandName Set-DefaultTenantBriefingConfig -MockWith { + } + + Mock -CommandName Set-DefaultTenantMyAnalyticsFeatureConfig -MockWith { + } Mock -CommandName Invoke-MgGraphRequest -MockWith { return @{ "@odata.type" = "#microsoft.graph.adminReportSettings" @@ -80,6 +85,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { InstallationOptionsAppsForMac = @('isSkypeForBusinessEnabled', 'isMicrosoft365AppsEnabled') InstallationOptionsAppsForWindows = @('isVisioEnabled', 'isMicrosoft365AppsEnabled', 'isProjectEnabled') InstallationOptionsUpdateChannel = 'current' + MicrosoftVivaBriefingEmail = $True + VivaInsightsWebExperience = $true + VivaInsightsDigestEmail = $true + VivaInsightsOutlookAddInAndInlineSuggestions = $true + VivaInsightsScheduleSendSuggestions = $true PlannerAllowCalendarSharing = $False Credential = $Credential } @@ -89,6 +99,21 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AccountEnabled = $False } } + + Mock -CommandName Get-DefaultTenantBriefingConfig -MockWith { + return @{ + IsEnabledByDefault = 'opt-in' + } + } + + Mock -CommandName Get-DefaultTenantMyAnalyticsFeatureConfig -MockWith { + return @{ + IsDashboardEnabled = $true + IsDigestEmailEnabled = $true + IsAddInEnabled = $true + IsScheduleSendEnabled = $true + } + } } It 'Should return Present from the Get method' { @@ -104,10 +129,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'When Org Settings NOT in the Desired State' -Fixture { BeforeAll { $testParams = @{ - AdminCenterReportDisplayConcealedNames = $True; - IsSingleInstance = 'Yes' - M365WebEnableUsersToOpenFilesFrom3PStorage = $True; - Credential = $Credential + IsSingleInstance = 'Yes' + AdminCenterReportDisplayConcealedNames = $True; + M365WebEnableUsersToOpenFilesFrom3PStorage = $True + MicrosoftVivaBriefingEmail = $True + VivaInsightsWebExperience = $true + VivaInsightsDigestEmail = $true + VivaInsightsOutlookAddInAndInlineSuggestions = $true + VivaInsightsScheduleSendSuggestions = $true + Ensure = 'Present' + Credential = $Credential } Mock -CommandName Get-MgServicePrincipal -MockWith { @@ -115,6 +146,21 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AccountEnabled = $False } } + + Mock -CommandName Get-DefaultTenantBriefingConfig -MockWith { + return @{ + IsEnabledByDefault = 'opt-in' + } + } + + Mock -CommandName Get-DefaultTenantMyAnalyticsFeatureConfig -MockWith { + return @{ + IsDashboardEnabled = $true + IsDigestEmailEnabled = $true + IsAddInEnabled = $true + IsScheduleSendEnabled = $true + } + } } It 'Should return Present from the Get method' { @@ -145,6 +191,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AccountEnabled = $False } } + + Mock -CommandName Get-DefaultTenantBriefingConfig -MockWith { + return @{ + IsEnabledByDefault = 'opt-in' + } + } + + Mock -CommandName Get-DefaultTenantMyAnalyticsFeatureConfig -MockWith { + return @{ + IsDashboardEnabled = $true + IsDigestEmailEnabled = $true + IsAddInEnabled = $true + IsScheduleSendEnabled = $true + } + } + $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty } diff --git a/Tests/Unit/Stubs/Microsoft365.psm1 b/Tests/Unit/Stubs/Microsoft365.psm1 index 5451bac87d..00432d11b0 100644 --- a/Tests/Unit/Stubs/Microsoft365.psm1 +++ b/Tests/Unit/Stubs/Microsoft365.psm1 @@ -1,3 +1,62 @@ +#region ExchangeOnline +function Get-DefaultTenantBriefingConfig +{ + [CmdletBinding()] + param( + [Parameter()] + [PSObject] + $ResultSize + ) +} +function Get-DefaultTenantMyAnalyticsFeatureConfig +{ + [CmdletBinding()] + param( + [Parameter()] + [PSObject] + $ResultSize + ) +} +function Set-DefaultTenantBriefingConfig +{ + [CmdletBinding()] + param( + [Parameter()] + [System.String] + $PrivacyMode, + + [Parameter()] + [PSObject] + $ResultSize + ) +} +function Set-DefaultTenantMyAnalyticsFeatureConfig +{ + [CmdletBinding()] + param( + [Parameter()] + [System.Nullable`1[System.Double]] + $SamplingRate, + + [Parameter()] + [System.String] + $PrivacyMode, + + [Parameter()] + [System.String] + $Feature, + + [Parameter()] + [System.Boolean] + $IsEnabled, + + [Parameter()] + [PSObject] + $ResultSize + ) +} +#endregion + #region ExchangeOnline function Add-AvailabilityAddressSpace {