Skip to content

Commit

Permalink
Merge pull request #3076 from NikCharlebois/Org-Settings-Improvements
Browse files Browse the repository at this point in the history
O365OrgSettings: Added support for the Viva Insights and Briefing email settings.
  • Loading branch information
NikCharlebois committed Jun 22, 2023
2 parents 3c9f703 + 5ab29e3 commit 572ec62
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Microsoft365DSC/Dependencies/Manifest.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
@{
ModuleName = 'ExchangeOnlineManagement'
RequiredVersion = '3.1.0'
RequiredVersion = '3.2.0'
},
@{
ModuleName = 'Microsoft.Graph.Applications'
Expand Down
14 changes: 5 additions & 9 deletions Modules/Microsoft365DSC/Modules/M365DSCStubsUtility.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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'; },
Expand Down Expand Up @@ -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'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand All @@ -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' {
Expand All @@ -104,17 +129,38 @@ 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 {
return @{
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' {
Expand Down Expand Up @@ -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
}
Expand Down
Loading

0 comments on commit 572ec62

Please sign in to comment.