Skip to content

Commit

Permalink
Merge pull request #1285 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.21.630.1
  • Loading branch information
NikCharlebois authored Jul 1, 2021
2 parents ec48ec6 + 26d48b5 commit aa7287b
Show file tree
Hide file tree
Showing 38 changed files with 183 additions and 63 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change log for Microsoft365DSC

# 1.21.630.1

* O365User
* Fix where export was throwing an error about an empty DSCBlock
ISSUE #1275;
* SPOTenantSettings
* Added support for specifying MarkNewFilesSensitiveByDefault

# 1.21.616.1

* SPOSiteAuditSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ function Get-TargetResource
Write-Verbose -Message "GroupID was specified"
try
{
$Group = Get-AzureADMSGroup -Id $Id -ErrorAction Stop
$Group = Get-AzureADGroup -ObjectId $Id -ErrorAction Stop
}
catch
{
Write-Verbose -Message "Couldn't get group by ID, trying by name"
$Group = Get-AzureADMSGroup -Filter "DisplayName eq '$DisplayName'" -ErrorAction Stop
$Group = Get-AzureADGroup -Filter "DisplayName eq '$DisplayName'" -ErrorAction Stop
if ($Group.Length -gt 1)
{
throw "Duplicate AzureAD Groups named $DisplayName exist in tenant"
Expand All @@ -111,7 +111,7 @@ function Get-TargetResource
{
Write-Verbose -Message "Id was NOT specified"
## Can retreive multiple AAD Groups since displayname is not unique
$Group = Get-AzureADMSGroup -Filter "DisplayName eq '$DisplayName'" -ErrorAction Stop
$Group = Get-AzureADGroup -Filter "DisplayName eq '$DisplayName'" -ErrorAction Stop
if ($Group.Length -gt 1)
{
throw "Duplicate AzureAD Groups named $DisplayName exist in tenant"
Expand Down Expand Up @@ -468,7 +468,7 @@ function Export-TargetResource

try
{
[array] $groups = Get-AzureADMSGroup -All:$true -ErrorAction Stop
[array] $groups = Get-AzureADGroup -All:$true -ErrorAction Stop
$i = 1
$dscContent = ''
Write-Host "`r`n" -NoNewline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ function Export-TargetResource
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentContent -ParameterName "Password"
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "Password"
$dscContent += $currentDSCBlock

Save-M365DSCPartialExport -Content $currentDSCBlock `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ function Get-TargetResource
[System.Boolean]
$HideDefaultThemes,

[Parameter()]
[ValidateSet("AllowExternalSharing", "BlockExternalSharing")]
[System.String]
$MarkNewFilesSensitiveByDefault,

[Parameter()]
[ValidateSet("Present", "Absent")]
[System.String]
Expand Down Expand Up @@ -160,6 +165,7 @@ function Get-TargetResource
ApplyAppEnforcedRestrictionsToAdHocRecipients = $SPOTenantSettings.ApplyAppEnforcedRestrictionsToAdHocRecipients
FilePickerExternalImageSearchEnabled = $SPOTenantSettings.FilePickerExternalImageSearchEnabled
HideDefaultThemes = $SPOTenantSettings.HideDefaultThemes
MarkNewFilesSensitiveByDefault = $SPOTenantSettings.MarkNewFilesSensitiveByDefault
GlobalAdminAccount = $GlobalAdminAccount
ApplicationId = $ApplicationId
TenantId = $TenantId
Expand Down Expand Up @@ -277,6 +283,11 @@ function Set-TargetResource
[System.Boolean]
$HideDefaultThemes,

[Parameter()]
[ValidateSet("AllowExternalSharing", "BlockExternalSharing")]
[System.String]
$MarkNewFilesSensitiveByDefault,

[Parameter()]
[ValidateSet("Present", "Absent")]
[System.String]
Expand Down Expand Up @@ -422,6 +433,11 @@ function Test-TargetResource
[System.Boolean]
$HideDefaultThemes,

[Parameter()]
[ValidateSet("AllowExternalSharing", "BlockExternalSharing")]
[System.String]
$MarkNewFilesSensitiveByDefault,

[Parameter()]
[ValidateSet("Present", "Absent")]
[System.String]
Expand Down Expand Up @@ -492,7 +508,9 @@ function Test-TargetResource
"OwnerAnonymousNotification", `
"ApplyAppEnforcedRestrictionsToAdHocRecipients", `
"FilePickerExternalImageSearchEnabled", `
"HideDefaultThemes")
"HideDefaultThemes", `
"MarkNewFilesSensitiveByDefault"
)

Write-Verbose -Message "Test-TargetResource returned $TestResult"
return $TestResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class MSFT_SPOTenantSettings : OMI_BaseResource
[Write, Description("")] boolean ApplyAppEnforcedRestrictionsToAdHocRecipients;
[Write, Description("")] boolean FilePickerExternalImageSearchEnabled;
[Write, Description("Defines if the default themes are visible or hidden")] boolean HideDefaultThemes;
[Write, Description("Allow or block external sharing until at least one Office DLP policy scans the content of the file."), ValueMap{"AllowExternalSharing","BlockExternalSharing"}, Values{"AllowExternalSharing","BlockExternalSharing"}] string MarkNewFilesSensitiveByDefault;
[Write, Description("Only accepted value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Credentials of the SharePoint Global Admin"), EmbeddedInstance("MSFT_Credential")] string GlobalAdminAccount;
[Write, Description("Id of the Azure Active Directory application to authenticate with.")] String ApplicationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Configuration Example
ApplyAppEnforcedRestrictionsToAdHocRecipients = $true
FilePickerExternalImageSearchEnabled = $true
HideDefaultThemes = $false
MarkNewFilesSensitiveByDefault = "AllowExternalSharing"
Ensure = "Present"
}
}
Expand Down
16 changes: 7 additions & 9 deletions Modules/Microsoft365DSC/Microsoft365DSC.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 2021-06-16
# Generated on: 2021-06-30

@{

# Script module or binary module file associated with this manifest.
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.21.616.1'
ModuleVersion = '1.21.630.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -177,13 +177,11 @@
IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true'

# ReleaseNotes of this module
ReleaseNotes = "* SPOSiteAuditSettings
* Fixed issue with Export where property Ensure was added
when an access forbidden error was encountered;
* DEPENDENCIES
* Updated Microsoft.Graph.Authentication to version 1.6.0;
* Updated Microsoft.Graph.Planner to version 1.6.0;
* Updated Microsoft.Graph.Teams to version 1.6.0;"
ReleaseNotes = "* O365User
* Fix where export was throwing an error about an empty DSCBlock
ISSUE #1275;
* SPOTenantSettings
* Added support for specifying MarkNewFilesSensitiveByDefault"

# Flag to indicate whether the module requires explicit user acceptance for install/update
# RequireLicenseAcceptance = $false
Expand Down
20 changes: 10 additions & 10 deletions Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADMSGroup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
return "Credential"
}

Mock -CommandName Get-AzureADMSGroup -MockWith {
Mock -CommandName Get-AzureADGroup -MockWith {
return $null
}
}
It "Should return Values from the Get method" {
(Get-TargetResource @testParams).Ensure | Should -Be 'Absent'
Should -Invoke -CommandName "Get-AzureADMSGroup" -Exactly 1
Should -Invoke -CommandName "Get-AzureADGroup" -Exactly 1
}
It 'Should return false from the Test method' {
Test-TargetResource @testParams | Should -Be $false
Expand Down Expand Up @@ -106,15 +106,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
return "Credential"
}

Mock -CommandName Get-AzureADMSGroup -MockWith {
Mock -CommandName Get-AzureADGroup -MockWith {
return @{DisplayName = "DSCGroup"
ID = "12345-12345-12345-12345" }
}
}

It "Should return Values from the Get method" {
(Get-TargetResource @testParams).Ensure | Should -Be 'Present'
Should -Invoke -CommandName "Get-AzureADMSGroup" -Exactly 1
Should -Invoke -CommandName "Get-AzureADGroup" -Exactly 1
}

It 'Should return true from the Test method' {
Expand Down Expand Up @@ -145,7 +145,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
return "Credential"
}

Mock -CommandName Get-AzureADMSGroup -MockWith {
Mock -CommandName Get-AzureADGroup -MockWith {
return @{
DisplayName = "DSCGroup"
ID = "12345-12345-12345-12345"
Expand All @@ -162,7 +162,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {

It "Should return Values from the Get method" {
Get-TargetResource @testParams
Should -Invoke -CommandName "Get-AzureADMSGroup" -Exactly 1
Should -Invoke -CommandName "Get-AzureADGroup" -Exactly 1
}

It 'Should return true from the Test method' {
Expand All @@ -188,7 +188,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
return "Credential"
}

Mock -CommandName Get-AzureADMSGroup -MockWith {
Mock -CommandName Get-AzureADGroup -MockWith {
return @{
DisplayName = "DSCGroup"
Description = "Microsoft DSC" #Drift
Expand All @@ -200,15 +200,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
}
}

Mock -CommandName Get-AzureADMSGroup -MockWith {
Mock -CommandName Get-AzureADGroup -MockWith {
return @{DisplayName = "DSCGroup"
ID = "12345-12345-12345-12345" }
}
}

It "Should return Values from the Get method" {
Get-TargetResource @testParams
Should -Invoke -CommandName "Get-AzureADMSGroup" -Exactly 1
Should -Invoke -CommandName "Get-AzureADGroup" -Exactly 1
}

It 'Should return false from the Test method' {
Expand All @@ -231,7 +231,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
return "Credential"
}

Mock -CommandName Get-AzureADMSGroup -MockWith {
Mock -CommandName Get-AzureADGroup -MockWith {
return @{
DisplayName = "Test Team"
ID = "12345-12345-12345-12345"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

$Global:PartialExportFileName = "c:\TestPath"
Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith {
return @{}
}

Mock -CommandName Get-M365DSCExportContentForResource -MockWith {

return "FakeDSCContent"
}
Mock -CommandName Save-M365DSCPartialExport -MockWith {
}

Mock -CommandName Get-PSSession -MockWith {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

$Global:PartialExportFileName = "c:\TestPath"
Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith {
return @{}
}

Mock -CommandName Get-M365DSCExportContentForResource -MockWith {

return "FakeDSCContent"
}
Mock -CommandName Save-M365DSCPartialExport -MockWith {
}

Mock -CommandName New-M365DSCConnection -MockWith {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

$Global:PartialExportFileName = "c:\TestPath"
Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith {
return @{}
}

Mock -CommandName Get-M365DSCExportContentForResource -MockWith {

return "FakeDSCContent"
}
Mock -CommandName Save-M365DSCPartialExport -MockWith {
}

Mock -CommandName New-M365DSCConnection -MockWith {
Expand Down
12 changes: 5 additions & 7 deletions Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSite.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin@contoso.onmicrosoft.com", $secpasswd)

$Global:PartialExportFileName = "c:\TestPath"
Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith {
return $Results
return @{}
}

Mock -CommandName Get-M365DSCExportContentForResource -MockWith {
return @"
SPOSite Test
{
Url = https://contoso.sharepoint.com
}
"@
return "FakeDSCContent"
}
Mock -CommandName Save-M365DSCPartialExport -MockWith {
}

Mock -CommandName Set-PnPTenantSite -MockWith {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$secpasswd = ConvertTo-SecureString "Pass@word1)" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

$Global:PartialExportFileName = "c:\TestPath"
Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith {
return @{}
}

Mock -CommandName Get-M365DSCExportContentForResource -MockWith {

return "FakeDSCContent"
}
Mock -CommandName Save-M365DSCPartialExport -MockWith {
}

Mock -CommandName New-M365DSCConnection -MockWith {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$secpasswd = ConvertTo-SecureString "Pass@word1)" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

$Global:PartialExportFileName = "c:\TestPath"
Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith {
return @{}
}

Mock -CommandName Get-M365DSCExportContentForResource -MockWith {

return "FakeDSCContent"
}
Mock -CommandName Save-M365DSCPartialExport -MockWith {
}

Mock -CommandName New-M365DSCConnection -MockWith {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$secpasswd = ConvertTo-SecureString "Pass@word1)" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

$Global:PartialExportFileName = "c:\TestPath"
Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith {
return @{}
}

Mock -CommandName Get-M365DSCExportContentForResource -MockWith {

return "FakeDSCContent"
}
Mock -CommandName Save-M365DSCPartialExport -MockWith {

}

Mock -CommandName New-M365DSCConnection -MockWith {
Expand Down
Loading

0 comments on commit aa7287b

Please sign in to comment.