diff --git a/CHANGELOG.md b/CHANGELOG.md index c8ce83c2f4..82cbfda489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Change log for Microsoft365DSC +# 1.22.406.1 + +* EXOMalwareFilterPolicy + * Add support for property QuarantineTag +* PPTenantIsolationSettings + * New resource +* MISC + * Updated Convert-M365DscHashtableToString function to also convert + Arrays and CimInstances to string. + * Updated permissions in settings.json files. +* DEPENDENCIES + * Updated Microsoft.PowerApps.Administration.PowerShell to 2.0.144. + * Updated MicrosoftTeams to 4.1.0. + * Updated PnP.PowerShell to 1.10.0. + # 1.22.323.1 * EXOAuthenticationPolicy diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/settings.json index 5e255a4ba4..8d0f4b9fad 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADConditionalAccessPolicy/settings.json @@ -4,9 +4,6 @@ "permissions": [ { "read": [ - { - "name": "Agreement.Read.All" - }, { "name": "DeviceManagementApps.Read.All" }, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/settings.json index 5fc3958c26..461f99f138 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADRoleDefinition/settings.json @@ -4,8 +4,20 @@ "permissions": [ { "read": [ + { + "name": "Directory.AccessAsUser.All" + }, + { + "name": "Directory.Read.All" + }, + { + "name": "Directory.ReadWrite.All" + }, { "name": "RoleManagement.Read.Directory" + }, + { + "name": "RoleManagement.ReadWrite.Directory" } ], "update": [ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxPlan/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxPlan/settings.json index 89d2d105d0..8503c4fc5c 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxPlan/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailboxPlan/settings.json @@ -1,10 +1,10 @@ { - "resourceName": "EXOMailboxPlan", - "description": "", - "permissions": [ - { - "read": [], - "update": [] - } - ] + "resourceName": "EXOMailboxPlan", + "description": "", + "permissions": [ + { + "read": [], + "update": [] + } + ] } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 index 18be92683c..cfdb02abc6 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.psm1 @@ -85,6 +85,10 @@ function Get-TargetResource [System.Boolean] $MakeDefault, + [Parameter()] + [System.String] + $QuarantineTag, + [Parameter()] [System.Boolean] $ZapEnabled, @@ -188,6 +192,7 @@ function Get-TargetResource ExternalSenderAdminAddress = $MalwareFilterPolicy.ExternalSenderAdminAddress FileTypes = $MalwareFilterPolicy.FileTypes InternalSenderAdminAddress = $MalwareFilterPolicy.InternalSenderAdminAddress + QuarantineTag = $MalwareFilterPolicy.QuarantineTag MakeDefault = $MalwareFilterPolicy.IsDefault ZapEnabled = $MalwareFilterPolicy.ZapEnabled Credential = $Credential @@ -316,6 +321,10 @@ function Set-TargetResource [System.Boolean] $MakeDefault, + [Parameter()] + [System.String] + $QuarantineTag, + [Parameter()] [System.Boolean] $ZapEnabled, @@ -488,6 +497,10 @@ function Test-TargetResource [System.Boolean] $MakeDefault, + [Parameter()] + [System.String] + $QuarantineTag, + [Parameter()] [System.Boolean] $ZapEnabled, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.schema.mof index 8b85ac8537..43fafad610 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMalwareFilterPolicy/MSFT_EXOMalwareFilterPolicy.schema.mof @@ -22,6 +22,7 @@ class MSFT_EXOMalwareFilterPolicy : OMI_BaseResource [Write, Description("The FileTypes parameter specifies the file types that are automatically blocked by common attachment blocking (also known as the Common Attachment Types Filter), regardless of content.")] String FileTypes[]; [Write, Description("The InternalSenderAdminAddress parameter specifies the email address of the administrator who will receive notification messages for malware detections in messages from internal senders.")] String InternalSenderAdminAddress; [Write, Description("MakeDefault makes this malware filter policy the default policy. Valid values are: $true, $false.")] Boolean MakeDefault; + [Write, Description("The QuarantineTag specifies the quarantine policy that's used on messages that are quarantined as malware.")] String QuarantineTag; [Write, Description("The ZapEnabled parameter enables or disables zero-hour auto purge (ZAP) for malware. ZAP detects malware in unread messages that have already been delivered to the user's Inbox. Valid values are: $true, $false.")] Boolean ZapEnabled; [Write, Description("Specifies if this MalwareFilterPolicy should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; [Write, Description("Credentials of the Exchange Global Admin"), EmbeddedInstance("MSFT_Credential")] string Credential; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportConfig/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportConfig/settings.json index 15c2badc4f..a981dcd5c3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportConfig/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportConfig/settings.json @@ -1,10 +1,10 @@ { - "resourceName": "EXOTransportConfig", - "description": "", - "permissions": [ - { - "read": [], - "update": [] - } - ] + "resourceName": "EXOTransportConfig", + "description": "", + "permissions": [ + { + "read": [], + "update": [] + } + ] } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/readme.md b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/readme.md index 3bbd1c7b8d..27b4e77179 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/readme.md +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/readme.md @@ -1,4 +1,4 @@ -# IntuneDeviceConfigurationPolicyiOS +# IntuneAppProtectionPolicyiOS -This resource configures an Intune device configuration profile for an iOS Device. +This resource configures an Intune app protection policy for an iOS Device. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/settings.json index 3f176c24ec..c1ca00a4a1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppProtectionPolicyiOS/settings.json @@ -1,6 +1,6 @@ { - "resourceName": "IntuneDeviceConfigurationPolicyiOS", - "description": "This resource configures an Intune device configuration profile for an iOS Device.", + "resourceName": "IntuneAppProtectionPolicyiOS", + "description": "This resource configures an Intune app protection policy for an iOS Device.", "permissions": [ { "read": [ diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/settings.json index 8185e2a070..f5aafd52f7 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/settings.json @@ -26,7 +26,56 @@ "name": "GroupMember.ReadWrite.All" } ], - "update": [] + "update": [ + { + "name": "DeviceManagementApps.Read.All" + }, + { + "name": "DeviceManagementApps.ReadWrite.All" + }, + { + "name": "DeviceManagementManagedDevices.Read.All" + }, + { + "name": "DeviceManagementManagedDevices.ReadWrite.All" + }, + { + "name": "DeviceManagementServiceConfig.Read.All" + }, + { + "name": "DeviceManagementServiceConfig.ReadWrite.All" + }, + { + "name": "Directory.AccessAsUser.All" + }, + { + "name": "Directory.Read.All" + }, + { + "name": "Directory.ReadWrite.All" + }, + { + "name": "Group.Read.All" + }, + { + "name": "Group.ReadWrite.All" + }, + { + "name": "GroupMember.Read.All" + }, + { + "name": "GroupMember.ReadWrite.All" + }, + { + "name": "User.Read.All" + }, + { + "name": "User.ReadBasic.All" + }, + { + "name": "User.ReadWrite.All" + } + ] } ] } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/MSFT_PPTenantIsolationSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/MSFT_PPTenantIsolationSettings.psm1 new file mode 100644 index 0000000000..fe6a829dfb --- /dev/null +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/MSFT_PPTenantIsolationSettings.psm1 @@ -0,0 +1,688 @@ +function Get-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Collections.Hashtable])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateSet('Yes')] + [System.String] + $IsSingleInstance, + + [Parameter()] + [System.Boolean] + $Enabled = $true, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $Rules, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $RulesToInclude, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $RulesToExclude, + + [Parameter()] + [System.Management.Automation.PSCredential] + $Credential + ) + + Write-Verbose -Message 'Getting the Power Platform Tenant Isolation Settings Configuration' + + if ($PSBoundParameters.ContainsKey("Rules") -and ` + ($PSBoundParameters.ContainsKey("RulesToInclude") -or ` + $PSBoundParameters.ContainsKey("RulesToExclude"))) + { + $message = 'You cannot specify Rules and RulesToInclude/RulesToExclude.' + Add-M365DSCEvent -Message $message -EntryType 'Error' ` + -EventID 1 -Source $($MyInvocation.MyCommand.Source) + throw $message + } + + $ConnectionMode = New-M365DSCConnection -Workload 'PowerPlatforms' ` + -InboundParameters $PSBoundParameters + + $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' ` + -InboundParameters $PSBoundParameters + + #Ensure the proper dependencies are installed in the current environment. + Confirm-M365DSCDependencies + + #region Telemetry + $ResourceName = $MyInvocation.MyCommand.ModuleName -replace "MSFT_", "" + $CommandName = $MyInvocation.MyCommand + $data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName ` + -CommandName $CommandName ` + -Parameters $PSBoundParameters + Add-M365DSCTelemetryEvent -Data $data + #endregion + + try + { + $tenantid = (Get-MgContext).TenantId + + $tenantIsolationPolicy = Get-PowerAppTenantIsolationPolicy -TenantId $tenantid + + [Array]$allowedTenants = $tenantIsolationPolicy.properties.allowedTenants | ForEach-Object { + $directions = $_.direction + if ($directions.inbound -eq $true) + { + if ($directions.outbound -eq $true) + { + $direction = 'Both' + } + else + { + $direction = 'Inbound' + } + } + elseif ($directions.outbound -eq $true) + { + $direction = 'Outbound' + } + else + { + $direction = 'unknown' + } + + return @{ + TenantName = $_.tenantId + Direction = $direction + } + } + + return @{ + IsSingleInstance = 'Yes' + Enabled = ($tenantIsolationPolicy.properties.isDisabled -eq $false) + Rules = $allowedTenants + } + } + catch + { + try + { + Write-Verbose -Message $_ + $tenantIdValue = '' + if (-not [System.String]::IsNullOrEmpty($TenantId)) + { + $tenantIdValue = $TenantId + } + elseif ($null -ne $Credential) + { + $tenantIdValue = $Credential.UserName.Split('@')[1] + } + Add-M365DSCEvent -Message $_ -EntryType 'Error' ` + -EventID 1 -Source $($MyInvocation.MyCommand.Source) ` + -TenantId $tenantIdValue + } + catch + { + Write-Verbose -Message $_ + } + throw $_ + } +} + +function Set-TargetResource +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateSet('Yes')] + [System.String] + $IsSingleInstance, + + [Parameter()] + [System.Boolean] + $Enabled = $true, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $Rules, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $RulesToInclude, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $RulesToExclude, + + [Parameter()] + [System.Management.Automation.PSCredential] + $Credential + ) + + Write-Verbose -Message 'Setting Power Platform Tenant Isolation Settings configuration' + + if ($PSBoundParameters.ContainsKey("Rules") -and ` + ($PSBoundParameters.ContainsKey("RulesToInclude") -or ` + $PSBoundParameters.ContainsKey("RulesToExclude"))) + { + $message = 'You cannot specify Rules and RulesToInclude/RulesToExclude.' + Add-M365DSCEvent -Message $message -EntryType 'Error' ` + -EventID 1 -Source $($MyInvocation.MyCommand.Source) + throw $message + } + + #Ensure the proper dependencies are installed in the current environment. + Confirm-M365DSCDependencies + + #region Telemetry + $ResourceName = $MyInvocation.MyCommand.ModuleName -replace "MSFT_", "" + $CommandName = $MyInvocation.MyCommand + $data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName ` + -CommandName $CommandName ` + -Parameters $PSBoundParameters + Add-M365DSCTelemetryEvent -Data $data + #endregion + + $ConnectionMode = New-M365DSCConnection -Workload 'PowerPlatforms' ` + -InboundParameters $PSBoundParameters + + $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' ` + -InboundParameters $PSBoundParameters + + $tenantid = (Get-MgContext).TenantId + + $tenantIsolationPolicy = Get-PowerAppTenantIsolationPolicy -TenantId $tenantid + + if ($tenantIsolationPolicy.Properties.isDisabled -ne -not $Enabled) + { + $tenantIsolationPolicy.Properties.isDisabled = -not $Enabled + } + + [Array]$existingAllowedRules = $tenantIsolationPolicy.Properties.allowedTenants + + if ($PSBoundParameters.ContainsKey("Rules")) + { + Write-Verbose "Processing parameter Rules" + foreach ($rule in $Rules) + { + # Check if Rules exist + $ruleTenantId = Get-M365TenantId -TenantName $rule.TenantName + + $direction = [PSCustomObject]@{ + inbound = $false + outbound = $false + } + + $existingRule = $existingAllowedRules | Where-Object -FilterScript { $_.tenantId -eq $ruleTenantId } + if ($null -eq $existingRule) + { + Write-Verbose "Rule for $($rule.TenantName) does not exist. Adding with direction $($rule.Direction)" + switch ($rule.Direction) + { + 'Inbound' + { + $direction.inbound = $true + } + 'Outbound' + { + $direction.outbound = $true + } + 'Both' + { + $direction.inbound = $true + $direction.outbound = $true + } + } + + $newRule = [PSCustomObject]@{ + tenantId = $ruleTenantId + tenantDisplayName = '' + direction = $direction + } + + $existingAllowedRules += $newRule + } + else + { + Write-Verbose "Rule for $($rule.TenantName) exists. Setting specified direction." + switch ($rule.Direction) + { + 'Inbound' + { + $existingRule.Direction.inbound = $true + $existingRule.Direction.outbound = $false + } + 'Outbound' + { + $existingRule.Direction.inbound = $false + $existingRule.Direction.outbound = $true + } + 'Both' + { + $existingRule.Direction.inbound = $true + $existingRule.Direction.outbound = $true + } + } + } + } + + $removeRules = @() + foreach ($existingRule in $existingAllowedRules) + { + # Check if rules are not in the specified list + if ($null -eq ($Rules | Where-Object -FilterScript { (Get-M365TenantId -TenantName $_.TenantName) -eq $existingRule.tenantId })) + { + Write-Verbose "Rule for tenant id $($existingRule.tenantId) does not exist in the Rules parameter. Deleting rule." + $removeRules += $existingRule.tenantId + } + } + [Array]$newRules = $existingAllowedRules | Where-Object -FilterScript { $_.tenantId -notin $removeRules } + $tenantIsolationPolicy.Properties.allowedTenants = $newRules + } + + if ($PSBoundParameters.ContainsKey("RulesToInclude")) + { + Write-Verbose "Processing parameter RulesToInclude" + foreach ($rule in $RulesToInclude) + { + Write-Verbose "Checking rule for TenantName $($rule.TenantName) with direction $($rule.Direction)" + $ruleTenantId = Get-M365TenantId -TenantName $rule.TenantName + + $direction = [PSCustomObject]@{ + inbound = $false + outbound = $false + } + + $existingRule = $existingAllowedRules | Where-Object -FilterScript { $_.tenantId -eq $ruleTenantId } + if ($null -eq $existingRule) + { + Write-Verbose "Rule does not exist. Adding with direction $($rule.Direction)" + # Rule does not exist, add rule + switch ($rule.Direction) + { + 'Inbound' + { + $direction.inbound = $true + } + 'Outbound' + { + $direction.outbound = $true + } + 'Both' + { + $direction.inbound = $true + $direction.outbound = $true + } + } + + $newRule = [PSCustomObject]@{ + tenantId = $ruleTenantId + tenantDisplayName = '' + direction = $direction + } + + $existingAllowedRules += $newRule + } + else + { + Write-Verbose "Rule exists. Setting specified direction." + switch ($rule.Direction) + { + 'Inbound' + { + $existingRule.Direction.inbound = $true + $existingRule.Direction.outbound = $false + } + 'Outbound' + { + $existingRule.Direction.inbound = $false + $existingRule.Direction.outbound = $true + } + 'Both' + { + $existingRule.Direction.inbound = $true + $existingRule.Direction.outbound = $true + } + } + } + } + $tenantIsolationPolicy.Properties.allowedTenants = $existingAllowedRules + } + + if ($PSBoundParameters.ContainsKey("RulesToExclude")) + { + Write-Verbose "Processing parameter RulesToExclude" + foreach ($rule in $RulesToExclude) + { + Write-Verbose "Checking rule for TenantName $($rule.TenantName)" + $ruleTenantId = Get-M365TenantId -TenantName $rule.TenantName + + $removeRules = @() + if ($null -ne ($existingAllowedRules | Where-Object -FilterScript { $_.tenantId -eq $ruleTenantId })) + { + Write-Verbose "Rule for $($rule.TenantName) is currently configured in the rules. Deleting rule." + $removeRules += $ruleTenantId + } + } + + [Array]$newRules = $existingAllowedRules | Where-Object -FilterScript { $_.tenantId -notin $removeRules } + $tenantIsolationPolicy.Properties.allowedTenants = $newRules + } + + Write-Verbose "Saving changes to the tenant" + $null = Set-PowerAppTenantIsolationPolicy -TenantIsolationPolicy $tenantIsolationPolicy -TenantId $tenantId +} + +function Test-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Boolean])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateSet('Yes')] + [System.String] + $IsSingleInstance, + + [Parameter()] + [System.Boolean] + $Enabled = $true, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $Rules, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $RulesToInclude, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance[]] + $RulesToExclude, + + [Parameter()] + [System.Management.Automation.PSCredential] + $Credential + ) + + Write-Verbose -Message 'Testing Power Platform Tenant Isolation Settings configuration' + + #Ensure the proper dependencies are installed in the current environment. + Confirm-M365DSCDependencies + + #region Telemetry + $ResourceName = $MyInvocation.MyCommand.ModuleName -replace "MSFT_", "" + $CommandName = $MyInvocation.MyCommand + $data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName ` + -CommandName $CommandName ` + -Parameters $PSBoundParameters + Add-M365DSCTelemetryEvent -Data $data + #endregion + + $CurrentValues = Get-TargetResource @PSBoundParameters + + Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)" + Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $PSBoundParameters)" + + $result = $true + $driftedRules = @{} + if ($PSBoundParameters.ContainsKey("Rules")) + { + Write-Verbose "Processing parameter Rules" + foreach ($rule in $Rules) + { + Write-Verbose "Checking Rule for TenantName $($rule.TenantName)." + $ruleTenantId = Get-M365TenantId -TenantName $rule.TenantName + + $existingRule = $CurrentValues.Rules | Where-Object -FilterScript { $_.TenantName -eq $ruleTenantId } + if ($null -eq $existingRule) + { + Write-Verbose "Rule for $($rule.TenantName) does not exist." + $driftedRules.($rule.TenantName) = @{ + CurrentValue = "Rule does not exist" + DesiredValue = "Direction: $($rule.Direction)" + } + $result = $false + } + else + { + Write-Verbose "Rule for $($rule.TenantName) exists. Checking specified direction." + if ($rule.Direction -ne $existingRule.Direction) + { + Write-Verbose "Direction for rule incorrect: Current = $($existingRule.Direction) / Desired = $($rule.Direction)" + $driftedRules.($rule.TenantName) = @{ + CurrentValue = "Direction: $($existingRule.Direction)" + DesiredValue = "Direction: $($rule.Direction)" + } + $result = $false + } + } + } + + foreach ($existingRule in $CurrentValues.Rules) + { + # Check if rules are not in the specified list + if ($null -eq ($Rules | Where-Object -FilterScript { (Get-M365TenantId -TenantName $_.TenantName) -eq $existingRule.TenantName })) + { + Write-Verbose "Rule for tenant id $($existingRule.TenantName) does not exist in the Desired State." + + $driftedRules.($existingRule.TenantName) = @{ + CurrentValue = "Direction: $($existingRule.Direction)" + DesiredValue = "Should not exist" + } + $result = $false + } + } + } + + if ($PSBoundParameters.ContainsKey("RulesToInclude")) + { + Write-Verbose "Processing parameter RulesToInclude" + $driftedRules = @{} + foreach ($rule in $RulesToInclude) + { + Write-Verbose "Checking Rule for TenantName $($rule.TenantName)." + $ruleTenantId = Get-M365TenantId -TenantName $rule.TenantName + + $existingRule = $CurrentValues.Rules | Where-Object -FilterScript { $_.TenantName -eq $ruleTenantId } + if ($null -eq $existingRule) + { + Write-Verbose "Rule for $($rule.TenantName) does not exist." + $driftedRules.($rule.TenantName) = @{ + CurrentValue = "Rule does not exist" + DesiredValue = "Direction: $($rule.Direction)" + } + $result = $false + } + else + { + Write-Verbose "Rule for $($rule.TenantName) exists. Checking specified direction." + if ($rule.Direction -ne $existingRule.Direction) + { + Write-Verbose "Direction for rule incorrect: Current = $($existingRule.Direction) / Desired = $($rule.Direction)" + $driftedRules.($rule.TenantName) = @{ + CurrentValue = "Direction: $($existingRule.Direction)" + DesiredValue = "Direction: $($rule.Direction)" + } + $result = $false + } + } + } + } + + if ($PSBoundParameters.ContainsKey("RulesToExclude")) + { + Write-Verbose "Processing parameter RulesToExclude" + $driftedRules = @{} + foreach ($rule in $RulesToExclude) + { + Write-Verbose "Checking Rule for TenantName $($rule.TenantName)." + $ruleTenantId = Get-M365TenantId -TenantName $rule.TenantName + + $existingRule = $CurrentValues.Rules | Where-Object -FilterScript { $_.TenantName -eq $ruleTenantId } + if ($null -ne $existingRule) + { + Write-Verbose "Rule for $($rule.TenantName) exists." + $driftedRules.($rule.TenantName) = @{ + CurrentValue = "Direction: $($existingRule.Direction)" + DesiredValue = "Should not exist" + } + $result = $false + } + } + } + + if ($result -eq $false) + { + $message = "Tenant Isolation Rules not in the Desired State:`n" + $message += "`n" + foreach ($driftedRule in $driftedRules.GetEnumerator()) + { + $message += " `n" + $message += " $($driftedRule.Name)`n" + $message += " $($driftedRule.Value.CurrentValue)`n" + $message += " $($driftedRule.Value.DesiredValue)`n" + $message += " `n" + } + $message += "" + Add-M365DSCEvent -Message $message -EntryType 'Error' ` + -EventID 1 -Source $($MyInvocation.MyCommand.Source) + Write-Verbose -Message "Test-TargetResource returned False" + return $false + } + + $TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues ` + -Source $($MyInvocation.MyCommand.Source) ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Enabled") + + Write-Verbose -Message "Test-TargetResource returned $TestResult" + + return $TestResult +} + +function Export-TargetResource +{ + [CmdletBinding()] + [OutputType([System.String])] + param + ( + [Parameter()] + [System.Management.Automation.PSCredential] + $Credential + ) + + $ConnectionMode = New-M365DSCConnection -Workload 'PowerPlatforms' ` + -InboundParameters $PSBoundParameters + + $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' ` + -InboundParameters $PSBoundParameters + + #Ensure the proper dependencies are installed in the current environment. + Confirm-M365DSCDependencies + + #region Telemetry + $ResourceName = $MyInvocation.MyCommand.ModuleName -replace "MSFT_", "" + $CommandName = $MyInvocation.MyCommand + $data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName ` + -CommandName $CommandName ` + -Parameters $PSBoundParameters + Add-M365DSCTelemetryEvent -Data $data + #endregion + + try + { + $dscContent = '' + + $Params = @{ + IsSingleInstance = 'Yes' + } + + $Results = Get-TargetResource @Params + if ($Results.Rules.Count -gt 0) + { + $Results.Rules = Get-M365DSCTenantIsolationRule $Results.Rules + } + $Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode ` + -Results $Results + $currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName ` + -ConnectionMode $ConnectionMode ` + -ModulePath $PSScriptRoot ` + -Results $Results ` + -Credential $Credential + $dscContent += $currentDSCBlock + + Save-M365DSCPartialExport -Content $currentDSCBlock ` + -FileName $Global:PartialExportFileName + + Write-Host $Global:M365DSCEmojiGreenCheckMark + + return $dscContent + } + catch + { + try + { + Write-Host $Global:M365DSCEmojiRedX + Write-Verbose -Message $_ + $tenantIdValue = '' + if (-not [System.String]::IsNullOrEmpty($TenantId)) + { + $tenantIdValue = $TenantId + } + elseif ($null -ne $Credential) + { + $tenantIdValue = $Credential.UserName.Split('@')[1] + } + Add-M365DSCEvent -Message $_ -EntryType 'Error' ` + -EventID 1 -Source $($MyInvocation.MyCommand.Source) ` + -TenantId $tenantIdValue + } + catch + { + Write-Verbose -Message $_ + } + return '' + } +} + +function Get-M365TenantId +{ + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $TenantName + ) + + if ($TenantName -notmatch ".onmicrosoft.com$") + { + $TenantName += '.onmicrosoft.com' + } + + $result = Invoke-WebRequest "https://login.windows.net/$TenantName/.well-known/openid-configuration" -UseBasicParsing -Verbose:$false + $jsonResult = $result | ConvertFrom-Json + return $jsonResult.token_endpoint.Split('/')[3] +} + +function Get-M365DSCTenantIsolationRule +{ + [CmdletBinding()] + [OutputType([System.String])] + param( + [Parameter(Mandatory = $true)] + [System.Collections.ArrayList] + $Rules + ) + + $StringContent = "@(" + foreach ($rule in $Rules) + { + $StringContent += "ule {r`n" + $StringContent += " TenantName = '" + $rule.TenantName + "'`r`n" + $StringContent += " Direction = '" + $rule.Direction + "'`r`n" + $StringContent += " }`r`n" + } + $StringContent += " )" + return $StringContent +} + +Export-ModuleMember -Function *-TargetResource diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/MSFT_PPTenantIsolationSettings.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/MSFT_PPTenantIsolationSettings.schema.mof new file mode 100644 index 0000000000..7663bf14c0 --- /dev/null +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/MSFT_PPTenantIsolationSettings.schema.mof @@ -0,0 +1,17 @@ +[ClassVersion("1.0.0")] +class MSFT_PPTenantRule +{ + [Required, Description("Name of the trusted tenant.")] String TenantName; + [Required, Description("Direction of tenant trust."), ValueMap{"Inbound", "Outbound", "Both"}, Values{"Inbound", "Outbound", "Both"}] String Direction; +}; + +[ClassVersion("1.0.0.0"), FriendlyName("PPTenantIsolationSettings")] +class MSFT_PPTenantIsolationSettings : OMI_BaseResource +{ + [Key, Description("Should be set to yes"),ValueMap{"Yes"},Values{"Yes"}] string IsSingleInstance; + [Write, Description("When set to true this will enable the tenant isolation settings.")] boolean Enabled; + [Write, Description("The exact list of tenant rules to be configured."),EmbeddedInstance("MSFT_PPTenantRule")] String Rules[]; + [Write, Description("A list of tenant rules that has to be added."),EmbeddedInstance("MSFT_PPTenantRule")] String RulesToInclude[]; + [Write, Description("A list of tenant rules that is now allowed to be added."),EmbeddedInstance("MSFT_PPTenantRule")] String RulesToExclude[]; + [Write, Description("Credentials of the Power Platform Admin"), EmbeddedInstance("MSFT_Credential")] string Credential; +}; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/readme.md b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/readme.md new file mode 100644 index 0000000000..1f603b9801 --- /dev/null +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/readme.md @@ -0,0 +1,3 @@ +# PPTenantSettings + +This resource configures the Tenant Isolation settings for a Power Platform Tenant. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/settings.json new file mode 100644 index 0000000000..5f80810e06 --- /dev/null +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_PPTenantIsolationSettings/settings.json @@ -0,0 +1,84 @@ +{ + "resourceName": "PPTenantIsolationSettings", + "description": "", + "permissions": [ + { + "read": [ + { + "name": "DeviceManagementApps.Read.All" + }, + { + "name": "DeviceManagementApps.ReadWrite.All" + }, + { + "name": "DeviceManagementManagedDevices.Read.All" + }, + { + "name": "DeviceManagementManagedDevices.ReadWrite.All" + }, + { + "name": "DeviceManagementServiceConfig.Read.All" + }, + { + "name": "DeviceManagementServiceConfig.ReadWrite.All" + }, + { + "name": "Directory.AccessAsUser.All" + }, + { + "name": "Directory.Read.All" + }, + { + "name": "Directory.ReadWrite.All" + }, + { + "name": "User.Read.All" + }, + { + "name": "User.ReadBasic.All" + }, + { + "name": "User.ReadWrite.All" + } + ], + "update": [ + { + "name": "DeviceManagementApps.Read.All" + }, + { + "name": "DeviceManagementApps.ReadWrite.All" + }, + { + "name": "DeviceManagementManagedDevices.Read.All" + }, + { + "name": "DeviceManagementManagedDevices.ReadWrite.All" + }, + { + "name": "DeviceManagementServiceConfig.Read.All" + }, + { + "name": "DeviceManagementServiceConfig.ReadWrite.All" + }, + { + "name": "Directory.AccessAsUser.All" + }, + { + "name": "Directory.Read.All" + }, + { + "name": "Directory.ReadWrite.All" + }, + { + "name": "User.Read.All" + }, + { + "name": "User.ReadBasic.All" + }, + { + "name": "User.ReadWrite.All" + } + ] + } + ] +} diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsFederationConfiguration/settings.json b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsFederationConfiguration/settings.json index ba087fab41..9eec856929 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsFederationConfiguration/settings.json +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsFederationConfiguration/settings.json @@ -1,10 +1,10 @@ { - "resourceName": "TeamsFederationConfiguration", - "description": "", - "permissions": [ - { - "read": [], - "update": [] - } - ] + "resourceName": "TeamsFederationConfiguration", + "description": "", + "permissions": [ + { + "read": [], + "update": [] + } + ] } diff --git a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 index 8737efb79e..56c76b8a68 100644 --- a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 +++ b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 @@ -62,11 +62,11 @@ }, @{ ModuleName = "Microsoft.PowerApps.Administration.PowerShell" - RequiredVersion = "2.0.142" + RequiredVersion = "2.0.144" }, @{ ModuleName = "MicrosoftTeams" - RequiredVersion = "4.0.0" + RequiredVersion = "4.1.0" }, @{ ModuleName = "MSCloudLoginAssistant" @@ -74,7 +74,7 @@ }, @{ ModuleName = "PnP.PowerShell" - RequiredVersion = "1.9.0" + RequiredVersion = "1.10.0" }, @{ ModuleName = "ReverseDSC" diff --git a/Modules/Microsoft365DSC/Examples/Resources/EXOMalwareFilterPolicy/1-ConfigureMalwareFilterPolicy.ps1 b/Modules/Microsoft365DSC/Examples/Resources/EXOMalwareFilterPolicy/1-ConfigureMalwareFilterPolicy.ps1 index 8df4fa33ca..bee8ff98b5 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/EXOMalwareFilterPolicy/1-ConfigureMalwareFilterPolicy.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/EXOMalwareFilterPolicy/1-ConfigureMalwareFilterPolicy.ps1 @@ -25,6 +25,7 @@ Configuration Example EnableInternalSenderAdminNotifications = $False EnableInternalSenderNotifications = $False FileTypes = @("ace", "ani", "app", "cab", "docm", "exe", "iso", "jar", "jnlp", "reg", "scr", "vbe", "vbs") + QuarantineTag = "AdminOnlyAccessPolicy" ZapEnabled = $True Ensure = "Present" Credential = $credsGlobalAdmin diff --git a/Modules/Microsoft365DSC/Examples/Resources/PPTenantIsolationSettings/1-ConfigurePPTenantIsolationSettings.ps1 b/Modules/Microsoft365DSC/Examples/Resources/PPTenantIsolationSettings/1-ConfigurePPTenantIsolationSettings.ps1 new file mode 100644 index 0000000000..9b9019e1d6 --- /dev/null +++ b/Modules/Microsoft365DSC/Examples/Resources/PPTenantIsolationSettings/1-ConfigurePPTenantIsolationSettings.ps1 @@ -0,0 +1,35 @@ +<# +This example sets Power Platform tenant isolation settings. +#> + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $credsGlobalAdmin + ) + Import-DscResource -ModuleName Microsoft365DSC + + node localhost + { + PPTenantIsolationSettings 'PowerPlatformTenantSettings' + { + IsSingleInstance = 'Yes' + Enable = $true + Rules = @( + MSFT_PPTenantRule + { + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Outbound' + } + MSFT_PPTenantRule + { + TenantName = 'fabrikam.onmicrosoft.com' + Direction = 'Both' + } + ) + Credential = $credsGlobalAdmin + } + } +} diff --git a/Modules/Microsoft365DSC/Examples/Resources/PPTenantIsolationSettings/2-ConfigurePPTenantIsolationSettings.ps1 b/Modules/Microsoft365DSC/Examples/Resources/PPTenantIsolationSettings/2-ConfigurePPTenantIsolationSettings.ps1 new file mode 100644 index 0000000000..a8369bd6c4 --- /dev/null +++ b/Modules/Microsoft365DSC/Examples/Resources/PPTenantIsolationSettings/2-ConfigurePPTenantIsolationSettings.ps1 @@ -0,0 +1,37 @@ +<# +This example sets Power Platform tenant isolation settings. +#> + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $credsGlobalAdmin + ) + Import-DscResource -ModuleName Microsoft365DSC + + node localhost + { + PPTenantIsolationSettings 'PowerPlatformTenantSettings' + { + IsSingleInstance = 'Yes' + Enable = $true + RulesToInclude = @( + MSFT_PPTenantRule + { + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Inbound' + } + ) + RulesToExclude = @( + MSFT_PPTenantRule + { + TenantName = 'fabrikam.onmicrosoft.com' + Direction = 'Both' + } + ) + Credential = $credsGlobalAdmin + } + } +} diff --git a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 index f6417ee701..5bbd310faa 100644 --- a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 +++ b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 2022-03-23 +# Generated on: 2022-04-06 @{ @@ -11,7 +11,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '1.22.323.1' + ModuleVersion = '1.22.406.1' # Supported PSEditions # CompatiblePSEditions = @() @@ -132,11 +132,18 @@ IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true' # ReleaseNotes of this module - ReleaseNotes = "* EXOAuthenticationPolicy - * Initial release; - * EXOOrganizationConfig - * Added support for CustomerLockboxEnabled and DisablePlusAddressInRecipients parameters. - FIXES #1831" + ReleaseNotes = "* EXOMalwareFilterPolicy + * Add support for property QuarantineTag + * PPTenantIsolationSettings + * New resource + * MISC + * Updated Convert-M365DscHashtableToString function to also convert + Arrays and CimInstances to string. + * Updated permissions in settings.json files. + * DEPENDENCIES + * Updated Microsoft.PowerApps.Administration.PowerShell to 2.0.144. + * Updated MicrosoftTeams to 4.1.0. + * Updated PnP.PowerShell to 1.10.0." # Flag to indicate whether the module requires explicit user acceptance for install/update # RequireLicenseAcceptance = $false diff --git a/Modules/Microsoft365DSC/Modules/M365DSCPermissions.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCPermissions.psm1 index 7a919d95d9..2b605fb6a2 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCPermissions.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCPermissions.psm1 @@ -198,6 +198,8 @@ function Update-M365DSCResourcesSettingsJSON $files = Get-ChildItem -Path "$dscResourcesRoot\*.psm1" -Recurse Write-Verbose " Found $($files.Count) psm1 files" + $ignoredCmdlets = @("Get-MgContext") + foreach ($file in $files) { $readPermissions = @() @@ -225,10 +227,13 @@ function Update-M365DSCResourcesSettingsJSON $functionPermissions = @() foreach ($cmdlet in $cmdlets) { - $commands = Find-MgGraphCommand -Command $cmdlet + if ($cmdlet -notin $ignoredCmdlets) + { + $commands = Find-MgGraphCommand -Command $cmdlet - $cmdletPermissions = $commands[0].Permissions - $functionPermissions += $cmdletPermissions.Name + $cmdletPermissions = $commands[0].Permissions + $functionPermissions += $cmdletPermissions.Name + } } $cleanFunctionPermissions = $functionPermissions | Sort-Object | Select-Object -Unique diff --git a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 index 32df6afcf3..3160d7c24f 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 @@ -79,7 +79,7 @@ function Get-TeamByName $loopCounter = 0 do { - $team = Get-Team -DisplayName $TeamName | Where-Object -FilterScript {$_.DisplayName -eq [System.Net.WebUtility]::UrlDecode($TeamName)} + $team = Get-Team -DisplayName $TeamName | Where-Object -FilterScript { $_.DisplayName -eq [System.Net.WebUtility]::UrlDecode($TeamName) } if ($null -eq $team) { Start-Sleep 5 @@ -130,12 +130,16 @@ function Convert-M365DscHashtableToString { if ($pair.Value -is [System.Array]) { - $str = "$($pair.Key)=($($pair.Value -join ","))" + $str = "$($pair.Key)=$(Convert-SPDscArrayToString -Array $pair.Value)" } elseif ($pair.Value -is [System.Collections.Hashtable]) { $str = "$($pair.Key)={$(Convert-M365DscHashtableToString -Hashtable $pair.Value)}" } + elseif ($pair.Value -is [Microsoft.Management.Infrastructure.CimInstance]) + { + $str = "$($pair.Key)=$(Convert-SPDscCIMInstanceToString -CIMInstance $pair.Value)" + } else { if ($null -eq $pair.Value) @@ -166,6 +170,81 @@ function Convert-M365DscHashtableToString return ($values -join "; ") } +<# +.Description +This function converts a parameter array to a string, for outputting to screen + +.Functionality +Internal +#> +function Convert-SPDscArrayToString +{ + param + ( + [Parameter()] + [System.Array] + $Array + ) + + $str = "(" + for ($i = 0; $i -lt $Array.Count; $i++) + { + $item = $Array[$i] + if ($item -is [System.Collections.Hashtable]) + { + $str += "{" + $str += Convert-SPDscHashtableToString -Hashtable $item + $str += "}" + } + elseif ($Array[$i] -is [Microsoft.Management.Infrastructure.CimInstance]) + { + $str += Convert-SPDscCIMInstanceToString -CIMInstance $item + } + else + { + $str += $item + } + + if ($i -lt ($Array.Count - 1)) + { + $str += "," + } + } + $str += ")" + + return $str +} + +<# +.Description +This function converts a parameter CimInstance to a string, for outputting to screen + +.Functionality +Internal +#> +function Convert-SPDscCIMInstanceToString +{ + param + ( + [Parameter()] + [Microsoft.Management.Infrastructure.CimInstance] + $CIMInstance + ) + + $str = "{" + foreach ($prop in $CIMInstance.CimInstanceProperties) + { + if ($str -notmatch "{$") + { + $str += "; " + } + $str += "$($prop.Name)=$($prop.Value)" + } + $str += "}" + + return $str +} + <# .Description @@ -3077,7 +3156,8 @@ function New-M365DSCCmdletDocumentation $ModulePath ) - if($null -eq $ModulePath){ + if ($null -eq $ModulePath) + { Import-Module Microsoft365Dsc -Force } else diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 index ed76c1709b..c90dd26928 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 @@ -63,7 +63,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } @@ -71,18 +71,18 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The application should exist but it does not" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "App1" - AvailableToOtherTenants = $false - GroupMembershipClaims = "0" - Homepage = "https://app.contoso.com" - IdentifierUris = "https://app.contoso.com" - KnownClientApplications = "" - LogoutURL = "https://app.contoso.com/logout" - Oauth2RequirePostResponse = $false - PublicClient = $false - ReplyURLs = @("https://app.contoso.com") - Ensure = "Present" - Credential = $Credential + DisplayName = "App1" + AvailableToOtherTenants = $false + GroupMembershipClaims = "0" + Homepage = "https://app.contoso.com" + IdentifierUris = "https://app.contoso.com" + KnownClientApplications = "" + LogoutURL = "https://app.contoso.com/logout" + Oauth2RequirePostResponse = $false + PublicClient = $false + ReplyURLs = @("https://app.contoso.com") + Ensure = "Present" + Credential = $Credential } Mock -CommandName Get-MgApplication -MockWith { @@ -106,19 +106,19 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The application exists but it should not" -Fixture { BeforeAll { $testParams = @{ - ObjectId = "5dcb2237-c61b-4258-9c85-eae2aaeba9d6" - DisplayName = "App1" - AvailableToOtherTenants = $false - GroupMembershipClaims = "0" - Homepage = "https://app.contoso.com" - IdentifierUris = "https://app.contoso.com" - KnownClientApplications = "" - LogoutURL = "https://app.contoso.com/logout" - Oauth2RequirePostResponse = $false - PublicClient = $false - ReplyURLs = "https://app.contoso.com" - Ensure = "Absent" - Credential = $Credential + ObjectId = "5dcb2237-c61b-4258-9c85-eae2aaeba9d6" + DisplayName = "App1" + AvailableToOtherTenants = $false + GroupMembershipClaims = "0" + Homepage = "https://app.contoso.com" + IdentifierUris = "https://app.contoso.com" + KnownClientApplications = "" + LogoutURL = "https://app.contoso.com/logout" + Oauth2RequirePostResponse = $false + PublicClient = $false + ReplyURLs = "https://app.contoso.com" + Ensure = "Absent" + Credential = $Credential } Mock -CommandName Get-MgApplication -MockWith { @@ -156,18 +156,18 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The app exists and values are already in the desired state" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "App1" - AvailableToOtherTenants = $false - GroupMembershipClaims = "0" - Homepage = "https://app.contoso.com" - IdentifierUris = "https://app.contoso.com" - KnownClientApplications = "" - LogoutURL = "https://app.contoso.com/logout" - Oauth2RequirePostResponse = $false - PublicClient = $false - ReplyURLs = "https://app.contoso.com" - Ensure = "Present" - Credential = $Credential + DisplayName = "App1" + AvailableToOtherTenants = $false + GroupMembershipClaims = "0" + Homepage = "https://app.contoso.com" + IdentifierUris = "https://app.contoso.com" + KnownClientApplications = "" + LogoutURL = "https://app.contoso.com/logout" + Oauth2RequirePostResponse = $false + PublicClient = $false + ReplyURLs = "https://app.contoso.com" + Ensure = "Present" + Credential = $Credential } Mock -CommandName Get-MgApplication -MockWith { @@ -204,18 +204,18 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values are not in the desired state" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "App1" - AvailableToOtherTenants = $false - GroupMembershipClaims = "0" - Homepage = "https://app1.contoso.com" #drift - IdentifierUris = "https://app.contoso.com" - KnownClientApplications = "" - LogoutURL = "https://app.contoso.com/logout" - Oauth2RequirePostResponse = $false - PublicClient = $false - ReplyURLs = "https://app.contoso.com" - Ensure = "Present" - Credential = $Credential + DisplayName = "App1" + AvailableToOtherTenants = $false + GroupMembershipClaims = "0" + Homepage = "https://app1.contoso.com" #drift + IdentifierUris = "https://app.contoso.com" + KnownClientApplications = "" + LogoutURL = "https://app.contoso.com/logout" + Oauth2RequirePostResponse = $false + PublicClient = $false + ReplyURLs = "https://app.contoso.com" + Ensure = "Present" + Credential = $Credential } Mock -CommandName Get-MgApplication -MockWith { @@ -253,16 +253,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Assigning Permissions to a new Application" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "App1" - AvailableToOtherTenants = $false - GroupMembershipClaims = "0" - IdentifierUris = "https://app.contoso.com" - KnownClientApplications = "" - LogoutURL = "https://app.contoso.com/logout" - Oauth2RequirePostResponse = $false - PublicClient = $false - ReplyURLs = "https://app.contoso.com" - Permissions = @(New-CimInstance -ClassName MSFT_AADApplicationPermission -Property @{ + DisplayName = "App1" + AvailableToOtherTenants = $false + GroupMembershipClaims = "0" + IdentifierUris = "https://app.contoso.com" + KnownClientApplications = "" + LogoutURL = "https://app.contoso.com/logout" + Oauth2RequirePostResponse = $false + PublicClient = $false + ReplyURLs = "https://app.contoso.com" + Permissions = @(New-CimInstance -ClassName MSFT_AADApplicationPermission -Property @{ Name = 'User.Read' Type = 'Delegated' SourceAPI = 'Microsoft Graph' @@ -281,8 +281,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdminConsentGranted = $True } -ClientOnly; ) - Ensure = "Present" - Credential = $Credential + Ensure = "Present" + Credential = $Credential } Mock -CommandName Get-MgApplication -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADConditionalAccessPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADConditionalAccessPolicy.Tests.ps1 index a9c854e3ea..a7819a04aa 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADConditionalAccessPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADConditionalAccessPolicy.Tests.ps1 @@ -35,7 +35,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-MgIdentityConditionalAccessPolicy -MockWith { @@ -415,7 +415,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ExcludePlatforms = @("Windows", "WindowsPhone", "MacOS") ExcludeRoles = @("Compliance Administrator") ExcludeUsers = "alexw@contoso.com" - Credential = $Credsglobaladmin + Credential = $Credsglobaladmin GrantControlOperator = "AND" Id = "bcc0cf19-ee89-46f0-8e12-4b89123ee6f9" IncludeApplications = @("All") diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADNamedLocationPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADNamedLocationPolicy.Tests.ps1 index 94a3d81b7b..0117a8e72d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADNamedLocationPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADNamedLocationPolicy.Tests.ps1 @@ -52,7 +52,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } @@ -64,12 +64,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The Policy should exist but it does not" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Company Network" - Ensure = "Present" - IpRanges = @("2.1.1.1/32", "1.2.2.2/32") - IsTrusted = $True - OdataType = "#microsoft.graph.ipNamedLocation" - Credential = $credsGlobalAdmin + DisplayName = "Company Network" + Ensure = "Present" + IpRanges = @("2.1.1.1/32", "1.2.2.2/32") + IsTrusted = $True + OdataType = "#microsoft.graph.ipNamedLocation" + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgIdentityConditionalAccessNamedLocation -MockWith { @@ -91,18 +91,18 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The Policy exists but it should not" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Company Network" - Ensure = "Absent" - IpRanges = @("2.1.1.1/32", "1.2.2.2/32") - IsTrusted = $True - OdataType = "#microsoft.graph.ipNamedLocation" - Credential = $credsGlobalAdmin + DisplayName = "Company Network" + Ensure = "Absent" + IpRanges = @("2.1.1.1/32", "1.2.2.2/32") + IsTrusted = $True + OdataType = "#microsoft.graph.ipNamedLocation" + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgIdentityConditionalAccessNamedLocation -MockWith { return @{ - DisplayName = "Company Network" - Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" + DisplayName = "Company Network" + Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" AdditionalProperties = @{ ipRanges = @(@{cidrAddress = "2.1.1.1/32" }, @{cidrAddress = "1.2.2.2/32" }) isTrusted = $True @@ -132,18 +132,18 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The Policy exists and values are already in the desired state" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Company Network" - Ensure = "Present" - IpRanges = @("2.1.1.1/32", "1.2.2.2/32") - IsTrusted = $True - OdataType = "#microsoft.graph.ipNamedLocation" - Credential = $credsGlobalAdmin + DisplayName = "Company Network" + Ensure = "Present" + IpRanges = @("2.1.1.1/32", "1.2.2.2/32") + IsTrusted = $True + OdataType = "#microsoft.graph.ipNamedLocation" + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgIdentityConditionalAccessNamedLocation -MockWith { return @{ - DisplayName = "Company Network" - Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" + DisplayName = "Company Network" + Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" AdditionalProperties = @{ ipRanges = @(@{cidrAddress = "2.1.1.1/32" }, @{cidrAddress = "1.2.2.2/32" }) isTrusted = $True @@ -168,22 +168,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values are not in the desired state" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Company Network" - Ensure = "Present" - IpRanges = @("2.1.1.1/32", "1.2.2.2/32") - IsTrusted = $True - OdataType = "#microsoft.graph.ipNamedLocation" - Credential = $credsGlobalAdmin + DisplayName = "Company Network" + Ensure = "Present" + IpRanges = @("2.1.1.1/32", "1.2.2.2/32") + IsTrusted = $True + OdataType = "#microsoft.graph.ipNamedLocation" + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgIdentityConditionalAccessNamedLocation -MockWith { return @{ - DisplayName = "Company Network" - Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" + DisplayName = "Company Network" + Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" AdditionalProperties = @{ - ipRanges = @(@{cidrAddress = "2.1.1.1/32" }, @{cidrAddress = "1.2.2.2/32" }) - isTrusted = $False - '@odata.type' = "#microsoft.graph.ipNamedLocation" + ipRanges = @(@{cidrAddress = "2.1.1.1/32" }, @{cidrAddress = "1.2.2.2/32" }) + isTrusted = $False + '@odata.type' = "#microsoft.graph.ipNamedLocation" } } } @@ -211,8 +211,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MgIdentityConditionalAccessNamedLocation -MockWith { return @{ - DisplayName = "Company Network" - Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" + DisplayName = "Company Network" + Id = "046956df-2367-4dd4-b7fd-c6175ec11cd5" AdditionalProperties = @{ ipRanges = @(@{cidrAddress = "2.1.1.1/32" }, @{cidrAddress = "1.2.2.2/32" }) isTrusted = $True diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADRoleDefinition.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADRoleDefinition.Tests.ps1 index 65f251f467..c40f04b919 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADRoleDefinition.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADRoleDefinition.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -55,7 +55,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } @@ -63,14 +63,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The role definition should exist but it does not" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Role1" - Description = "This is a custom role" - ResourceScopes = "/" - IsEnabled = $true - RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read","microsoft.directory/applicationPolicies/allProperties/update","microsoft.directory/applicationPolicies/basic/update" - Version = "1.0" - Ensure = "Present" - Credential = $Credential + DisplayName = "Role1" + Description = "This is a custom role" + ResourceScopes = "/" + IsEnabled = $true + RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read", "microsoft.directory/applicationPolicies/allProperties/update", "microsoft.directory/applicationPolicies/basic/update" + Version = "1.0" + Ensure = "Present" + Credential = $Credential } Mock -CommandName Get-MgRoleManagementDirectoryRoleDefinition -MockWith { @@ -94,15 +94,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The role definition exists but it should not" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Role1" - Description = "This is a custom role" - ResourceScopes = "/" - IsEnabled = $true - RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read","microsoft.directory/applicationPolicies/allProperties/update","microsoft.directory/applicationPolicies/basic/update" - Version = "1.0" - Ensure = "Absent" - Credential = $Credential - Id = "12345-12345-12345-12345-12345" + DisplayName = "Role1" + Description = "This is a custom role" + ResourceScopes = "/" + IsEnabled = $true + RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read", "microsoft.directory/applicationPolicies/allProperties/update", "microsoft.directory/applicationPolicies/basic/update" + Version = "1.0" + Ensure = "Absent" + Credential = $Credential + Id = "12345-12345-12345-12345-12345" } Mock -CommandName New-M365DSCConnection -MockWith { @@ -115,7 +115,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADRoleDef | Add-Member -MemberType NoteProperty -Name Description -Value "Role description" $AADRoleDef | Add-Member -MemberType NoteProperty -Name ResourceScopes -Value "/" $AADRoleDef | Add-Member -MemberType NoteProperty -Name IsEnabled -Value "True" - $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read","microsoft.directory/applicationPolicies/allProperties/update","microsoft.directory/applicationPolicies/basic/update"} + $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read", "microsoft.directory/applicationPolicies/allProperties/update", "microsoft.directory/applicationPolicies/basic/update" } $AADRoleDef | Add-Member -MemberType NoteProperty -Name Version -Value "1.0" $AADRoleDef | Add-Member -MemberType NoteProperty -Name Id -Value "12345-12345-12345-12345-12345" return $AADRoleDef @@ -139,14 +139,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The role definition exists and values are already in the desired state" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Role1" - Description = "This is a custom role" - ResourceScopes = "/" - IsEnabled = $true - RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read" - Version = "1.0" - Ensure = "Present" - Credential = $Credential + DisplayName = "Role1" + Description = "This is a custom role" + ResourceScopes = "/" + IsEnabled = $true + RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read" + Version = "1.0" + Ensure = "Present" + Credential = $Credential } Mock -CommandName New-M365DSCConnection -MockWith { @@ -159,7 +159,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADRoleDef | Add-Member -MemberType NoteProperty -Name Description -Value "This is a custom role" $AADRoleDef | Add-Member -MemberType NoteProperty -Name ResourceScopes -Value "/" $AADRoleDef | Add-Member -MemberType NoteProperty -Name IsEnabled -Value "True" - $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read"} + $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read" } $AADRoleDef | Add-Member -MemberType NoteProperty -Name Version -Value "1.0" return $AADRoleDef } @@ -178,14 +178,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values are not in the desired state" -Fixture { BeforeAll { $testParams = @{ - DisplayName = "Role1" - Description = "This is a custom role created by M365DSC."#drift - ResourceScopes = "/" - IsEnabled = $true - RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read","microsoft.directory/applicationPolicies/allProperties/update","microsoft.directory/applicationPolicies/basic/update" - Version = "1.0" - Ensure = "Present" - Credential = $Credential + DisplayName = "Role1" + Description = "This is a custom role created by M365DSC."#drift + ResourceScopes = "/" + IsEnabled = $true + RolePermissions = "microsoft.directory/applicationPolicies/allProperties/read", "microsoft.directory/applicationPolicies/allProperties/update", "microsoft.directory/applicationPolicies/basic/update" + Version = "1.0" + Ensure = "Present" + Credential = $Credential } Mock -CommandName New-M365DSCConnection -MockWith { @@ -198,7 +198,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADRoleDef | Add-Member -MemberType NoteProperty -Name Description -Value "This is a custom role" $AADRoleDef | Add-Member -MemberType NoteProperty -Name ResourceScopes -Value "/" $AADRoleDef | Add-Member -MemberType NoteProperty -Name IsEnabled -Value "True" - $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read","microsoft.directory/applicationPolicies/allProperties/update","microsoft.directory/applicationPolicies/basic/update"} + $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read", "microsoft.directory/applicationPolicies/allProperties/update", "microsoft.directory/applicationPolicies/basic/update" } $AADRoleDef | Add-Member -MemberType NoteProperty -Name Version -Value "1.0" return $AADRoleDef } @@ -235,7 +235,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADRoleDef | Add-Member -MemberType NoteProperty -Name Description -Value "This is a custom role" $AADRoleDef | Add-Member -MemberType NoteProperty -Name ResourceScopes -Value "/" $AADRoleDef | Add-Member -MemberType NoteProperty -Name IsEnabled -Value "True" - $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read","microsoft.directory/applicationPolicies/allProperties/update","microsoft.directory/applicationPolicies/basic/update"} + $AADRoleDef | Add-Member -MemberType NoteProperty -Name RolePermissions -Value @{AllowedResourceActions = "microsoft.directory/applicationPolicies/allProperties/read", "microsoft.directory/applicationPolicies/allProperties/update", "microsoft.directory/applicationPolicies/basic/update" } $AADRoleDef | Add-Member -MemberType NoteProperty -Name Version -Value "1.0" return $AADRoleDef } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADServicePrincipal.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADServicePrincipal.Tests.ps1 index 66ae49a4c5..1a90a45a6a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADServicePrincipal.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADServicePrincipal.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -45,7 +45,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } @@ -53,22 +53,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The service principal should exist but it does not" -Fixture { BeforeAll { $testParams = @{ - AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" - DisplayName = "App1" - AlternativeNames = "AlternativeName1","AlternativeName2" - AccountEnabled = $true - AppRoleAssignmentRequired = $false - ErrorUrl = "" - Homepage = "https://app1.contoso.com" - LogoutUrl = "https://app1.contoso.com/logout" - PublisherName = "Contoso" - ReplyURLs = "https://app1.contoso.com" - SamlMetadataURL = "" - ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" - ServicePrincipalType = "Application" - Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" - Ensure = "Present" - Credential = $credsGlobalAdmin + AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" + DisplayName = "App1" + AlternativeNames = "AlternativeName1", "AlternativeName2" + AccountEnabled = $true + AppRoleAssignmentRequired = $false + ErrorUrl = "" + Homepage = "https://app1.contoso.com" + LogoutUrl = "https://app1.contoso.com/logout" + PublisherName = "Contoso" + ReplyURLs = "https://app1.contoso.com" + SamlMetadataURL = "" + ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" + ServicePrincipalType = "Application" + Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" + Ensure = "Present" + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgServicePrincipal -MockWith { @@ -92,22 +92,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The application exists but it should not" -Fixture { BeforeAll { $testParams = @{ - AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" - DisplayName = "App1" - AlternativeNames = "AlternativeName1","AlternativeName2" - AccountEnabled = $true - AppRoleAssignmentRequired = $false - ErrorUrl = "" - Homepage = "https://app1.contoso.com" - LogoutUrl = "https://app1.contoso.com/logout" - PublisherName = "Contoso" - ReplyURLs = "https://app1.contoso.com" - SamlMetadataURL = "" - ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" - ServicePrincipalType = "Application" - Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" - Ensure = "Absent" - Credential = $credsGlobalAdmin + AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" + DisplayName = "App1" + AlternativeNames = "AlternativeName1", "AlternativeName2" + AccountEnabled = $true + AppRoleAssignmentRequired = $false + ErrorUrl = "" + Homepage = "https://app1.contoso.com" + LogoutUrl = "https://app1.contoso.com/logout" + PublisherName = "Contoso" + ReplyURLs = "https://app1.contoso.com" + SamlMetadataURL = "" + ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" + ServicePrincipalType = "Application" + Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" + Ensure = "Absent" + Credential = $credsGlobalAdmin } Mock -CommandName New-M365DSCConnection -MockWith { @@ -119,7 +119,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADSP | Add-Member -MemberType NoteProperty -Name AppId -Value "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" $AADSP | Add-Member -MemberType NoteProperty -Name Id -Value "5dcb2237-c61b-4258-9c85-eae2aaeba9d6" $AADSP | Add-Member -MemberType NoteProperty -Name DisplayName -Value "App1" - $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1","AlternativeName2" + $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1", "AlternativeName2" $AADSP | Add-Member -MemberType NoteProperty -Name AccountEnabled -Value $true $AADSP | Add-Member -MemberType NoteProperty -Name AppRoleAssignmentRequired -Value $false $AADSP | Add-Member -MemberType NoteProperty -Name ErrorUrl -Value "" @@ -152,22 +152,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The app exists and values are already in the desired state" -Fixture { BeforeAll { $testParams = @{ - AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" - DisplayName = "App1" - AlternativeNames = "AlternativeName1","AlternativeName2" - AccountEnabled = $true - AppRoleAssignmentRequired = $false - ErrorUrl = "" - Homepage = "https://app1.contoso.com" - LogoutUrl = "https://app1.contoso.com/logout" - PublisherName = "Contoso" - ReplyURLs = "https://app1.contoso.com" - SamlMetadataURL = "" - ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" - ServicePrincipalType = "Application" - Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" - Ensure = "Present" - Credential = $credsGlobalAdmin + AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" + DisplayName = "App1" + AlternativeNames = "AlternativeName1", "AlternativeName2" + AccountEnabled = $true + AppRoleAssignmentRequired = $false + ErrorUrl = "" + Homepage = "https://app1.contoso.com" + LogoutUrl = "https://app1.contoso.com/logout" + PublisherName = "Contoso" + ReplyURLs = "https://app1.contoso.com" + SamlMetadataURL = "" + ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" + ServicePrincipalType = "Application" + Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" + Ensure = "Present" + Credential = $credsGlobalAdmin } Mock -CommandName New-M365DSCConnection -MockWith { @@ -179,7 +179,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADSP | Add-Member -MemberType NoteProperty -Name AppId -Value "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" $AADSP | Add-Member -MemberType NoteProperty -Name Id -Value "5dcb2237-c61b-4258-9c85-eae2aaeba9d6" $AADSP | Add-Member -MemberType NoteProperty -Name DisplayName -Value "App1" - $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1","AlternativeName2" + $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1", "AlternativeName2" $AADSP | Add-Member -MemberType NoteProperty -Name AccountEnabled -Value $true $AADSP | Add-Member -MemberType NoteProperty -Name AppRoleAssignmentRequired -Value $false $AADSP | Add-Member -MemberType NoteProperty -Name ErrorUrl -Value "" @@ -208,22 +208,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values are not in the desired state" -Fixture { BeforeAll { $testParams = @{ - AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" - DisplayName = "App1" - AlternativeNames = "AlternativeName1","AlternativeName2","AlternativeName3" #drift - AccountEnabled = $true - AppRoleAssignmentRequired = $false - ErrorUrl = "" - Homepage = "https://app1.contoso.com" - LogoutUrl = "https://app1.contoso.com/logout" - PublisherName = "Contoso" - ReplyURLs = "https://app1.contoso.com" - SamlMetadataURL = "" - ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" - ServicePrincipalType = "Application" - Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" - Ensure = "Present" - Credential = $credsGlobalAdmin + AppId = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" + DisplayName = "App1" + AlternativeNames = "AlternativeName1", "AlternativeName2", "AlternativeName3" #drift + AccountEnabled = $true + AppRoleAssignmentRequired = $false + ErrorUrl = "" + Homepage = "https://app1.contoso.com" + LogoutUrl = "https://app1.contoso.com/logout" + PublisherName = "Contoso" + ReplyURLs = "https://app1.contoso.com" + SamlMetadataURL = "" + ServicePrincipalNames = "b4f08c68-7276-4cb8-b9ae-e75fca5ff834", "https://app1.contoso.com" + ServicePrincipalType = "Application" + Tags = "{WindowsAzureActiveDirectoryIntegratedApp}" + Ensure = "Present" + Credential = $credsGlobalAdmin } Mock -CommandName New-M365DSCConnection -MockWith { @@ -234,7 +234,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADSP = New-Object PSCustomObject $AADSP | Add-Member -MemberType NoteProperty -Name AppId -Value "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" $AADSP | Add-Member -MemberType NoteProperty -Name Id -Value "5dcb2237-c61b-4258-9c85-eae2aaeba9d6" - $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1","AlternativeName2" + $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1", "AlternativeName2" $AADSP | Add-Member -MemberType NoteProperty -Name AccountEnabled -Value $true $AADSP | Add-Member -MemberType NoteProperty -Name AppRoleAssignmentRequired -Value $false $AADSP | Add-Member -MemberType NoteProperty -Name ErrorUrl -Value "" @@ -280,7 +280,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $AADSP | Add-Member -MemberType NoteProperty -Name AppId -Value "b4f08c68-7276-4cb8-b9ae-e75fca5ff834" $AADSP | Add-Member -MemberType NoteProperty -Name Id -Value "5dcb2237-c61b-4258-9c85-eae2aaeba9d6" $AADSP | Add-Member -MemberType NoteProperty -Name DisplayName -Value "App1" - $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1","AlternativeName2" + $AADSP | Add-Member -MemberType NoteProperty -Name AlternativeNames -Value "AlternativeName1", "AlternativeName2" $AADSP | Add-Member -MemberType NoteProperty -Name AccountEnabled -Value $true $AADSP | Add-Member -MemberType NoteProperty -Name AppRoleAssignmentRequired -Value $false $AADSP | Add-Member -MemberType NoteProperty -Name ErrorUrl -Value "" diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTenantDetails.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTenantDetails.Tests.ps1 index da7b2ad4be..e1b45352d8 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTenantDetails.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTenantDetails.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -44,7 +44,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } @@ -52,20 +52,20 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values should exist but it does not" -Fixture { BeforeAll { $testParams = @{ - TechnicalNotificationMails = "exapmle@contoso.com" - SecurityComplianceNotificationPhones = "+1123456789" - SecurityComplianceNotificationMails = "exapmle@contoso.com" - MarketingNotificationEmails = "exapmle@contoso.com" - Credential = $Credential - IsSingleInstance = 'Yes' + TechnicalNotificationMails = "exapmle@contoso.com" + SecurityComplianceNotificationPhones = "+1123456789" + SecurityComplianceNotificationMails = "exapmle@contoso.com" + MarketingNotificationEmails = "exapmle@contoso.com" + Credential = $Credential + IsSingleInstance = 'Yes' } Mock -CommandName Get-MgOrganization -MockWith { $result = @{ - MarketingNotificationEmails = "" - SecurityComplianceNotificationMails = "" - SecurityComplianceNotificationPhones = "" - TechnicalNotificationMails = "" + MarketingNotificationEmails = "" + SecurityComplianceNotificationMails = "" + SecurityComplianceNotificationPhones = "" + TechnicalNotificationMails = "" } return $result } @@ -79,11 +79,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values exists but it should not" -Fixture { BeforeAll { $testParams = @{ - TechnicalNotificationMails = "exapmle@contoso.com" - SecurityComplianceNotificationPhones = "+1123456789" - SecurityComplianceNotificationMails = "exapmle@contoso.com" - Credential = $Credential - IsSingleInstance = 'Yes' + TechnicalNotificationMails = "exapmle@contoso.com" + SecurityComplianceNotificationPhones = "+1123456789" + SecurityComplianceNotificationMails = "exapmle@contoso.com" + Credential = $Credential + IsSingleInstance = 'Yes' } Mock -CommandName Get-MgOrganization -MockWith { @@ -104,12 +104,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values exists and values are already in the desired state" -Fixture { BeforeAll { $testParams = @{ - TechnicalNotificationMails = "exapmle@contoso.com" - SecurityComplianceNotificationPhones = "+1123456789" - SecurityComplianceNotificationMails = "exapmle@contoso.com" - MarketingNotificationEmails = "exapmle@contoso.com" - Credential = $Credential - IsSingleInstance = 'Yes' + TechnicalNotificationMails = "exapmle@contoso.com" + SecurityComplianceNotificationPhones = "+1123456789" + SecurityComplianceNotificationMails = "exapmle@contoso.com" + MarketingNotificationEmails = "exapmle@contoso.com" + Credential = $Credential + IsSingleInstance = 'Yes' } Mock -CommandName Get-MgOrganization -MockWith { @@ -135,12 +135,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Values are not in the desired state" -Fixture { BeforeAll { $testParams = @{ - TechnicalNotificationMails = "exapmle@contoso.com" - SecurityComplianceNotificationPhones = "+1123456789" - SecurityComplianceNotificationMails = "exapmle@contoso.com" - MarketingNotificationEmails = "NOTexapmle@contoso.com" #Drift - Credential = $Credential - IsSingleInstance = 'Yes' + TechnicalNotificationMails = "exapmle@contoso.com" + SecurityComplianceNotificationPhones = "+1123456789" + SecurityComplianceNotificationMails = "exapmle@contoso.com" + MarketingNotificationEmails = "NOTexapmle@contoso.com" #Drift + Credential = $Credential + IsSingleInstance = 'Yes' } Mock -CommandName Get-MgOrganization -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTokenLifetimePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTokenLifetimePolicy.Tests.ps1 index d574b36d14..4821dcab41 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTokenLifetimePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADTokenLifetimePolicy.Tests.ps1 @@ -56,7 +56,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } @@ -69,7 +69,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Definition = @('{"TokenIssuancePolicy":{"Version": 1,"SigningAlgorithm": "http://www.w3.org/2000/09/xmldsig#rsa-sha1","TokenResponseSigningPolicy": "TokenOnly","SamlTokenVersion": "2.0"}}') IsOrganizationDefault = $false Ensure = "Present" - Credential = $credsGlobalAdmin + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgPolicyTokenLifetimePolicy -MockWith { @@ -97,7 +97,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { IsOrganizationDefault = $false Description = "My token" Ensure = "Absent" - Credential = $credsGlobalAdmin + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgPolicyTokenLifetimePolicy -MockWith { @@ -134,7 +134,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { IsOrganizationDefault = $false Description = "My token" Ensure = "Present" - Credential = $credsGlobalAdmin + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgPolicyTokenLifetimePolicy -MockWith { @@ -167,7 +167,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { IsOrganizationDefault = $true Description = "My token" Ensure = "Present" - Credential = $credsGlobalAdmin + Credential = $credsGlobalAdmin } Mock -CommandName Get-MgPolicyTokenLifetimePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAcceptedDomain.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAcceptedDomain.Tests.ps1 index 8f5bf15570..2949a437d4 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAcceptedDomain.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAcceptedDomain.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { @@ -52,10 +52,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Authoritative Accepted Domain should exist. Domain is missing. Test should fail." -Fixture { BeforeAll { $testParams = @{ - DomainType = 'Authoritative' - Ensure = 'Present' + DomainType = 'Authoritative' + Ensure = 'Present' Credential = $Credential - Identity = 'contoso.com' + Identity = 'contoso.com' } Mock -CommandName Get-MgDomain -MockWith { @@ -75,10 +75,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Set-AcceptedDomain -MockWith { return @{ - DomainType = 'Authoritative' - Ensure = 'Present' + DomainType = 'Authoritative' + Ensure = 'Present' Credential = $Credential - Identity = 'contoso.com' + Identity = 'contoso.com' } } } @@ -99,12 +99,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Verified domain doesn't exist in the tenant." -Fixture { BeforeAll { $testParams = @{ - DomainType = 'Authoritative' - Ensure = 'Absent' - MatchSubDomain = $false - OutboundOnly = $false - Credential = $Credential - Identity = 'contoso.com' + DomainType = 'Authoritative' + Ensure = 'Absent' + MatchSubDomain = $false + OutboundOnly = $false + Credential = $Credential + Identity = 'contoso.com' } Mock -CommandName Get-AcceptedDomain -MockWith { @@ -132,12 +132,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Authoritative Accepted Domain should exist. Domain exists. Test should pass." -Fixture { BeforeAll { $testParams = @{ - DomainType = 'Authoritative' - Ensure = 'Present' - MatchSubDomain = $false - OutboundOnly = $false - Credential = $Credential - Identity = 'contoso.com' + DomainType = 'Authoritative' + Ensure = 'Present' + MatchSubDomain = $false + OutboundOnly = $false + Credential = $Credential + Identity = 'contoso.com' } Mock -CommandName Get-MgDomain -MockWith { @@ -170,10 +170,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Authoritative Accepted Domain should exist. Domain exists, DomainType and MatchSubDomains mismatch. Test should fail." -Fixture { BeforeAll { $testParams = @{ - DomainType = 'Authoritative' - Ensure = 'Present' + DomainType = 'Authoritative' + Ensure = 'Present' Credential = $Credential - Identity = 'contoso.com' + Identity = 'contoso.com' } Mock -CommandName Get-MgDomain -MockWith { @@ -194,10 +194,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Set-AcceptedDomain -MockWith { return @{ - DomainType = 'Authoritative' - Ensure = 'Present' + DomainType = 'Authoritative' + Ensure = 'Present' Credential = $Credential - Identity = 'contoso.com' + Identity = 'contoso.com' } } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOActiveSyncDeviceAccessRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOActiveSyncDeviceAccessRule.Tests.ps1 index d6590b051f..b4207211ea 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOActiveSyncDeviceAccessRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOActiveSyncDeviceAccessRule.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -19,7 +19,7 @@ $Global:DscHelper = New-M365DscUnitTestHelper -StubModule $CmdletModule ` Describe -Name $Global:DscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:DscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:DscHelper.InitializeScript -NoNewScope - BeforeAll{ + BeforeAll { $secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd) @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { @@ -52,12 +52,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Active Sync Device Access Rule should exist. Active Sync Device Access Rule is missing. Test should fail." -Fixture { BeforeAll { $testParams = @{ - Identity = 'ContosoPhone' - AccessLevel = 'Allow' - Characteristic = 'DeviceOS' - QueryString = 'iOS 6.1 10B145' - Ensure = 'Present' - Credential = $Credential + Identity = 'ContosoPhone' + AccessLevel = 'Allow' + Characteristic = 'DeviceOS' + QueryString = 'iOS 6.1 10B145' + Ensure = 'Present' + Credential = $Credential } Mock -CommandName Get-ActiveSyncDeviceAccessRule -MockWith { @@ -70,12 +70,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Set-ActiveSyncDeviceAccessRule -MockWith { return @{ - Identity = 'ContosoPhone' - AccessLevel = 'Allow' - Characteristic = 'DeviceOS' - QueryString = 'iOS 6.1 10B145' - Ensure = 'Present' - Credential = $Credential + Identity = 'ContosoPhone' + AccessLevel = 'Allow' + Characteristic = 'DeviceOS' + QueryString = 'iOS 6.1 10B145' + Ensure = 'Present' + Credential = $Credential } } } @@ -96,12 +96,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Active Sync Device Access Rule should exist. Active Sync Device Access Rule exists. Test should pass." -Fixture { BeforeAll { $testParams = @{ - Identity = 'ContosoPhone' - AccessLevel = 'Allow' - Characteristic = 'DeviceOS' - QueryString = 'iOS 6.1 10B145' - Ensure = 'Present' - Credential = $Credential + Identity = 'ContosoPhone' + AccessLevel = 'Allow' + Characteristic = 'DeviceOS' + QueryString = 'iOS 6.1 10B145' + Ensure = 'Present' + Credential = $Credential } Mock -CommandName Get-ActiveSyncDeviceAccessRule -MockWith { @@ -126,12 +126,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Active Sync Device Access Rule should exist. Active Sync Device Access Rule exists, AccessLevel mismatch. Test should fail." -Fixture { BeforeAll { $testParams = @{ - Identity = 'ContosoPhone' - AccessLevel = 'Allow' - Characteristic = 'DeviceOS' - QueryString = 'iOS 6.1 10B145' - Ensure = 'Present' - Credential = $Credential + Identity = 'ContosoPhone' + AccessLevel = 'Allow' + Characteristic = 'DeviceOS' + QueryString = 'iOS 6.1 10B145' + Ensure = 'Present' + Credential = $Credential } Mock -CommandName Get-ActiveSyncDeviceAccessRule -MockWith { @@ -144,12 +144,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Set-ActiveSyncDeviceAccessRule -MockWith { return @{ - Identity = 'ContosoPhone' - AccessLevel = 'Allow' - Characteristic = 'DeviceOS' - QueryString = 'iOS 6.1 10B145' - Ensure = 'Present' - Credential = $Credential + Identity = 'ContosoPhone' + AccessLevel = 'Allow' + Characteristic = 'DeviceOS' + QueryString = 'iOS 6.1 10B145' + Ensure = 'Present' + Credential = $Credential } } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressBookPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressBookPolicy.Tests.ps1 index 944fa9c440..280234009d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressBookPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressBookPolicy.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { @@ -59,7 +59,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { OfflineAddressBook = "\Contoso-All-OAB" RoomList = "\All Contoso-Rooms" Ensure = 'Present' - Credential = $Credential + Credential = $Credential } Mock -CommandName Get-AddressBookPolicy -MockWith { @@ -81,7 +81,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { OfflineAddressBook = "\Contoso-All-OAB" RoomList = "\All Contoso-Rooms" Ensure = 'Present' - Credential = $Credential + Credential = $Credential } } } @@ -108,7 +108,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { OfflineAddressBook = "\Contoso-All-OAB" RoomList = "\All Contoso-Rooms" Ensure = 'Present' - Credential = $Credential + Credential = $Credential } Mock -CommandName Get-AddressBookPolicy -MockWith { @@ -140,7 +140,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { OfflineAddressBook = "\Contoso-All-OAB" RoomList = "\All Contoso-Rooms" Ensure = 'Present' - Credential = $Credential + Credential = $Credential } Mock -CommandName Get-AddressBookPolicy -MockWith { @@ -161,7 +161,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { OfflineAddressBook = "\Contoso-All-OAB" RoomList = "\All Contoso-Rooms" Ensure = 'Present' - Credential = $Credential + Credential = $Credential } } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressList.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressList.Tests.ps1 index e38c7f502f..3ffce12725 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressList.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAddressList.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { @@ -59,7 +59,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ConditionalStateOrProvince = 'US' IncludedRecipients = 'AllRecipients' Ensure = 'Present' - Credential = $Credential + Credential = $Credential } Mock -CommandName Get-AddressList -MockWith { @@ -80,7 +80,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ConditionalStateOrProvince = 'US' IncludedRecipients = 'AllRecipients' Ensure = 'Present' - Credential = $Credential + Credential = $Credential } } } @@ -107,7 +107,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ConditionalStateOrProvince = 'US' IncludedRecipients = 'AllRecipients' Ensure = 'Present' - Credential = $Credential + Credential = $Credential } Mock -CommandName Get-AddressList -MockWith { @@ -139,7 +139,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ConditionalStateOrProvince = 'US' IncludedRecipients = 'AllRecipients' Ensure = 'Present' - Credential = $Credential + Credential = $Credential } Mock -CommandName Get-AddressList -MockWith { @@ -159,7 +159,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ConditionalDepartment = 'HR' ConditionalStateOrProvince = 'US' IncludedRecipients = 'AllRecipients' - Credential = $Credential + Credential = $Credential } } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 index 25a021dff1..7b32531d2f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishPolicy.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { @@ -64,9 +64,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "AntiPhishPolicy creation." -Fixture { BeforeAll { $testParams = @{ - Ensure = 'Present' + Ensure = 'Present' Credential = $Credential - Identity = 'TestPolicy' + Identity = 'TestPolicy' } Mock -CommandName Get-AntiPhishPolicy -MockWith { @@ -94,7 +94,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BeforeAll { $testParams = @{ Ensure = 'Present' - Credential = $Credential + Credential = $Credential Identity = 'TestPolicy' PhishThresholdLevel = '2' AdminDisplayName = 'DSC Test Policy' @@ -119,29 +119,29 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-AntiPhishPolicy -MockWith { return @{ - Ensure = 'Present' - Identity = 'TestPolicy' - PhishThresholdLevel = '2' - AdminDisplayName = 'DSC Test Policy' - Enabled = $true - EnableFirstContactSafetyTips = $false - EnableAuthenticationSafetyTip = $true - EnableMailboxIntelligence = $true - EnableOrganizationDomainsProtection = $false - EnableSimilarDomainsSafetyTips = $false - EnableSimilarUsersSafetyTips = $false - EnableTargetedDomainsProtection = $false - EnableTargetedUserProtection = $false - EnableUnusualCharactersSafetyTips = $false - EnableViaTag = $false - IsDefault = $false - TreatSoftPassAsAuthenticated = $true - AuthenticationFailAction = 'Quarantine' - TargetedDomainActionRecipients = @('test@contoso.com', 'test@fabrikam.com') - TargetedUserProtectionAction = 'BccMessage' - TargetedUserActionRecipients = @('test@contoso.com', 'test@fabrikam.com') - TargetedDomainsToProtect = @('fabrikam.com', 'contoso.com') - TargetedUsersToProtect = @('fabrikam.com', 'contoso.com') + Ensure = 'Present' + Identity = 'TestPolicy' + PhishThresholdLevel = '2' + AdminDisplayName = 'DSC Test Policy' + Enabled = $true + EnableFirstContactSafetyTips = $false + EnableAuthenticationSafetyTip = $true + EnableMailboxIntelligence = $true + EnableOrganizationDomainsProtection = $false + EnableSimilarDomainsSafetyTips = $false + EnableSimilarUsersSafetyTips = $false + EnableTargetedDomainsProtection = $false + EnableTargetedUserProtection = $false + EnableUnusualCharactersSafetyTips = $false + EnableViaTag = $false + IsDefault = $false + TreatSoftPassAsAuthenticated = $true + AuthenticationFailAction = 'Quarantine' + TargetedDomainActionRecipients = @('test@contoso.com', 'test@fabrikam.com') + TargetedUserProtectionAction = 'BccMessage' + TargetedUserActionRecipients = @('test@contoso.com', 'test@fabrikam.com') + TargetedDomainsToProtect = @('fabrikam.com', 'contoso.com') + TargetedUsersToProtect = @('fabrikam.com', 'contoso.com') } } } @@ -155,7 +155,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BeforeAll { $testParams = @{ Ensure = 'Present' - Credential = $Credential + Credential = $Credential Identity = 'TestPolicy' PhishThresholdLevel = '2' AdminDisplayName = 'DSC Test Policy' @@ -223,9 +223,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "AntiPhishPolicy removal." -Fixture { BeforeAll { $testParams = @{ - Ensure = 'Absent' + Ensure = 'Absent' Credential = $Credential - Identity = 'TestPolicy' + Identity = 'TestPolicy' } Mock -CommandName Get-AntiPhishPolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishRule.Tests.ps1 index fb802ea02d..02c2a9ca16 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAntiPhishRule.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-AntiPhishRule -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOApplicationAccessPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOApplicationAccessPolicy.Tests.ps1 index d6f625e8ab..bd28052130 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOApplicationAccessPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOApplicationAccessPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAtpPolicyForO365.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAtpPolicyForO365.Tests.ps1 index a48badefd9..3fbf3a0468 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAtpPolicyForO365.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAtpPolicyForO365.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAuthenticationPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAuthenticationPolicy.Tests.ps1 index 2e07f53548..81187366c0 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAuthenticationPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAuthenticationPolicy.Tests.ps1 @@ -36,7 +36,7 @@ $Global:DscHelper = New-M365DscUnitTestHelper -StubModule $CmdletModule ` } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 index 3c6f649140..0ba405d253 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityAddressSpace.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 index f31b45c0c3..cff7178245 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOAvailabilityConfig.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOCASMailboxPlan.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOCASMailboxPlan.Tests.ps1 index 87edcfd4e1..53b1277d91 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOCASMailboxPlan.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOCASMailboxPlan.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-CASMailboxPlan -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 index bec4547447..536f901993 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOClientAccessRule.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 index 76c671fb9d..a5b7cd69cc 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXODkimSigningConfig.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOEmailAddressPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOEmailAddressPolicy.Tests.ps1 index fc36c2b72c..6bdd7a95bc 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOEmailAddressPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOEmailAddressPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOGlobalAddressList.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOGlobalAddressList.Tests.ps1 index 68fc1dc7bf..a329e50ec0 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOGlobalAddressList.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOGlobalAddressList.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedConnectionFilterPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedConnectionFilterPolicy.Tests.ps1 index d80ae7833c..c82a1a3e0d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedConnectionFilterPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedConnectionFilterPolicy.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 index b48ac0974f..3dd14e128a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterPolicy.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterRule.Tests.ps1 index 5e3bcae1d5..e1589421c8 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedContentFilterRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-HostedContentFilterRule -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterPolicy.Tests.ps1 index 8cd549ef5b..4e353ac083 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterRule.Tests.ps1 index 164287f35b..15dd54cb25 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOHostedOutboundSpamFilterRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-HostedOutboundSpamFilterRule -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOInboundConnector.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOInboundConnector.Tests.ps1 index e855b0ff30..dc35e244f8 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOInboundConnector.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOInboundConnector.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOIntraOrganizationConnector.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOIntraOrganizationConnector.Tests.ps1 index 2c8c602141..c8b57b4b88 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOIntraOrganizationConnector.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOIntraOrganizationConnector.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOJournalRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOJournalRule.Tests.ps1 index 08b8f70d7f..da293160bb 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOJournalRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOJournalRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailTips.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailTips.Tests.ps1 index 1a2eac1a06..16b380dbf6 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailTips.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailTips.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxPlan.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxPlan.Tests.ps1 index 8a83a421c1..7f8d1e6b9d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxPlan.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxPlan.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-MailboxPlan -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxSettings.Tests.ps1 index 3f9199cea9..e0e2ce945b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMailboxSettings.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterPolicy.Tests.ps1 index b1b58f9c29..e1f93547ea 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 index 4fc6619fa6..0dbe1625c3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMalwareFilterRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOManagementRole.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOManagementRole.Tests.ps1 index db4e079b4b..71bbf3a445 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOManagementRole.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOManagementRole.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMobileDeviceMailboxPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMobileDeviceMailboxPolicy.Tests.ps1 index 7d9e861b91..d07167e629 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMobileDeviceMailboxPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOMobileDeviceMailboxPolicy.Tests.ps1 @@ -39,7 +39,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOfflineAddressBook.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOfflineAddressBook.Tests.ps1 index a1ef688b71..fc25f85963 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOfflineAddressBook.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOfflineAddressBook.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOnPremisesOrganization.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOnPremisesOrganization.Tests.ps1 index 272546d1d4..a19e0bd0a3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOnPremisesOrganization.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOnPremisesOrganization.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationConfig.Tests.ps1 index 7814b1c12f..0f1a7bdde4 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationConfig.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationRelationship.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationRelationship.Tests.ps1 index 8ca5bc605e..2a747cdc3d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationRelationship.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOrganizationRelationship.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOutboundConnector.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOutboundConnector.Tests.ps1 index da708931af..32a7ae4e96 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOutboundConnector.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOutboundConnector.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOwaMailboxPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOwaMailboxPolicy.Tests.ps1 index 413bd5f02b..4c93e1a97e 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOwaMailboxPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOOwaMailboxPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPartnerApplication.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPartnerApplication.Tests.ps1 index 3a4460dc5a..98460dd3da 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPartnerApplication.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPartnerApplication.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPolicyTipConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPolicyTipConfig.Tests.ps1 index 3462aa7b6d..7453295dbe 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPolicyTipConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOPolicyTipConfig.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORemoteDomain.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORemoteDomain.Tests.ps1 index 6c05347a9d..f5ba696ecc 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORemoteDomain.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORemoteDomain.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORoleAssignmentPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORoleAssignmentPolicy.Tests.ps1 index cffb2af59c..25323d4e0b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORoleAssignmentPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXORoleAssignmentPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentPolicy.Tests.ps1 index c33b388fce..e9028bc88c 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentRule.Tests.ps1 index 290b01dd24..2fa5119321 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeAttachmentRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksPolicy.Tests.ps1 index 2e225a0ed1..841820fcc8 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksRule.Tests.ps1 index 55b57d56b6..73ddd064a9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSafeLinksRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharedMailbox.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharedMailbox.Tests.ps1 index 839c660852..aa09c3efb1 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharedMailbox.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharedMailbox.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharingPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharingPolicy.Tests.ps1 index 511315a68c..6471d93f59 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharingPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOSharingPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportConfig.Tests.ps1 index ba191d5c1a..7154a8c067 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportConfig.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportRule.Tests.ps1 index 451651c505..17f522a4f9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.EXOTransportRule.Tests.ps1 @@ -35,7 +35,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 index 12a6e1a9ce..19c12b8870 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceAppManagementTargetedManagedAppConfiguration -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppProtectionPolicyiOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppProtectionPolicyiOS.Tests.ps1 index 1bd14ed804..d4de3564ce 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppProtectionPolicyiOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppProtectionPolicyiOS.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-M365DSCIntuneAppProtectionPolicyiOS -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 index 7033c49342..afded77f24 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MGDeviceManagementDeviceCategory -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroid.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroid.Tests.ps1 index df1e4e5e52..61dd0a5291 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroid.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroid.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceCompliancePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 index 1de342e608..96e617b910 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceCompliancePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 index 4828151f31..8a01a1992e 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceCompliancePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 index 5dd8acf35d..a5bdc7c2eb 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceCompliancePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 index 477293e8c9..9546a91b2b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceCompliancePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 index 1fb897e505..c0b703191e 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceCompliancePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 index df21428144..e62455ba70 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Select-MGProfile -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 index 061814fce2..dfd16cd69d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-MgDeviceManagementDeviceConfiguration -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 index eb389d1839..d847d1ecf6 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-MgDeviceManagementDeviceConfiguration -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 index ad2c2dbc27..7746fe048d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceEnrollmentConfiguration -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 index 4427da7ee1..bd66ad9414 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgDeviceManagementDeviceEnrollmentConfiguration -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365AdminAuditLogConfig.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365AdminAuditLogConfig.Tests.ps1 index 2c6df139bb..bbf3fecbf4 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365AdminAuditLogConfig.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365AdminAuditLogConfig.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365Group.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365Group.Tests.ps1 index f988f0e770..00de32a19f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365Group.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365Group.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } @@ -265,7 +265,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { UserPrincipalName = "JohnSmith@contoso.onmicrosoft.com" } }, - @{ + @{ AdditionalProperties = @{ UserPrincipalName = "SecondUser@contoso.onmicrosoft.com" } @@ -274,7 +274,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-MgGroupOwner -MockWith { - return @{ + return @{ AdditionalProperties = @{ UserPrincipalName = "Bob.Houle@contoso.onmicrosoft.com" } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgCustomizationSetting.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgCustomizationSetting.Tests.ps1 index 861b25f94e..0c640d4f0c 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgCustomizationSetting.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365OrgCustomizationSetting.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365User.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365User.Tests.ps1 index 1a31016697..3db2b24ba2 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365User.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.O365User.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Update-MgUser -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.ODSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.ODSettings.Tests.ps1 index 34e99583f0..4fcdc430ac 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.ODSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.ODSettings.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-PnPTenantSyncClientRestriction -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPTenantIsolationSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPTenantIsolationSettings.Tests.ps1 new file mode 100644 index 0000000000..6d86c06ffe --- /dev/null +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPTenantIsolationSettings.Tests.ps1 @@ -0,0 +1,575 @@ +[CmdletBinding()] +param( +) +$M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` + -ChildPath '..\..\Unit' ` + -Resolve +$CmdletModule = (Join-Path -Path $M365DSCTestFolder ` + -ChildPath '\Stubs\Microsoft365.psm1' ` + -Resolve) +$GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` + -ChildPath '\Stubs\Generic.psm1' ` + -Resolve) +Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` + -ChildPath '\UnitTestHelper.psm1' ` + -Resolve) + +$Global:DscHelper = New-M365DscUnitTestHelper -StubModule $CmdletModule ` + -DscResource 'PPTenantIsolationSettings' -GenericStubModule $GenericStubPath + +Describe -Name $Global:DscHelper.DescribeHeader -Fixture { + InModuleScope -ModuleName $Global:DscHelper.ModuleName -ScriptBlock { + Invoke-Command -ScriptBlock $Global:DscHelper.InitializeScript -NoNewScope + + BeforeAll { + $secpasswd = ConvertTo-SecureString 'test@password1' -AsPlainText -Force + $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@contoso.onmicrosoft.com', $secpasswd) + + Mock -CommandName Get-MgContext -MockWith { + return @{ + TenantId = '12345678-1234-1234-1234-123456789012' + } + } + + Mock -CommandName New-M365DSCConnection -MockWith { + return 'Credentials' + } + + $Global:PartialExportFileName = "c:\TestPath" + + Mock -CommandName Save-M365DSCPartialExport -MockWith { + } + + function New-HashFromTenantName + { + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $TenantName + ) + + $stringAsStream = [System.IO.MemoryStream]::new() + $writer = [System.IO.StreamWriter]::new($stringAsStream) + $writer.Write($TenantName) + $writer.Flush() + $stringAsStream.Position = 0 + $hash = (Get-FileHash -InputStream $stringAsStream).Hash + + $hashAsGuid = "{0}-{1}-{2}-{3}-{4}" -f $hash.Substring(0, 8), $hash.Substring(8, 4), $hash.Substring(12, 4), $hash.Substring(16, 4), $hash.Substring(20, 12) + + return $hashAsGuid + } + } + + # Test contexts + Context -Name 'PP Tenant Isolation settings are not configured' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + Enable = $true + Rules = @( + (New-CimInstance -ClassName MSFT_PPTenantRule -Property @{ + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Outbound' + } -ClientOnly) + ) + Credential = $credsGlobalAdmin + } + + Mock -CommandName Set-PowerAppTenantIsolationPolicy -MockWith { + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $true + allowedTenants = @() + } + } + } + } + + It 'Should return Enabled=False from the Get method' { + (Get-TargetResource @testParams).Enabled | Should -Be $false + } + + It 'Should return false from the Test method' { + Test-TargetResource @testParams | Should -Be $false + } + + It 'Should enable the isolation settings and create a rule in Set method' { + Set-TargetResource @testParams + Should -Invoke -CommandName "Set-PowerAppTenantIsolationPolicy" -Exactly 1 + } + } + + Context -Name 'PP Tenant Isolation settings are correctly configured' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + Enable = $true + Rules = @( + (New-CimInstance -ClassName MSFT_PPTenantRule -Property @{ + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Outbound' + } -ClientOnly) + ) + Credential = $credsGlobalAdmin + } + + Mock -CommandName Set-PowerAppTenantIsolationPolicy -MockWith { + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $false + allowedTenants = @( + @{ + tenantId = New-HashFromTenantName -TenantName 'contoso.onmicrosoft.com' + tenantName = 'Contoso' + direction = @{ + inbound = $false + outbound = $true + } + } + ) + } + } + } + } + + It 'Should return Enabled=True and 1 rule from the Get method' { + $result = Get-TargetResource @testParams + $result.Enabled | Should -Be $true + $result.Rules.Count | Should -Be 1 + } + + It 'Should return true from the Test method' { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name 'PP Tenant Isolation settings are enabled, but with the incorrect rules' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + Enable = $false + Rules = @( + (New-CimInstance -ClassName MSFT_PPTenantRule -Property @{ + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Both' + } -ClientOnly) + ) + Credential = $credsGlobalAdmin + } + + Mock -CommandName Set-PowerAppTenantIsolationPolicy -MockWith { + $global:M365DSCTenantId = $TenantIsolationPolicy.properties.allowedTenants[0].tenantId + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $false + allowedTenants = @( + @{ + tenantId = New-HashFromTenantName -TenantName 'fabrikam.onmicrosoft.com' + tenantName = 'Fabrikam' + direction = @{ + inbound = $false + outbound = $true + } + } + ) + } + } + } + } + + It 'Should return Enabled=True and 1 rule from the Get method' { + $result = Get-TargetResource @testParams + $result.Enabled | Should -Be $true + $result.Rules.Count | Should -Be 1 + } + + It 'Should return true from the Test method' { + Test-TargetResource @testParams | Should -Be $false + } + + $global:M365DSCTenantId = "" + It 'Should enable the isolation settings and create a rule in Set method' { + Set-TargetResource @testParams + $global:M365DSCTenantId | Should -Be (New-HashFromTenantName -TenantName 'contoso.onmicrosoft.com') + Should -Invoke -CommandName "Set-PowerAppTenantIsolationPolicy" -Exactly 1 + } + } + + Context -Name 'PP Tenant Isolation settings RulesToInclude specified, but rule is not included' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + Enable = $true + RulesToInclude = @( + (New-CimInstance -ClassName MSFT_PPTenantRule -Property @{ + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Both' + } -ClientOnly) + ) + Credential = $credsGlobalAdmin + } + + Mock -CommandName Set-PowerAppTenantIsolationPolicy -MockWith { + $global:M365DSCTenantIds = $TenantIsolationPolicy.properties.allowedTenants.tenantId + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $false + allowedTenants = @( + @{ + tenantId = New-HashFromTenantName -TenantName 'fabrikam.onmicrosoft.com' + tenantName = 'Fabrikam' + direction = @{ + inbound = $false + outbound = $true + } + } + ) + } + } + } + } + + It 'Should return Enabled=True and 1 rule from the Get method' { + $result = Get-TargetResource @testParams + $result.Enabled | Should -Be $true + $result.Rules.Count | Should -Be 1 + } + + It 'Should return false from the Test method' { + Test-TargetResource @testParams | Should -Be $false + } + + $global:M365DSCTenantIds = "" + It 'Should add a rule in Set method' { + Set-TargetResource @testParams + $global:M365DSCTenantIds.Count | Should -Be 2 + Should -Invoke -CommandName "Set-PowerAppTenantIsolationPolicy" -Exactly 1 + } + } + + Context -Name 'PP Tenant Isolation settings RulesToInclude specified and rule is included' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + Enable = $true + RulesToInclude = @( + (New-CimInstance -ClassName MSFT_PPTenantRule -Property @{ + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Both' + } -ClientOnly) + ) + Credential = $credsGlobalAdmin + } + + Mock -CommandName Set-PowerAppTenantIsolationPolicy -MockWith { + $global:M365DSCTenantIds = $TenantIsolationPolicy.properties.allowedTenants.tenantId + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $false + allowedTenants = @( + @{ + tenantId = New-HashFromTenantName -TenantName 'contoso.onmicrosoft.com' + tenantName = 'Contoso' + direction = @{ + inbound = $true + outbound = $true + } + } + ) + } + } + } + } + + It 'Should return Enabled=True and 1 rule from the Get method' { + $result = Get-TargetResource @testParams + $result.Enabled | Should -Be $true + $result.Rules.Count | Should -Be 1 + } + + It 'Should return true from the Test method' { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name 'PP Tenant Isolation settings RulesToExclude specified, but rule is included' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + Enable = $true + RulesToExclude = @( + (New-CimInstance -ClassName MSFT_PPTenantRule -Property @{ + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Both' + } -ClientOnly) + ) + Credential = $credsGlobalAdmin + } + + Mock -CommandName Set-PowerAppTenantIsolationPolicy -MockWith { + $global:M365DSCTenantIds = $TenantIsolationPolicy.properties.allowedTenants.tenantId + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $false + allowedTenants = @( + @{ + tenantId = New-HashFromTenantName -TenantName 'fabrikam.onmicrosoft.com' + tenantName = 'Fabrikam' + direction = @{ + inbound = $false + outbound = $true + } + } + @{ + tenantId = New-HashFromTenantName -TenantName 'contoso.onmicrosoft.com' + tenantName = 'Contoso' + direction = @{ + inbound = $false + outbound = $true + } + } + ) + } + } + } + } + + It 'Should return Enabled=True and 1 rule from the Get method' { + $result = Get-TargetResource @testParams + $result.Enabled | Should -Be $true + $result.Rules.Count | Should -Be 2 + } + + It 'Should return false from the Test method' { + Test-TargetResource @testParams | Should -Be $false + } + + $global:M365DSCTenantIds = "" + It 'Should remove a rule in Set method' { + Set-TargetResource @testParams + $global:M365DSCTenantIds.Count | Should -Be 1 + Should -Invoke -CommandName "Set-PowerAppTenantIsolationPolicy" -Exactly 1 + } + } + + Context -Name 'PP Tenant Isolation settings RulesToExclude specified and rule is not included' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + Enable = $true + RulesToExclude = @( + (New-CimInstance -ClassName MSFT_PPTenantRule -Property @{ + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Both' + } -ClientOnly) + ) + Credential = $credsGlobalAdmin + } + + Mock -CommandName Set-PowerAppTenantIsolationPolicy -MockWith { + $global:M365DSCTenantIds = $TenantIsolationPolicy.properties.allowedTenants.tenantId + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $false + allowedTenants = @( + @{ + tenantId = New-HashFromTenantName -TenantName 'fabrikam.onmicrosoft.com' + tenantName = 'Fabrikam' + direction = @{ + inbound = $true + outbound = $true + } + } + ) + } + } + } + } + + It 'Should return Enabled=True and 1 rule from the Get method' { + $result = Get-TargetResource @testParams + $result.Enabled | Should -Be $true + $result.Rules.Count | Should -Be 1 + } + + It 'Should return true from the Test method' { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name 'ReverseDSC Tests' -Fixture { + BeforeAll { + $testParams = @{ + Credential = $Credential + } + + Mock -CommandName Invoke-WebRequest -MockWith { + if ($Uri -match "https://login.windows.net/([A-Za-z0-9.]*)/.well-known/openid-configuration") + { + $tenantid = (New-HashFromTenantName -TenantName $Matches[1]) + $returnval = '{{"token_endpoint":"https://login.windows.net/{0}/oauth2/token"}}' -f $tenantid + return $returnval + } + else + { + return $null + } + } + + Mock -CommandName Get-PowerAppTenantIsolationPolicy -MockWith { + return @{ + properties = @{ + tenantId = '12345678-1234-1234-1234-123456789012' + isDisabled = $false + allowedTenants = @( + @{ + tenantId = New-HashFromTenantName -TenantName 'fabrikam.onmicrosoft.com' + tenantName = 'Fabrikam' + direction = @{ + inbound = $false + outbound = $true + } + } + @{ + tenantId = New-HashFromTenantName -TenantName 'contoso.onmicrosoft.com' + tenantName = 'Contoso' + direction = @{ + inbound = $false + outbound = $true + } + } + ) + } + } + } + } + + It 'Should Reverse Engineer resource from the Export method' { + Export-TargetResource @testParams + } + } + } #inmodulescope +} #describe + +Invoke-Command -ScriptBlock $Global:DscHelper.CleanupScript -NoNewScope diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPTenantSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPTenantSettings.Tests.ps1 index 1e88478199..7fe384c90e 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPTenantSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPTenantSettings.Tests.ps1 @@ -2,195 +2,195 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath '..\..\Unit' ` - -Resolve + -ChildPath '..\..\Unit' ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath '\Stubs\Microsoft365.psm1' ` - -Resolve) + -ChildPath '\Stubs\Microsoft365.psm1' ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath '\Stubs\Generic.psm1' ` - -Resolve) + -ChildPath '\Stubs\Generic.psm1' ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` - -ChildPath '\UnitTestHelper.psm1' ` - -Resolve) + -ChildPath '\UnitTestHelper.psm1' ` + -Resolve) $Global:DscHelper = New-M365DscUnitTestHelper -StubModule $CmdletModule ` - -DscResource 'PPTenantSettings' -GenericStubModule $GenericStubPath + -DscResource 'PPTenantSettings' -GenericStubModule $GenericStubPath Describe -Name $Global:DscHelper.DescribeHeader -Fixture { - InModuleScope -ModuleName $Global:DscHelper.ModuleName -ScriptBlock { - Invoke-Command -ScriptBlock $Global:DscHelper.InitializeScript -NoNewScope - - BeforeAll { - $secpasswd = ConvertTo-SecureString 'test@password1' -AsPlainText -Force - $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin', $secpasswd) - - Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith { - return @{} - } - - Mock -CommandName Get-M365DSCExportContentForResource -MockWith { - - } - - Mock -CommandName New-M365DSCConnection -MockWith { - return 'Credential' - } - } - - # Test contexts - Context -Name 'PP Tenant settings are not configured' -Fixture { - BeforeAll { - $testParams = @{ - IsSingleInstance = 'Yes' - WalkMeOptOut = $false - DisableNPSCommentsReachout = $false - DisableNewsletterSendout = $false - DisableEnvironmentCreationByNonAdminUsers = $false - DisablePortalsCreationByNonAdminUsers = $false - DisableSurveyFeedback = $false - DisableTrialEnvironmentCreationByNonAdminUsers = $false - DisableCapacityAllocationByEnvironmentAdmins = $false - DisableSupportTicketsVisibleByAllUsers = $false - DisableDocsSearch = $false - DisableCommunitySearch = $false - DisableBingVideoSearch = $false - DisableShareWithEveryone = $false - EnableGuestsToMake = $false - ShareWithColleaguesUserLimit = 10000 - Credential = $Credential + InModuleScope -ModuleName $Global:DscHelper.ModuleName -ScriptBlock { + Invoke-Command -ScriptBlock $Global:DscHelper.InitializeScript -NoNewScope + + BeforeAll { + $secpasswd = ConvertTo-SecureString 'test@password1' -AsPlainText -Force + $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin', $secpasswd) + + Mock -CommandName Update-M365DSCExportAuthenticationResults -MockWith { + return @{} + } + + Mock -CommandName Get-M365DSCExportContentForResource -MockWith { + + } + + Mock -CommandName New-M365DSCConnection -MockWith { + return 'Credentials' + } } - Mock -CommandName Set-TenantSettings -MockWith { - return @{ - TenantSettings = @{ - WalkMeOptOut = $testParams.WalkMeOptOut - DisableNPSCommentsReachout = $testParams.DisableNPSCommentsReachout - DisableNewsletterSendout = $testParams.DisableNewsletterSendout - DisableEnvironmentCreationByNonAdminUsers = $testParams.DisableEnvironmentCreationByNonAdminUsers - DisablePortalsCreationByNonAdminUsers = $testParams.DisablePortalsCreationByNonAdminUsers - DisableSurveyFeedback = $testParams.DisableSurveyFeedback - DisableTrialEnvironmentCreationByNonAdminUsers = $testParams.DisableTrialEnvironmentCreationByNonAdminUsers - DisableCapacityAllocationByEnvironmentAdmins = $testParams.DisableCapacityAllocationByEnvironmentAdmins - DisableSupportTicketsVisibleByAllUsers = $testParams.DisableSupportTicketsVisibleByAllUsers - powerPlatform = @( - @{ - search = @{ - DisableDocsSearch = $testParams.DisableDocsSearch - DisableCommunitySearch = $testParams.DisableCommunitySearch - DisableBingVideoSearch = $testParams.DisableBingVideoSearch - } - }, - @{ - powerApps = @{ - DisableShareWithEveryone = $testParams.DisableShareWithEveryone - EnableGuestsToMake = $testParams.EnableGuestsToMake - } - }, - @{ - teamsIntegration = @{ - ShareWithColleaguesUserLimit = $testParams.ShareWithColleaguesUserLimit - } + # Test contexts + Context -Name 'PP Tenant settings are not configured' -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + WalkMeOptOut = $false + DisableNPSCommentsReachout = $false + DisableNewsletterSendout = $false + DisableEnvironmentCreationByNonAdminUsers = $false + DisablePortalsCreationByNonAdminUsers = $false + DisableSurveyFeedback = $false + DisableTrialEnvironmentCreationByNonAdminUsers = $false + DisableCapacityAllocationByEnvironmentAdmins = $false + DisableSupportTicketsVisibleByAllUsers = $false + DisableDocsSearch = $false + DisableCommunitySearch = $false + DisableBingVideoSearch = $false + DisableShareWithEveryone = $false + EnableGuestsToMake = $false + ShareWithColleaguesUserLimit = 10000 + Credential = $Credential } - ) - } - } - - Mock -CommandName Get-TenantSettings -MockWith { - return @{ - TenantSettings = @{ - WalkMeOptOut = $testParams.WalkMeOptOut - DisableNPSCommentsReachout = $testParams.DisableNPSCommentsReachout - DisableNewsletterSendout = $testParams.DisableNewsletterSendout - DisableEnvironmentCreationByNonAdminUsers = $testParams.DisableEnvironmentCreationByNonAdminUsers - DisablePortalsCreationByNonAdminUsers = $testParams.DisablePortalsCreationByNonAdminUsers - DisableSurveyFeedback = $testParams.DisableSurveyFeedback - DisableTrialEnvironmentCreationByNonAdminUsers = $testParams.DisableTrialEnvironmentCreationByNonAdminUsers - DisableCapacityAllocationByEnvironmentAdmins = $testParams.DisableCapacityAllocationByEnvironmentAdmins - DisableSupportTicketsVisibleByAllUsers = $testParams.DisableSupportTicketsVisibleByAllUsers - powerPlatform = @( - @{ - search = @{ - DisableDocsSearch = $testParams.DisableDocsSearch - DisableCommunitySearch = $testParams.DisableCommunitySearch - DisableBingVideoSearch = $testParams.DisableBingVideoSearch - } - }, - @{ - powerApps = @{ - DisableShareWithEveryone = $testParams.DisableShareWithEveryone - EnableGuestsToMake = $testParams.EnableGuestsToMake + + Mock -CommandName Set-TenantSettings -MockWith { + return @{ + TenantSettings = @{ + WalkMeOptOut = $testParams.WalkMeOptOut + DisableNPSCommentsReachout = $testParams.DisableNPSCommentsReachout + DisableNewsletterSendout = $testParams.DisableNewsletterSendout + DisableEnvironmentCreationByNonAdminUsers = $testParams.DisableEnvironmentCreationByNonAdminUsers + DisablePortalsCreationByNonAdminUsers = $testParams.DisablePortalsCreationByNonAdminUsers + DisableSurveyFeedback = $testParams.DisableSurveyFeedback + DisableTrialEnvironmentCreationByNonAdminUsers = $testParams.DisableTrialEnvironmentCreationByNonAdminUsers + DisableCapacityAllocationByEnvironmentAdmins = $testParams.DisableCapacityAllocationByEnvironmentAdmins + DisableSupportTicketsVisibleByAllUsers = $testParams.DisableSupportTicketsVisibleByAllUsers + powerPlatform = @( + @{ + search = @{ + DisableDocsSearch = $testParams.DisableDocsSearch + DisableCommunitySearch = $testParams.DisableCommunitySearch + DisableBingVideoSearch = $testParams.DisableBingVideoSearch + } + }, + @{ + powerApps = @{ + DisableShareWithEveryone = $testParams.DisableShareWithEveryone + EnableGuestsToMake = $testParams.EnableGuestsToMake + } + }, + @{ + teamsIntegration = @{ + ShareWithColleaguesUserLimit = $testParams.ShareWithColleaguesUserLimit + } + } + ) + } } - }, - @{ - teamsIntegration = @{ - ShareWithColleaguesUserLimit = $testParams.ShareWithColleaguesUserLimit + + Mock -CommandName Get-TenantSettings -MockWith { + return @{ + TenantSettings = @{ + WalkMeOptOut = $testParams.WalkMeOptOut + DisableNPSCommentsReachout = $testParams.DisableNPSCommentsReachout + DisableNewsletterSendout = $testParams.DisableNewsletterSendout + DisableEnvironmentCreationByNonAdminUsers = $testParams.DisableEnvironmentCreationByNonAdminUsers + DisablePortalsCreationByNonAdminUsers = $testParams.DisablePortalsCreationByNonAdminUsers + DisableSurveyFeedback = $testParams.DisableSurveyFeedback + DisableTrialEnvironmentCreationByNonAdminUsers = $testParams.DisableTrialEnvironmentCreationByNonAdminUsers + DisableCapacityAllocationByEnvironmentAdmins = $testParams.DisableCapacityAllocationByEnvironmentAdmins + DisableSupportTicketsVisibleByAllUsers = $testParams.DisableSupportTicketsVisibleByAllUsers + powerPlatform = @( + @{ + search = @{ + DisableDocsSearch = $testParams.DisableDocsSearch + DisableCommunitySearch = $testParams.DisableCommunitySearch + DisableBingVideoSearch = $testParams.DisableBingVideoSearch + } + }, + @{ + powerApps = @{ + DisableShareWithEveryone = $testParams.DisableShareWithEveryone + EnableGuestsToMake = $testParams.EnableGuestsToMake + } + }, + @{ + teamsIntegration = @{ + ShareWithColleaguesUserLimit = $testParams.ShareWithColleaguesUserLimit + } + } + ) + } + } } - } - ) - } - } - } - } + } - It 'Should return false from the Test method' { - Test-TargetResource @testParams | Should -Be $false - } + It 'Should return false from the Test method' { + Test-TargetResource @testParams | Should -Be $false + } - It 'Sets the tenant settings in Set method' { - Set-TargetResource @testParams + It 'Sets the tenant settings in Set method' { + Set-TargetResource @testParams + } + } } - } - } - Context -Name 'ReverseDSC Tests' -Fixture { - BeforeAll { - $testParams = @{ - Credential = $Credential - } + Context -Name 'ReverseDSC Tests' -Fixture { + BeforeAll { + $testParams = @{ + Credential = $Credential + } - Mock -CommandName Get-TenantSettings -MockWith { - return @{ - TenantSettings = @{ - WalkMeOptOut = $testParams.WalkMeOptOut - DisableNPSCommentsReachout = $testParams.DisableNPSCommentsReachout - DisableNewsletterSendout = $testParams.DisableNewsletterSendout - DisableEnvironmentCreationByNonAdminUsers = $testParams.DisableEnvironmentCreationByNonAdminUsers - DisablePortalsCreationByNonAdminUsers = $testParams.DisablePortalsCreationByNonAdminUsers - DisableSurveyFeedback = $testParams.DisableSurveyFeedback - DisableTrialEnvironmentCreationByNonAdminUsers = $testParams.DisableTrialEnvironmentCreationByNonAdminUsers - DisableCapacityAllocationByEnvironmentAdmins = $testParams.DisableCapacityAllocationByEnvironmentAdmins - DisableSupportTicketsVisibleByAllUsers = $testParams.DisableSupportTicketsVisibleByAllUsers - powerPlatform = @( - @{ - search = @{ - DisableDocsSearch = $testParams.DisableDocsSearch - DisableCommunitySearch = $testParams.DisableCommunitySearch - DisableBingVideoSearch = $testParams.DisableBingVideoSearch - } - }, - @{ - powerApps = @{ - DisableShareWithEveryone = $testParams.DisableShareWithEveryone - EnableGuestsToMake = $testParams.EnableGuestsToMake - } - }, - @{ - teamsIntegration = @{ - ShareWithColleaguesUserLimit = $testParams.ShareWithColleaguesUserLimit - } + Mock -CommandName Get-TenantSettings -MockWith { + return @{ + TenantSettings = @{ + WalkMeOptOut = $testParams.WalkMeOptOut + DisableNPSCommentsReachout = $testParams.DisableNPSCommentsReachout + DisableNewsletterSendout = $testParams.DisableNewsletterSendout + DisableEnvironmentCreationByNonAdminUsers = $testParams.DisableEnvironmentCreationByNonAdminUsers + DisablePortalsCreationByNonAdminUsers = $testParams.DisablePortalsCreationByNonAdminUsers + DisableSurveyFeedback = $testParams.DisableSurveyFeedback + DisableTrialEnvironmentCreationByNonAdminUsers = $testParams.DisableTrialEnvironmentCreationByNonAdminUsers + DisableCapacityAllocationByEnvironmentAdmins = $testParams.DisableCapacityAllocationByEnvironmentAdmins + DisableSupportTicketsVisibleByAllUsers = $testParams.DisableSupportTicketsVisibleByAllUsers + powerPlatform = @( + @{ + search = @{ + DisableDocsSearch = $testParams.DisableDocsSearch + DisableCommunitySearch = $testParams.DisableCommunitySearch + DisableBingVideoSearch = $testParams.DisableBingVideoSearch + } + }, + @{ + powerApps = @{ + DisableShareWithEveryone = $testParams.DisableShareWithEveryone + EnableGuestsToMake = $testParams.EnableGuestsToMake + } + }, + @{ + teamsIntegration = @{ + ShareWithColleaguesUserLimit = $testParams.ShareWithColleaguesUserLimit + } + } + ) + } + } } - ) } - } - } - } - It 'Should Reverse Engineer resource from the Export method' { - Export-TargetResource @testParams - } - } - }#inmodulescope + It 'Should Reverse Engineer resource from the Export method' { + Export-TargetResource @testParams + } + } + }#inmodulescope }#describe Invoke-Command -ScriptBlock $Global:DscHelper.CleanupScript -NoNewScope diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPowerAppsEnvironment.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPowerAppsEnvironment.Tests.ps1 index b756f81888..a5327d1e3f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPowerAppsEnvironment.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.PPowerAppsEnvironment.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Remove-AdminPowerAppEnvironment -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCAuditConfigurationPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCAuditConfigurationPolicy.Tests.ps1 index edf0272493..fed7809817 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCAuditConfigurationPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCAuditConfigurationPolicy.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldPolicy.Tests.ps1 index ab17fc4f44..73e6692d23 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldPolicy.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldRule.Tests.ps1 index 40a201a809..a100efedc1 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCCaseHoldRule.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceCase.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceCase.Tests.ps1 index f68ed731c1..4292bfed0a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceCase.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceCase.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearch.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearch.Tests.ps1 index 53939c889f..57d83c0a1e 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearch.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearch.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearchAction.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearchAction.Tests.ps1 index 3e065ab185..f2532252d4 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearchAction.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceSearchAction.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceTag.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceTag.Tests.ps1 index 3f311b6213..89775d8ece 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceTag.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCComplianceTag.Tests.ps1 @@ -2,14 +2,14 @@ param( ) $M365DSCTestFolder = Join-Path -Path $PSScriptRoot ` - -ChildPath "..\..\Unit" ` - -Resolve + -ChildPath "..\..\Unit" ` + -Resolve $CmdletModule = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Microsoft365.psm1" ` - -Resolve) + -ChildPath "\Stubs\Microsoft365.psm1" ` + -Resolve) $GenericStubPath = (Join-Path -Path $M365DSCTestFolder ` - -ChildPath "\Stubs\Generic.psm1" ` - -Resolve) + -ChildPath "\Stubs\Generic.psm1" ` + -Resolve) Import-Module -Name (Join-Path -Path $M365DSCTestFolder ` -ChildPath "\UnitTestHelper.psm1" ` -Resolve) @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { @@ -72,16 +72,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Rule doesn't already exist" -Fixture { BeforeAll { $testParams = @{ - Name = "TestRule" - Comment = "This is a test Rule" - RetentionAction = "Keep" - RetentionDuration = "1025" - FilePlanProperty = (New-CimInstance -ClassName MSFT_SCFilePlanProperty -Property @{ + Name = "TestRule" + Comment = "This is a test Rule" + RetentionAction = "Keep" + RetentionDuration = "1025" + FilePlanProperty = (New-CimInstance -ClassName MSFT_SCFilePlanProperty -Property @{ FilePlanPropertyDepartment = "Legal" } -ClientOnly) - Credential = $Credential - RetentionType = "ModificationAgeInDays" - Ensure = "Present" + Credential = $Credential + RetentionType = "ModificationAgeInDays" + Ensure = "Present" } Mock -CommandName Get-ComplianceTag -MockWith { @@ -105,11 +105,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Rule already exists" -Fixture { BeforeAll { $testParams = @{ - Name = "TestRule" - Comment = "This is a test Rule" - RetentionAction = "Keep" - RetentionDuration = "1025" - FilePlanProperty = (New-CimInstance -ClassName MSFT_SCFilePlanProperty -Property @{ + Name = "TestRule" + Comment = "This is a test Rule" + RetentionAction = "Keep" + RetentionDuration = "1025" + FilePlanProperty = (New-CimInstance -ClassName MSFT_SCFilePlanProperty -Property @{ FilePlanPropertyDepartment = "DemoDept" FilePlanPropertyCitation = "DemoCit" FilePlanPropertyReferenceId = "DemoRef" @@ -117,9 +117,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { FilePlanPropertyCategory = "DemoCat" FilePlanPropertySubcategory = "DemoSub" } -ClientOnly) - Credential = $Credential - RetentionType = "ModificationAgeInDays" - Ensure = "Present" + Credential = $Credential + RetentionType = "ModificationAgeInDays" + Ensure = "Present" } Mock -CommandName Get-ComplianceTag -MockWith { @@ -156,16 +156,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "Rule should not exist" -Fixture { BeforeAll { $testParams = @{ - Ensure = "Absent" - Name = "TestRule" - Comment = "This is a test Rule" - RetentionAction = "Keep" - FilePlanProperty = (New-CimInstance -ClassName MSFT_SCFilePlanProperty -Property @{ + Ensure = "Absent" + Name = "TestRule" + Comment = "This is a test Rule" + RetentionAction = "Keep" + FilePlanProperty = (New-CimInstance -ClassName MSFT_SCFilePlanProperty -Property @{ FilePlanPropertyDepartment = "Legal" } -ClientOnly) - RetentionDuration = "1025" - Credential = $Credential - RetentionType = "ModificationAgeInDays" + RetentionDuration = "1025" + Credential = $Credential + RetentionType = "ModificationAgeInDays" } Mock -CommandName Get-ComplianceTag -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPCompliancePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPCompliancePolicy.Tests.ps1 index 1f005390ae..681eb28047 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPCompliancePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPCompliancePolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPComplianceRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPComplianceRule.Tests.ps1 index 22b43dcbf5..d6307f598c 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPComplianceRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDLPComplianceRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConditionalAccessPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConditionalAccessPolicy.Tests.ps1 index bbe37a7708..e52410a159 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConditionalAccessPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConditionalAccessPolicy.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConfigurationPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConfigurationPolicy.Tests.ps1 index b638e3b132..86b4647a6a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConfigurationPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCDeviceConfigurationPolicy.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyAuthority.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyAuthority.Tests.ps1 index a3fc3448f7..1d28139cc1 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyAuthority.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyAuthority.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Remove-FilePlanPropertyAuthority -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCategory.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCategory.Tests.ps1 index 85da2f8e92..95611a9fd9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCategory.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCategory.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Remove-FilePlanPropertyCategory -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCitation.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCitation.Tests.ps1 index 91419c0977..b988ed1808 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCitation.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyCitation.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Remove-FilePlanPropertyCitation -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyDepartment.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyDepartment.Tests.ps1 index 674b242105..315e985b51 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyDepartment.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyDepartment.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Remove-FilePlanPropertyDepartment -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyReferenceId.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyReferenceId.Tests.ps1 index 4168524644..1d1609cbb0 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyReferenceId.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertyReferenceId.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Remove-FilePlanPropertyReferenceId -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertySubCategory.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertySubCategory.Tests.ps1 index ffa19f6f93..d6c128dbb5 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertySubCategory.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCFilePlanPropertySubCategory.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Remove-FilePlanPropertySubCategory -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionCompliancePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionCompliancePolicy.Tests.ps1 index dd62c01144..a641199117 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionCompliancePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionCompliancePolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionComplianceRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionComplianceRule.Tests.ps1 index 9514498a05..83d2d12573 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionComplianceRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionComplianceRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionEventType.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionEventType.Tests.ps1 index 2341212e42..a85872ce27 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionEventType.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCRetentionEventType.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabel.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabel.Tests.ps1 index eb92855fa3..1bea275222 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabel.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabel.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabelPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabelPolicy.Tests.ps1 index 694d24a1fd..3b90954055 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabelPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSensitivityLabelPolicy.Tests.ps1 @@ -41,7 +41,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewPolicy.Tests.ps1 index 48c8e3a62e..4f505c0da7 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewRule.Tests.ps1 index 293eb41186..56736e8808 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SCSupervisoryReviewRule.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Import-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOAccessControlSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOAccessControlSettings.Tests.ps1 index 168acd5480..a9be1ae41e 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOAccessControlSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOAccessControlSettings.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOApp.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOApp.Tests.ps1 index ede8076f1d..38c095acf3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOApp.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOApp.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PnPTenantAppCatalogUrl -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOBrowserIdleSignout.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOBrowserIdleSignout.ps1 index 5aff2fb787..60c6f2441f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOBrowserIdleSignout.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOBrowserIdleSignout.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHomeSite.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHomeSite.Tests.ps1 index 5793a30d08..814a7e1455 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHomeSite.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHomeSite.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHubSite.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHubSite.Tests.ps1 index b4d779c94b..b9823ef650 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHubSite.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOHubSite.Tests.ps1 @@ -41,7 +41,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-M365DSCLogEntry -MockWith {} } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOOrgAssetsLibrary.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOOrgAssetsLibrary.Tests.ps1 index d44100cf56..91439aa0f2 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOOrgAssetsLibrary.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOOrgAssetsLibrary.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOPropertyBag.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOPropertyBag.Tests.ps1 index 23d77f2d13..7249b2be65 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOPropertyBag.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOPropertyBag.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-PnPPropertyBagValue -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchManagedProperty.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchManagedProperty.Tests.ps1 index 7bb8285709..ecaca42e7f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchManagedProperty.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchManagedProperty.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } $existingValueXML = " diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchResultSource.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchResultSource.Tests.ps1 index c609153540..b877d72f89 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchResultSource.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSearchResultSource.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } $existingValueXML = " diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSharingSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSharingSettings.Tests.ps1 index c4b508d34f..48139ba6d7 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSharingSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSharingSettings.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSite.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSite.Tests.ps1 index 06ec0858cd..8323cce0be 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSite.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSite.Tests.ps1 @@ -44,7 +44,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Start-Sleep -MockWith { } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteAuditSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteAuditSettings.Tests.ps1 index 1124bbb284..3d83d81721 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteAuditSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteAuditSettings.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-PnPAuditing -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesign.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesign.Tests.ps1 index 5cf44d2ae3..4f54bbeeb9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesign.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesign.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } # Test contexts diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesignRights.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesignRights.Tests.ps1 index 91ea2e23c7..b98ace71c9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesignRights.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteDesignRights.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } # Test contexts diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteGroup.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteGroup.Tests.ps1 index fd6cb33caa..c6bc62960a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteGroup.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteGroup.Tests.ps1 @@ -42,7 +42,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PnPTenantSite -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteScript.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteScript.Tests.ps1 index 365d84bbc7..c38a6347e1 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteScript.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOSiteScript.Tests.ps1 @@ -55,7 +55,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Add-PnPSiteScript -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOStorageEntity.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOStorageEntity.Tests.ps1 index 0bdf788be0..a3aa4c7cb8 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOStorageEntity.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOStorageEntity.Tests.ps1 @@ -26,7 +26,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $Credential = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd) Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-M365DSCOrganization -MockWith { @@ -46,7 +46,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-SPOAdministrationUrl -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCDNPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCDNPolicy.Tests.ps1 index 2fd2b02d60..e6de053f55 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCDNPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCDNPolicy.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-PnPTenantCDNPolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCdnEnabled.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCdnEnabled.Tests.ps1 index 95e91659df..81faae9fb0 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCdnEnabled.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantCdnEnabled.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-PSSession -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantSettings.Tests.ps1 index 60639bc253..d696b57b32 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTenantSettings.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTheme.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTheme.Tests.ps1 index 8047ae4880..8d99c3b8db 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTheme.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOTheme.Tests.ps1 @@ -41,7 +41,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOUserProfileProperty.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOUserProfileProperty.Tests.ps1 index 3acecd58c6..9c1aea5ef5 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOUserProfileProperty.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.SPOUserProfileProperty.Tests.ps1 @@ -38,7 +38,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-PnPUserProfileProperty -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsCallingPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsCallingPolicy.Tests.ps1 index ddb27ac60a..8d5f60503b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsCallingPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsCallingPolicy.Tests.ps1 @@ -39,7 +39,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-CsTeamsCallingPolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannel.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannel.Tests.ps1 index 07c9771e48..e48956cbaa 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannel.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannel.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandNAme Set-TeamChannel -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannelTab.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannelTab.Tests.ps1 index e8ac9d11a8..bb4e13de23 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannelTab.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsChannelTab.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-M365DSCTeamsChannelTab -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsClientConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsClientConfiguration.Tests.ps1 index 88c736b16e..a29fdd9b0c 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsClientConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsClientConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsClientConfiguration -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallRoutingPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallRoutingPolicy.Tests.ps1 index 78164e3a44..82833a5eea 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallRoutingPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallRoutingPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-CsTeamsEmergencyCallRoutingPolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallingPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallingPolicy.Tests.ps1 index 69b2e6c4c7..491efa622d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallingPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsEmergencyCallingPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-CsTeamsEmergencyCallingPolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsFederationConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsFederationConfiguration.Tests.ps1 index a17775af0a..57ea4beb44 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsFederationConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsFederationConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTenantFederationConfiguration -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestCallingConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestCallingConfiguration.Tests.ps1 index f2608166f1..65fd742ddc 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestCallingConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestCallingConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsGuestCallingConfiguration -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMeetingConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMeetingConfiguration.Tests.ps1 index e81d52f503..fa3aaf1570 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMeetingConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMeetingConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsGuestMeetingConfiguration -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMessagingConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMessagingConfiguration.Tests.ps1 index b921d6f142..7a327d0a67 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMessagingConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsGuestMessagingConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsGuestMessagingConfiguration -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastConfiguration.Tests.ps1 index 0c2c6b8ff7..32e437cea3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsMeetingBroadcastConfiguration -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastPolicy.Tests.ps1 index adf091113a..c1b9e920a9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingBroadcastPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsMeetingBroadcastPolicy -MockWith { return @(@{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingConfiguration.Tests.ps1 index ab5bb4ca20..7aae052314 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsMeetingConfiguration -MockWith { return @{ diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingPolicy.Tests.ps1 index 55d4e02665..cda20194b4 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMeetingPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-CsTeamsMeetingPolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMessagingPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMessagingPolicy.Tests.ps1 index 26cb153e05..b16f0b1b66 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMessagingPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsMessagingPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-CsTeamsMessagingPolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsPstnUsage.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsPstnUsage.Tests.ps1 index 25d2afb49c..a4f84172bc 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsPstnUsage.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsPstnUsage.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-CsOnlinePstnUsage -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTeam.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTeam.Tests.ps1 index 0715f946c8..fd940490bc 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTeam.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTeam.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTenantDialPlan.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTenantDialPlan.Tests.ps1 index 63ef34dabe..e8c58b2697 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTenantDialPlan.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsTenantDialPlan.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Set-CsTenantDialPlan -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradeConfiguration.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradeConfiguration.Tests.ps1 index b725db75f9..f53288163b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradeConfiguration.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradeConfiguration.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Get-CsTeamsUpgradeConfiguration -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 index d34e50f6c1..962f0ee83a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName Grant-CsTeamsUpgradePolicy -MockWith { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUser.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUser.Tests.ps1 index 11ac005c86..60fb542ae2 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUser.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUser.Tests.ps1 @@ -36,7 +36,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoute.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoute.Tests.ps1 index 35a5467bba..384e701f93 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoute.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoute.Tests.ps1 @@ -65,7 +65,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoutingPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoutingPolicy.Tests.ps1 index 0bcedb2950..6166a62d5f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoutingPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsVoiceRoutingPolicy.Tests.ps1 @@ -37,7 +37,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName New-M365DSCConnection -MockWith { - return "Credential" + return "Credentials" } Mock -CommandName New-CsOnlineVoiceRoutingPolicy -MockWith { diff --git a/docs/docs/resources/exchange/EXOMalwareFilterPolicy.md b/docs/docs/resources/exchange/EXOMalwareFilterPolicy.md index 60a9da6741..6cbe25f3d5 100644 --- a/docs/docs/resources/exchange/EXOMalwareFilterPolicy.md +++ b/docs/docs/resources/exchange/EXOMalwareFilterPolicy.md @@ -24,6 +24,7 @@ | **FileTypes** | Write | StringArray[] | The FileTypes parameter specifies the file types that are automatically blocked by common attachment blocking (also known as the Common Attachment Types Filter), regardless of content. || | **InternalSenderAdminAddress** | Write | String | The InternalSenderAdminAddress parameter specifies the email address of the administrator who will receive notification messages for malware detections in messages from internal senders. || | **MakeDefault** | Write | Boolean | MakeDefault makes this malware filter policy the default policy. Valid values are: $true, $false. || +| **QuarantineTag** | Write | String | The QuarantineTag specifies the quarantine policy that's used on messages that are quarantined as malware. || | **ZapEnabled** | Write | Boolean | The ZapEnabled parameter enables or disables zero-hour auto purge (ZAP) for malware. ZAP detects malware in unread messages that have already been delivered to the user's Inbox. Valid values are: $true, $false. || | **Ensure** | Write | String | Specifies if this MalwareFilterPolicy should exist. |Present, Absent| | **Credential** | Write | PSCredential | Credentials of the Exchange Global Admin || @@ -69,6 +70,7 @@ Configuration Example EnableInternalSenderAdminNotifications = $False EnableInternalSenderNotifications = $False FileTypes = @("ace", "ani", "app", "cab", "docm", "exe", "iso", "jar", "jnlp", "reg", "scr", "vbe", "vbs") + QuarantineTag = "AdminOnlyAccessPolicy" ZapEnabled = $True Ensure = "Present" Credential = $credsGlobalAdmin diff --git a/docs/docs/resources/intune/IntuneAppProtectionPolicyiOS.md b/docs/docs/resources/intune/IntuneAppProtectionPolicyiOS.md index 97e93d88c6..656bae984e 100644 --- a/docs/docs/resources/intune/IntuneAppProtectionPolicyiOS.md +++ b/docs/docs/resources/intune/IntuneAppProtectionPolicyiOS.md @@ -48,9 +48,9 @@ | **CertificateThumbprint** | Write | String | Thumbprint of the Azure Active Directory application's authentication certificate to use for authentication. || -# IntuneDeviceConfigurationPolicyiOS +# IntuneAppProtectionPolicyiOS -This resource configures an Intune device configuration profile for an iOS Device. +This resource configures an Intune app protection policy for an iOS Device. ## Examples diff --git a/docs/docs/resources/power-platform/PPTenantIsolationSettings.md b/docs/docs/resources/power-platform/PPTenantIsolationSettings.md new file mode 100644 index 0000000000..8948204220 --- /dev/null +++ b/docs/docs/resources/power-platform/PPTenantIsolationSettings.md @@ -0,0 +1,99 @@ +# PPTenantIsolationSettings + +## Parameters + +| Parameter | Attribute | DataType | Description | Allowed Values | +| --- | --- | --- | --- | --- | +| **TenantName** | Required | String | Name of the trusted tenant. || +| **Direction** | Required | String | Direction of tenant trust. |Inbound, Outbound, Both| +| **IsSingleInstance** | Key | String | Should be set to yes |Yes| +| **Enabled** | Write | Boolean | When set to true this will enable the tenant isolation settings. || +| **Rules** | Write | InstanceArray[] | The exact list of tenant rules to be configured. || +| **RulesToInclude** | Write | InstanceArray[] | A list of tenant rules that has to be added. || +| **RulesToExclude** | Write | InstanceArray[] | A list of tenant rules that is now allowed to be added. || +| **Credential** | Write | PSCredential | Credentials of the Power Platform Admin || + +# PPTenantSettings + +This resource configures the Tenant Isolation settings for a Power Platform Tenant. + +## Examples + +### Example 1 + +This example sets Power Platform tenant isolation settings. + +```powershell +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $credsGlobalAdmin + ) + Import-DscResource -ModuleName Microsoft365DSC + + node localhost + { + PPTenantIsolationSettings 'PowerPlatformTenantSettings' + { + IsSingleInstance = 'Yes' + Enable = $true + Rules = @( + MSFT_PPTenantRule + { + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Outbound' + } + MSFT_PPTenantRule + { + TenantName = 'fabrikam.onmicrosoft.com' + Direction = 'Both' + } + ) + Credential = $credsGlobalAdmin + } + } +} +``` + +### Example 2 + +This example sets Power Platform tenant isolation settings. + +```powershell +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $credsGlobalAdmin + ) + Import-DscResource -ModuleName Microsoft365DSC + + node localhost + { + PPTenantIsolationSettings 'PowerPlatformTenantSettings' + { + IsSingleInstance = 'Yes' + Enable = $true + RulesToInclude = @( + MSFT_PPTenantRule + { + TenantName = 'contoso.onmicrosoft.com' + Direction = 'Inbound' + } + ) + RulesToExclude = @( + MSFT_PPTenantRule + { + TenantName = 'fabrikam.onmicrosoft.com' + Direction = 'Both' + } + ) + Credential = $credsGlobalAdmin + } + } +} +``` + diff --git a/docs/docs/user-guide/cmdlets/New-M365DSCReportFromConfiguration.md b/docs/docs/user-guide/cmdlets/New-M365DSCReportFromConfiguration.md index b4a09b8cc2..56dac2fe0c 100644 --- a/docs/docs/user-guide/cmdlets/New-M365DSCReportFromConfiguration.md +++ b/docs/docs/user-guide/cmdlets/New-M365DSCReportFromConfiguration.md @@ -13,7 +13,7 @@ This function does not generate any output. | Parameter | Required | DataType | Default Value | Allowed Values | Description | | --- | --- | --- | --- | --- | --- | -| Type | True | String | | Excel, HTML | The type of report that should be created: Excel or HTML. | +| Type | True | String | | Excel, HTML, JSON | The type of report that should be created: Excel, HTML, or JSON. | | ConfigurationPath | True | String | | | The path to the exported DSC configuration that the report should be created for. | | OutputPath | True | String | | | The output path of the report. | @@ -29,4 +29,7 @@ This function does not generate any output. `New-M365DSCReportFromConfiguration -Type 'Excel' -ConfigurationPath 'C:\DSC\' -OutputPath 'C:\Dsc\M365Report.xlsx'` +-------------------------- EXAMPLE 3 -------------------------- + +`New-M365DSCReportFromConfiguration -Type 'JSON' -ConfigurationPath 'C:\DSC\' -OutputPath 'C:\Dsc\M365Report.json'`