Skip to content

Commit

Permalink
Merge pull request #4281 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.24.131.1
  • Loading branch information
NikCharlebois authored Feb 2, 2024
2 parents 38cb8cf + 350b840 commit 12f990e
Show file tree
Hide file tree
Showing 301 changed files with 3,128 additions and 1,197 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Change log for Microsoft365DSC

# 1.24.131.1

* EXOAvailabilityAddressSpace
* Added support for the TargetServiceEpr and TargetTenantId parameters.
* Fixed the logic to retrieve existing instance by Forest Name.
* EXODistributionGroup
* The Get function now retrieves the ModeratedBy and ManagedBy properties
by the users' UPN instead of their GUID.
* EXOHostedContentFilterRule
* Changed logic to retrieve the Rules by name. Using the Policy's name instead.
* EXOIntraOrganizationConnector
* Fixes the DiscoveryEndpoint value from the Get method to include trailing
forward slash.
* EXOMalwareFilterRule
* Fixed an issue retrieving the right value for the Enabled property
* EXOOMEConfiguration
* Fixes an error in the Get method where the ExternalMailExpiryInDays property
wasn't properly returned.
* EXOSafeLinksPolicy
* Deprecated the UseTranslatedNotificationText property
* TeamsEmergencyCallRoutingPolicy
* Fix deletion of resource
FIXES [#4261](https://github.com/microsoft/Microsoft365DSC/issues/4261)
* TEAMS
* Added support for ManagedIdentity Authentication across Teams resources.
* DEPENDENCIES
* Updated MSCloudLoginAssistant dependencies to version 1.1.10.
* MISC
* Change the way to Export encoding is done so that it no longer relies
on the Get-DSCResource function.

# 1.24.124.1

* AADAuthenticationMethodPolicyAuthenticator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,11 @@ function Get-TargetResource
try
{
Write-Verbose -Message 'Getting all Accepted Domain'
$AllAcceptedDomains = Get-AcceptedDomain -ErrorAction Stop

Write-Verbose -Message 'Filtering Accepted Domain list by Identity'
$AcceptedDomain = $AllAcceptedDomains | Where-Object -FilterScript { $_.Identity -eq $Identity }
$AcceptedDomain = Get-AcceptedDomain -Identity $Identity -ErrorAction SilentlyContinue

if ($null -eq $AcceptedDomain)
{
Write-Verbose -Message "AcceptedDomain configuration for $($Identity) does not exist."
Write-Verbose -Message "AcceptedDomain configuration for {$($Identity)} does not exist."
return $nullReturn
}
else
Expand Down Expand Up @@ -151,12 +148,10 @@ function Set-TargetResource
$Ensure = 'Present',

[Parameter()]
[ValidateScript( { $false -eq $_ })]
[System.Boolean]
$MatchSubDomains = $false,

[Parameter()]
[ValidateScript( { $false -eq $_ })]
[System.Boolean]
$OutboundOnly = $false,

Expand Down Expand Up @@ -223,7 +218,7 @@ function Set-TargetResource
OutboundOnly = $OutboundOnly
}

Write-Verbose -Message "Setting AcceptedDomain for $($Identity) with values: $(Convert-M365DscHashtableToString -Hashtable $AcceptedDomainParams)"
Write-Verbose -Message "Setting AcceptedDomain for {$($Identity)} with values: $(Convert-M365DscHashtableToString -Hashtable $AcceptedDomainParams)"
Set-AcceptedDomain @AcceptedDomainParams
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,19 @@ function Set-TargetResource
ConditionalCustomAttribute9 = $ConditionalCustomAttribute9
ConditionalDepartment = $ConditionalDepartment
ConditionalStateOrProvince = $ConditionalStateOrProvince
DisplayName = $DisplayName
IncludedRecipients = $IncludedRecipients
RecipientFilter = $RecipientFilter
Confirm = $false
}

if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$SetAddressListParams.Add('DisplayName', $DisplayName)
}

if (-not [System.String]::IsNullOrEmpty($RecipientFilter))
{
$SetAddressListParams.Add('RecipientFilter', $RecipientFilter)
}
}
Write-Verbose -Message "Setting Address List '$($Name)' with values: $(Convert-M365DscHashtableToString -Hashtable $SetAddressListParams)"
Set-AddressList @SetAddressListParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Get-TargetResource
$Identity,

[Parameter()]
[ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBBasic', 'InternalProxy')]
[ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBToken', 'OrgWideFBBasic', 'InternalProxy')]
[System.String]
$AccessMethod,

Expand All @@ -26,6 +26,14 @@ function Get-TargetResource
[System.String]
$TargetAutodiscoverEpr,

[Parameter()]
[System.String]
$TargetServiceEpr,

[Parameter()]
[System.String]
$TargetTenantId,

[Parameter()]
[ValidateSet('Present', 'Absent')]
[System.String]
Expand Down Expand Up @@ -91,25 +99,21 @@ function Get-TargetResource
{
try
{
$AvailabilityAddressSpaces = Get-AvailabilityAddressSpace -ErrorAction Stop
$AvailabilityAddressSpace = Get-AvailabilityAddressSpace -Identity $ForestName -ErrorAction Stop
}
catch
{
New-M365DSCLogEntry -Message "Couldn't get AvailabilityAddressSpaces" `
-Exception $_ `
-Source $MyInvocation.MyCommand.ModuleName
}

$AvailabilityAddressSpace = $AvailabilityAddressSpaces | Where-Object -FilterScript { $_.Identity -eq $Identity }
if ($null -eq $AvailabilityAddressSpace)
{
Write-Verbose -Message "AvailabilityAddressSpace $($Identity) does not exist."
Write-Verbose -Message "AvailabilityAddressSpace $($ForestName) does not exist."
return $nullReturn
}
else
{


if ($Null -eq $AvailabilityAddressSpace.TargetAutodiscoverEpr -or $AvailabilityAddressSpace.TargetAutodiscoverEpr -eq '' )
{
$TargetAutodiscoverEpr = ''
Expand All @@ -123,6 +127,8 @@ function Get-TargetResource
Identity = $Identity
AccessMethod = $AvailabilityAddressSpace.AccessMethod
Credentials = $AvailabilityAddressSpace.Credentials
TargetServiceEpr = $AvailabilityAddressSpace.TargetServiceEpr
TargetTenantId = $AvailabilityAddressSpace.TargetTenantId
ForestName = $AvailabilityAddressSpace.ForestName
TargetAutodiscoverEpr = $TargetAutodiscoverEpr
Credential = $Credential
Expand Down Expand Up @@ -163,7 +169,7 @@ function Set-TargetResource
$Identity,

[Parameter()]
[ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBBasic', 'InternalProxy')]
[ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBToken', 'OrgWideFBBasic', 'InternalProxy')]
[System.String]
$AccessMethod,

Expand All @@ -179,6 +185,14 @@ function Set-TargetResource
[System.String]
$TargetAutodiscoverEpr,

[Parameter()]
[System.String]
$TargetServiceEpr,

[Parameter()]
[System.String]
$TargetTenantId,

[Parameter()]
[ValidateSet('Present', 'Absent')]
[System.String]
Expand Down Expand Up @@ -229,18 +243,8 @@ function Set-TargetResource
$ConnectionMode = New-M365DSCConnection -Workload 'ExchangeOnline' `
-InboundParameters $PSBoundParameters

try
{
$AvailabilityAddressSpaces = Get-AvailabilityAddressSpace -ea stop
}
catch
{
New-M365DSCLogEntry -Message "Couldn't get AvailabilityAddressSpaces" `
-Exception $_ `
-Source $MyInvocation.MyCommand.ModuleName
}
$currentInstance = Get-TargetResource @PSBoundParameters

$AvailabilityAddressSpace = $AvailabilityAddressSpaces | Where-Object -FilterScript { $_.Identity -eq $Identity }
$AvailabilityAddressSpaceParams = [System.Collections.Hashtable]($PSBoundParameters)
$AvailabilityAddressSpaceParams.Remove('Ensure') | Out-Null
$AvailabilityAddressSpaceParams.Remove('Credential') | Out-Null
Expand All @@ -251,7 +255,7 @@ function Set-TargetResource
$AvailabilityAddressSpaceParams.Remove('CertificatePassword') | Out-Null
$AvailabilityAddressSpaceParams.Remove('ManagedIdentity') | Out-Null

if (('Present' -eq $Ensure ) -and ($null -eq $AvailabilityAddressSpace))
if ('Present' -eq $Ensure -and $currentInstance.Ensure -eq 'Absent')
{
Write-Verbose -Message "Creating AvailabilityAddressSpace $($Identity)."
# AvailabilityAddressSpace doe not have a new-AvailabilityAddressSpace cmdlet but instead uses an add-AvailabilityAddressSpace cmdlet
Expand All @@ -268,7 +272,7 @@ function Set-TargetResource
-Source $MyInvocation.MyCommand.ModuleName
}
}
elseif (('Present' -eq $Ensure ) -and ($Null -ne $AvailabilityAddressSpace))
elseif ('Present' -eq $Ensure -and $currentInstance.Ensure -eq 'Present')
{
Write-Verbose -Message "Setting AvailabilityAddressSpace $($Identity) with values: $(Convert-M365DscHashtableToString -Hashtable $AvailabilityAddressSpaceParams)"
# AvailabilityAddressSpace is a special case in that it does not have a "set-AvailabilityAddressSpace" cmdlet. To change values of an existing AvailabilityAddressSpace it must be removed and then added again with add-AvailabilityAddressSpace
Expand All @@ -287,7 +291,7 @@ function Set-TargetResource
{
$AvailabilityAddressSpaceParams.Remove('Identity') | Out-Null
$AvailabilityAddressSpaceParams.Remove('Credentials') | Out-Null
add-AvailabilityAddressSpace @AvailabilityAddressSpaceParams -ea stop
Add-AvailabilityAddressSpace @AvailabilityAddressSpaceParams -ea stop
}
catch
{
Expand All @@ -296,7 +300,7 @@ function Set-TargetResource
-Source $MyInvocation.MyCommand.ModuleName
}
}
elseif (('Absent' -eq $Ensure ) -and ($null -ne $AvailabilityAddressSpace))
elseif ('Absent' -eq $Ensure -and $currentInstance.Ensure -eq 'Present')
{
Write-Verbose -Message "Removing AvailabilityAddressSpace $($Identity)"
try
Expand All @@ -323,7 +327,7 @@ function Test-TargetResource
$Identity,

[Parameter()]
[ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBBasic', 'InternalProxy')]
[ValidateSet('PerUserFB', 'OrgWideFB', 'OrgWideFBToken', 'OrgWideFBBasic', 'InternalProxy')]
[System.String]
$AccessMethod,

Expand All @@ -339,6 +343,14 @@ function Test-TargetResource
[System.String]
$TargetAutodiscoverEpr,

[Parameter()]
[System.String]
$TargetServiceEpr,

[Parameter()]
[System.String]
$TargetTenantId,

[Parameter()]
[ValidateSet('Present', 'Absent')]
[System.String]
Expand Down Expand Up @@ -399,6 +411,7 @@ function Test-TargetResource
$ValuesToCheck.Remove('CertificatePath') | Out-Null
$ValuesToCheck.Remove('CertificatePassword') | Out-Null
$ValuesToCheck.Remove('ManagedIdentity') | Out-Null
$ValuesToCheck.Remove('Identity') | Out-Null

$TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues `
-Source $($MyInvocation.MyCommand.Source) `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
class MSFT_EXOAvailabilityAddressSpace : OMI_BaseResource
{
[Key, Description("The Identity parameter specifies the AvailabilityAddressSpace you want to modify.")] String Identity;
[Write, Description("The AccessMethod parameter specifies how the free/busy data is accessed. Valid values are:PerUserFB, OrgWideFB, OrgWideFBBasic,InternalProxy"), ValueMap{"PerUserFB","OrgWideFB","OrgWideFBBasic","InternalProxy"}, Values{"PerUserFB","OrgWideFB","OrgWideFBBasic","InternalProxy"}] String AccessMethod;
[Write, Description("The AccessMethod parameter specifies how the free/busy data is accessed. Valid values are:PerUserFB, OrgWideFB, OrgWideFBToken, OrgWideFBBasic,InternalProxy"), ValueMap{"PerUserFB","OrgWideFB","OrgWideFBToken","OrgWideFBBasic","InternalProxy"}, Values{"PerUserFB","OrgWideFB","OrgWideFBToken","OrgWideFBBasic","InternalProxy"}] String AccessMethod;
[Write, Description("The Credentials parameter specifies the username and password that's used to access the Availability services in the target forest.")] String Credentials;
[Write, Description("The ForestName parameter specifies the SMTP domain name of the target forest for users whose free/busy data must be retrieved. If your users are distributed among multiple SMTP domains in the target forest, run the Add-AvailabilityAddressSpace command once for each SMTP domain.")] String ForestName;
[Write, Description("The TargetAutodiscoverEpr parameter specifies the Autodiscover URL of Exchange Web Services for the external organization. Exchange uses Autodiscover to automatically detect the correct server endpoint for external requests.")] String TargetAutodiscoverEpr;
[Write, Description("The TargetServiceEpr parameter specifies the Exchange Online Calendar Service URL of the external Microsoft 365 organization that you're trying to read free/busy information from.")] String TargetServiceEpr;
[Write, Description("The TargetTenantID parameter specifies the tenant ID of the external Microsoft 365 organization that you're trying to read free/busy information from.")] String TargetTenantId;
[Write, Description("Specifies if this AvailabilityAddressSpace should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Credentials of the Exchange Global Admin"), EmbeddedInstance("MSFT_Credential")] string Credential;
[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 @@ -54,6 +54,9 @@ function Get-TargetResource
-InboundParameters $PSBoundParameters
}

$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

Expand All @@ -76,15 +79,16 @@ function Get-TargetResource

if ($null -ne $AvailabilityConfigs -and $null -ne $AvailabilityConfigs.OrgWideAccount)
{
$AvailabilityConfig = ($AvailabilityConfigs | Where-Object -FilterScript { $_.OrgWideAccount -IMatch $OrgWideAccount })
$user = Get-MgUser -UserId $OrgWideAccount -ErrorAction Stop
$AvailabilityConfig = ($AvailabilityConfigs | Where-Object -FilterScript { $_.OrgWideAccount -IMatch $user.UserId })
}
if ($null -eq $AvailabilityConfig)
{
Write-Verbose -Message "Availability config for $($OrgWideAccount) does not exist."
Write-Verbose -Message "Availability config for [$($OrgWideAccount)] does not exist."
return $nullReturn
}
$result = @{
OrgWideAccount = $AvailabilityConfig.OrgWideAccount
OrgWideAccount = $OrgWideAccount
Ensure = 'Present'
Credential = $Credential
ApplicationId = $ApplicationId
Expand Down Expand Up @@ -263,10 +267,6 @@ function Test-TargetResource
$ValuesToCheck.Remove('ManagedIdentity') | Out-Null

$DesiredValues = $PSBoundParameters
if ($OrgWideAccount.Contains('@'))
{
$DesiredValues.OrgWideAccount = $OrgWideAccount.Split('@')[0]
}

$TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues `
-Source $($MyInvocation.MyCommand.Source) `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,39 @@ function Get-TargetResource
$groupTypeValue = 'Security'
}

$ManagedByValue = @()
if ($null -ne $distributionGroup.ManagedBy)
{
foreach ($user in $distributionGroup.ManagedBy)
{
try
{
$user = Get-MgUser -UserId $user -ErrorAction Stop
$ManagedByValue += $user.UserPrincipalName
}
catch
{
Write-Verbose -Message "Couldn't retrieve user {$user}"
}
}
}

$ModeratedByValue = @()
if ($null -ne $distributionGroup.ModeratedBy)
{
foreach ($user in $distributionGroup.ModeratedBy)
{
try
{
$user = Get-MgUser -UserId $user -ErrorAction Stop
$ModeratedByValue += $user.UserPrincipalName
}
catch
{
Write-Verbose -Message "Couldn't retrieve moderating user {$user}"
}
}
}
$result = @{
Identity = $distributionGroup.Identity
Alias = $distributionGroup.Alias
Expand All @@ -308,11 +341,11 @@ function Get-TargetResource
Description = $descriptionValue
DisplayName = $distributionGroup.DisplayName
HiddenGroupMembershipEnabled = $distributionGroup.HiddenGroupMembershipEnabled
ManagedBy = $distributionGroup.ManagedBy
ManagedBy = $ManagedByValue
MemberDepartRestriction = $distributionGroup.MemberDepartRestriction
MemberJoinRestriction = $distributionGroup.MemberJoinRestriction
Members = $distributionGroupMembers.Name
ModeratedBy = $distributionGroup.ModeratedBy
ModeratedBy = $ModeratedByValue
ModerationEnabled = $distributionGroup.ModerationEnabled
Name = $distributionGroup.Name
Notes = $distributionGroup.Notes
Expand Down
Loading

0 comments on commit 12f990e

Please sign in to comment.