Skip to content

Commit

Permalink
Merge pull request #1284 from NikCharlebois/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 90bc779 + 9d0b8b1 commit 118322f
Show file tree
Hide file tree
Showing 34 changed files with 155 additions and 66 deletions.
7 changes: 2 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Change log for Microsoft365DSC

# Unreleased

* SPOTenantSettings
* Added support for specifying MarkNewFilesSensitiveByDefault

# 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

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
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ 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 {
return "Credential"
}
Expand Down Expand Up @@ -218,7 +223,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
$testParams = @{
GlobalAdminAccount = $GlobalAdminAccount
}

Mock -CommandName Get-CsTeamsCallingPolicy -MockWith {
return @{
Identity = 'Test Calling Policy'
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 Expand Up @@ -290,7 +293,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Context -Name "ReverseDSC Tests" -Fixture {
BeforeAll {
$testParams = @{
GlobalAdminAccount = $GlobalAdminAccount
ApplicationId = "12345-12345-12345-12345-12345"
TenantID = "11111-11111-22222-22222-22222"
CertificateThumbprint = "111111111111"
}

Mock -CommandName Get-Team -MockWith {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +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 {
return "Credential"
}
Expand Down
Loading

0 comments on commit 118322f

Please sign in to comment.