Skip to content

Commit

Permalink
Merge pull request #1687 from microsoft/Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois authored Jan 19, 2022
2 parents 48f670d + 9a7f2f4 commit 825aeef
Show file tree
Hide file tree
Showing 26 changed files with 400 additions and 1,505 deletions.
22 changes: 1 addition & 21 deletions .github/workflows/CodeCoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,10 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install Dependencies
shell: powershell
run: |
$VerbosePreference = 'Continue'
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$manifest = Import-PowerShellDataFile "./Modules/Microsoft365DSC/Microsoft365DSC.psd1"
$dependencies = $manifest.RequiredModules
foreach ($dependency in $dependencies)
{
Write-Verbose -Message "Installing Module {$($dependency.ModuleName)} Version {$($dependency.RequiredVersion)}"
Install-Module $dependency.ModuleName -RequiredVersion $dependency.RequiredVersion -Force -SkipPublisherCheck -AllowClobber -Scope AllUsers -Verbose
try
{
Import-Module $dependency.ModuleName -Force -Verbose
}
catch
{
Write-Verbose -Message $_
}
}
- name: Run Test Harness
shell: powershell
run: |
Import-Module PnP.PowerShell -Force
Install-Module Pester -Force
[System.Environment]::SetEnvironmentVariable('M365DSCTelemetryEnabled', $false, [System.EnvironmentVariableTarget]::Machine);
Import-Module './Tests/TestHarness.psm1' -Force;
Expand Down
27 changes: 5 additions & 22 deletions .github/workflows/Unit Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,16 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install Dependencies
shell: powershell
run: |
$VerbosePreference = 'Continue'
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$manifest = Import-PowerShellDataFile "./Modules/Microsoft365DSC/Dependencies/Manifest.psd1"
$dependencies = $manifest.Dependencies
$i = 1
foreach ($dependency in $dependencies)
{
Write-Progress -Activity "Scanning Dependencies" -PercentComplete ($i / $dependencies.Count * 100)
try
{
Install-Module $dependency.ModuleName -RequiredVersion $dependency.RequiredVersion -AllowClobber -Force
}
catch
{
Write-Host "Could not update {$($dependency.ModuleName)}"
}
$i++
}
- name: Run Test Harness
shell: powershell
run: |
Get-Module -ListAvailable | Out-String
Install-Module PnP.PowerShell -Force
Import-Module PnP.PowerShell -Force
Install-Module Microsoft.PowerApps.Administration.PowerShell -Force
Import-Module Microsoft.PowerApps.Administration.PowerShell -Force
Install-Module Pester -Force -SkipPublisherCheck -RequiredVersion 5.0.4
[System.Environment]::SetEnvironmentVariable('M365DSCTelemetryEnabled', $false, [System.EnvironmentVariableTarget]::Machine);
Import-Module './Tests/TestHarness.psm1' -Force;
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change log for Microsoft365DSC

# 1.22.119.1

* EXOOrganizationConfig
* Added support for the new SendFromAliasEnabled parameter;
* EXORoleAssignmentPolicy
* Fixed logic to update roles assigned to an existing policy;
FIXES #1538
MISC
* Updated logic for Report generation so that it no longer requires the
same module version as defined in the configuration installed on the
system where the report is being generated from.

# 1.22.112.1

* TeamsMeetingPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ function Get-TargetResource
[System.String[]]
$RemotePublicFolderMailboxes,

[Parameter()]
[System.Boolean]
$SendFromAliasEnabled,

[Parameter()]
[System.String]
$SiteMailboxCreationURL,
Expand Down Expand Up @@ -388,12 +392,13 @@ function Get-TargetResource
PublicFolderShowClientControl = $ConfigSettings.PublicFolderShowClientControl
ReadTrackingEnabled = $ConfigSettings.ReadTrackingEnabled
RemotePublicFolderMailboxes = $ConfigSettings.RemotePublicFolderMailboxes
SendFromAliasEnabled = $ConfigSettings.SendFromAliasEnabled
SiteMailboxCreationURL = $ConfigSettings.SiteMailboxCreationURL
SmtpActionableMessagesEnabled = $ConfigSettings.SmtpActionableMessagesEnabled
VisibleMeetingUpdateProperties = $ConfigSettings.VisibleMeetingUpdateProperties
WebPushNotificationsDisabled = $ConfigSettings.WebPushNotificationsDisabled
WebSuggestedRepliesDisabled = $ConfigSettings.WebSuggestedRepliesDisabled
Credential = $Credential
Credential = $Credential
ApplicationId = $ApplicationId
CertificateThumbprint = $CertificateThumbprint
CertificatePath = $CertificatePath
Expand Down Expand Up @@ -698,6 +703,10 @@ function Set-TargetResource
[System.String[]]
$RemotePublicFolderMailboxes,

[Parameter()]
[System.Boolean]
$SendFromAliasEnabled,

[Parameter()]
[System.String]
$SiteMailboxCreationURL,
Expand Down Expand Up @@ -1035,6 +1044,10 @@ function Test-TargetResource
[System.String[]]
$RemotePublicFolderMailboxes,

[Parameter()]
[System.Boolean]
$SendFromAliasEnabled,

[Parameter()]
[System.String]
$SiteMailboxCreationURL,
Expand Down Expand Up @@ -1167,7 +1180,7 @@ function Export-TargetResource
{
$Params = @{
IsSingleInstance = 'Yes'
Credential = $Credential
Credential = $Credential
ApplicationId = $ApplicationId
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class MSFT_EXOOrganizationConfig : OMI_BaseResource
[Write, Description("The PublicFolderShowClientControl parameter enables or disables access to public folders in Microsoft Outlook.")] Boolean PublicFolderShowClientControl;
[Write, Description("The ReadTrackingEnabled parameter specifies whether the tracking for read status for messages in an organization is enabled. The default value is $false.")] Boolean ReadTrackingEnabled;
[Write, Description("The RemotePublicFolderMailboxes parameter specifies the identities of the public folder objects (represented as mail user objects locally) corresponding to the public folder mailboxes created in the remote forest. The public folder values set here are used only if the public folder deployment is a remote deployment.")] String RemotePublicFolderMailboxes[];
[Write, Description("The SendFromAliasEnabled parameter allows mailbox users to send messages using aliases (proxy addresses). It does this by disabling the rewriting of aliases to their primary SMTP address. This change is implemented in the Exchange Online service")] Boolean SendFromEmailAliasEnabled;
[Write, Description("The SiteMailboxCreationURL parameter specifies the URL that's used to create site mailboxes. Site mailboxes improve collaboration and user productivity by allowing access to both SharePoint documents and Exchange email in Outlook 2013 or later.")] String SiteMailboxCreationURL;
[Write, Description("The SmtpActionableMessagesEnabled parameter specifies whether to enable or disable action buttons in email messages in Outlook on the web.")] Boolean SmtpActionableMessagesEnabled;
[Write, Description("The VisibleMeetingUpdateProperties parameter specifies whether meeting message updates will be auto-processed on behalf of attendees. Auto-processed updates are applied to the attendee's calendar item, and then the meeting message is moved to the deleted items. The attendee never sees the update in their inbox, but their calendar is updated.")] String VisibleMeetingUpdateProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,20 @@ function Set-TargetResource
elseif ($Ensure -eq "Present" -and $currentRoleAssignmentPolicyConfig.Ensure -eq "Present" -and $null -ne (Compare-Object -ReferenceObject $($currentRoleAssignmentPolicyConfig.Roles) -DifferenceObject $Roles))
{
Write-Verbose -Message "Role Assignment Policy '$($Name)' already exists, but roles attribute needs updating."
Write-Verbose -Message "Remove Role AssignmentPolicy before recreating because Roles attribute cannot be change with Set cmdlet"
Remove-RoleAssignmentPolicy -Identity $Name -Confirm:$false
New-RoleAssignmentPolicy @NewRoleAssignmentPolicyParams
$differences = Compare-Object -ReferenceObject $($currentRoleAssignmentPolicyConfig.Roles) -DifferenceObject $Roles
foreach ($difference in $differences)
{
if ($difference.SideIndicator -eq '=>')
{
Write-Verbose -Message "Adding Role {$($difference.InputObject)} to Role Assignment Policy {$Name}"
New-ManagementRoleAssignment -Role $($difference.InputObject) -Policy $Name
}
elseif ($difference.SideIndicator -eq '<=')
{
Write-Verbose -Message "Removing Role {$($difference.InputObject)} from Role Assignment Policy {$Name}"
Remove-ManagementRoleAssignment -Identity "$($difference.InputObject)-$Name"
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function Set-TargetResource

$CurrentParameters = $PSBoundParameters

$team = Get-TeamByName $TeamName
$team = Get-TeamByName ([System.Net.WebUtility]::UrlEncode($TeamName))

if ($team.Length -gt 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function Get-TargetResource
try
{
Write-Verbose -Message "Checking for existance of Team User $User"
$team = Get-TeamByName $TeamName -ErrorAction SilentlyContinue
$team = Get-TeamByName ([System.Net.WebUtility]::UrlEncode($TeamName)) -ErrorAction SilentlyContinue
if ($null -eq $team)
{
return $nullReturn
Expand Down Expand Up @@ -182,7 +182,7 @@ function Set-TargetResource

$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftTeams' -InboundParameters $PSBoundParameters

$team = Get-TeamByName $TeamName
$team = Get-TeamByName ([System.Net.WebUtility]::UrlEncode($TeamName))

Write-Verbose -Message "Retrieve team GroupId: $($team.GroupId)"

Expand Down
18 changes: 11 additions & 7 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: 2022-01-12
# Generated on: 2022-01-19

@{

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

# Version number of this module.
ModuleVersion = '1.22.112.1'
ModuleVersion = '1.22.119.1'

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

# ReleaseNotes of this module
ReleaseNotes = "* TeamsMeetingPolicy
* Added support for property WhoCanRegister;
FIXES #1483
* DEPENDENCIES
* Updated MSCloudLoginAssistant to 1.0.83;"
ReleaseNotes = "* EXOOrganizationConfig
* Added support for the new SendFromAliasEnabled parameter;
* EXORoleAssignmentPolicy
* Fixed logic to update roles assigned to an existing policy;
FIXES #1538
MISC
* Updated logic for Report generation so that it no longer requires the
same module version as defined in the configuration installed on the
system where the report is being generated from."

# Flag to indicate whether the module requires explicit user acceptance for install/update
# RequireLicenseAcceptance = $false
Expand Down
2 changes: 1 addition & 1 deletion Modules/Microsoft365DSC/Modules/M365DSCPermissions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function Update-M365DSCAllowedGraphScopes
[System.String]
$Type,

[Parameter(Mandatory = $true)]
[Parameter()]
[ValidateSet('Global', 'China', 'USGov', 'USGovDoD', 'Germany')]
[System.String]
$Environment = 'Global'
Expand Down
24 changes: 20 additions & 4 deletions Modules/Microsoft365DSC/Modules/M365DSCReport.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ function New-M365DSCConfigurationToHTML
if ([System.String]::IsNullOrEmpty($ParsedContent))
{
$TemplateFile = Get-Item $ConfigurationPath
$ParsedContent = ConvertTo-DSCObject -Path $ConfigurationPath
$fileContent = Get-Content $ConfigurationPath -Raw
$startPosition = $fileContent.IndexOf(" -ModuleVersion")
$endPosition = $fileContent.IndexOf("`r", $startPosition)
$fileContent = $fileContent.Remove($startPosition, $endPosition - $startPosition)
$ParsedContent = ConvertTo-DSCObject -Content $fileContent
$TemplateName = $TemplateFile.Name.Split('.')[0]
}
else
Expand Down Expand Up @@ -211,7 +215,11 @@ function New-M365DSCConfigurationToExcel
$report.Range("A1:C1").Borders.Weight = -4138
$row = 2

$parsedContent = ConvertTo-DSCObject -Path $ConfigurationPath
$fileContent = Get-Content $ConfigurationPath -Raw
$startPosition = $fileContent.IndexOf(" -ModuleVersion")
$endPosition = $fileContent.IndexOf("`r", $startPosition)
$fileContent = $fileContent.Remove($startPosition, $endPosition - $startPosition)
$ParsedContent = ConvertTo-DSCObject -Content $fileContent
foreach ($resource in $parsedContent)
{
$beginRow = $row
Expand Down Expand Up @@ -391,11 +399,19 @@ function Compare-M365DSCConfigurations

if (-not $SourceObject)
{
[Array] $SourceObject = ConvertTo-DSCObject -Path $Source
$fileContent = Get-Content $Source -Raw
$startPosition = $fileContent.IndexOf(" -ModuleVersion")
$endPosition = $fileContent.IndexOf("`r", $startPosition)
$fileContent = $fileContent.Remove($startPosition, $endPosition - $startPosition)
[Array] $SourceObject = ConvertTo-DSCObject -Content $fileContent
}
if (-not $DestinationObject)
{
[Array] $DestinationObject = ConvertTo-DSCObject -Path $Destination
$fileContent = Get-Content $Destination -Raw
$startPosition = $fileContent.IndexOf(" -ModuleVersion")
$endPosition = $fileContent.IndexOf("`r", $startPosition)
$fileContent = $fileContent.Remove($startPosition, $endPosition - $startPosition)
[Array] $DestinationObject = ConvertTo-DSCObject -Content $FileContent
}

# Loop through all items in the source array
Expand Down
8 changes: 4 additions & 4 deletions Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,6 @@ function Start-M365DSCConfigurationExtract
-Cert "cert:\LocalMachine\my\$($LCMConfig.CertificateID)" `
-Type CERT `
-NoClobber | Out-Null
Add-ConfigurationDataEntry -Node "localhost" `
-Key "CertificateFile" `
-Value "M365DSC.cer" `
-Description "Path of the certificate used to encrypt credentials in the file."
}
catch
{
Expand All @@ -648,6 +644,10 @@ function Start-M365DSCConfigurationExtract
-EventID 1 -Source $($MyInvocation.MyCommand.Source)
}
}
Add-ConfigurationDataEntry -Node "localhost" `
-Key "CertificateFile" `
-Value "M365DSC.cer" `
-Description "Path of the certificate used to encrypt credentials in the file."
$outputConfigurationData = $OutputDSCPath + "ConfigurationData.psd1"
New-ConfigurationDataDocument -Path $outputConfigurationData
}
Expand Down
18 changes: 16 additions & 2 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,16 @@ function Export-M365DSCConfiguration
#region Telemetry
$data = [System.Collections.Generic.Dictionary[[String], [String]]]::new()
$data.Add("Event", "Extraction")

if (-not [System.String]::IsNullOrEmpty($TenantId))
{
$data.Add("Tenant", $TenantId)
}
else
{
$tenant = $Credential.UserName.Split('@')[1]
$data.Add("Tenant", $tenant)
}
$data.Add("Path", [System.String]::IsNullOrEmpty($Path))
$data.Add("FileName", $null -ne [System.String]::IsNullOrEmpty($FileName))
$data.Add("Components", $null -ne $Components)
Expand All @@ -966,7 +976,7 @@ function Export-M365DSCConfiguration
}

# Clear the Connection Cache from MSCloudLoginAssistant
$Global:MsCloudLoginConnectionProfile = $null
#$Global:MsCloudLoginConnectionProfile = $null

# Make sure we are not connected to Microsoft Graph on another tenant
try
Expand Down Expand Up @@ -2138,7 +2148,11 @@ function Assert-M365DSCBlueprint
if ((Test-Path -Path $LocalBluePrintPath))
{
# Parse the content of the BluePrint into an array of PowerShell Objects
$parsedBluePrint = ConvertTo-DSCObject -Path $LocalBluePrintPath
$fileContent = Get-Content $LocalBluePrintPath -Raw
$startPosition = $fileContent.IndexOf(" -ModuleVersion")
$endPosition = $fileContent.IndexOf("`r", $startPosition)
$fileContent = $fileContent.Remove($startPosition, $endPosition - $startPosition)
$parsedBluePrint = ConvertTo-DSCObject -Content $fileContent

# Generate an Array of Resource Types contained in the BluePrint
$ResourcesInBluePrint = @()
Expand Down
Loading

0 comments on commit 825aeef

Please sign in to comment.