diff --git a/.github/workflows/CodeCoverage.yml b/.github/workflows/CodeCoverage.yml index e636034445..f0d9e8b1df 100644 --- a/.github/workflows/CodeCoverage.yml +++ b/.github/workflows/CodeCoverage.yml @@ -17,10 +17,10 @@ jobs: - name: Install Modules shell: pwsh run: | - Install-Module ReverseDSC -Force -Scope AllUsers - Install-Module DSCParser -Force -Scope AllUsers - Install-Module PSDesiredStateConfiguration -Force -Scope AllUsers - Install-Module Pester -Force -SkipPublisherCheck -Scope AllUsers + Install-PSResource -Name ReverseDSC -Scope AllUsers -TrustRepository + Install-PSResource -Name DSCParser -Scope AllUsers -TrustRepository + Install-PSResource -Name PSDesiredStateConfiguration -Scope AllUsers -TrustRepository + Install-PSResource -Name Pester -Scope AllUsers -TrustRepository [System.Environment]::SetEnvironmentVariable('M365DSCTelemetryEnabled', $false, [System.EnvironmentVariableTarget]::Machine); - name: Run Quality Checks shell: pwsh diff --git a/.github/workflows/Unit Tests.yml b/.github/workflows/Unit Tests.yml index a636b3093d..4b6a772740 100644 --- a/.github/workflows/Unit Tests.yml +++ b/.github/workflows/Unit Tests.yml @@ -21,10 +21,10 @@ jobs: - name: Install Modules shell: pwsh run: | - Install-Module ReverseDSC -Force -Scope AllUsers - Install-Module DSCParser -Force -Scope AllUsers - Install-Module PSDesiredStateConfiguration -Force -Scope AllUsers - Install-Module Pester -Force -SkipPublisherCheck -Scope AllUsers + Install-PSResource -Name ReverseDSC -Scope AllUsers -TrustRepository + Install-PSResource -Name DSCParser -Scope AllUsers -TrustRepository + Install-PSResource -Name PSDesiredStateConfiguration -Scope AllUsers -TrustRepository + Install-PSResource -Name Pester -Scope AllUsers -TrustRepository [System.Environment]::SetEnvironmentVariable('M365DSCTelemetryEnabled', $false, [System.EnvironmentVariableTarget]::Machine); - name: Run Quality Checks shell: pwsh diff --git a/.vscode/GetTestCoverage.ps1 b/.vscode/GetTestCoverage.ps1 index 0b3a88ff68..8d5057208c 100644 --- a/.vscode/GetTestCoverage.ps1 +++ b/.vscode/GetTestCoverage.ps1 @@ -10,7 +10,7 @@ $minVersion = '5.5.0' $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq $moduleName -and $_.Version -ge $minVersion } -if ($module -ne $null) +if ($null -ne $module) { Write-Output "Module $moduleName with version greater than or equal to $minVersion found." } diff --git a/CHANGELOG.md b/CHANGELOG.md index aa3ddb9378..9ae7222a60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,18 +4,39 @@ * AAD * Added ApplicationSecret auth method to multiple resources -* EXORecipientPermission - * Added logic to update an existing recipient's permissions. * EXOEOPProtectionPolicyRule * Added support for AccessTokens. * EXOExternalInOutlook * Added support for AccessTokens. +* EXOMailContact + * Changed how empty arrays are returned. +* EXOPlace + * Changed how empty arrays are returned. +* EXORecipientPermission + * Added logic to update an existing recipient's permissions. +* EXOTransportRule + * Changed how empty arrays are returned. * INTUNE * Add parameter `-All` to Graph requests to fetch all policies on Get. * IntuneAndroidManagedStoreAppConfiguration * Initial release. +* IntuneAppConfigurationPolicy + * Fixes an issue where assignment wasn't properly set if the + groupId was null. + FIXES [#5430](https://github.com/microsoft/Microsoft365DSC/issues/5430) +* TeamsUserPolicyAssignment + * Added support for the Global policies. +* TeamsUpgradePolicy + * DEPRECATED: Users properties. Use the TeamsUserPolicyAssignment resource + instead. * MISC * Removed hardcoded Graph urls and replaced by MSCloudLoginAssistant values. + * Add separate module handling for PowerShell Core. +* DEPENDENCIES + * Updated DSCParser to version 2.0.0.14. + * Updated Microsoft.Graph to version 2.25.0. + * Updated Microsoft.PowerApps.Administration.PowerShell to version 2.0.200. + * Updated MicrosoftTeams to version 6.7.0. # 1.24.1120.1 diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 index 8553bf9155..cb39fd5900 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOMailContact/MSFT_EXOMailContact.psm1 @@ -268,6 +268,10 @@ function Get-TargetResource { $result."ExtensionCustomAttribute$i" = $contact."ExtensionCustomAttribute$i" } + else + { + $result."ExtensionCustomAttribute$i" = @() + } } Write-Verbose -Message "Found Mail Contact $($Name)" diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 index 227fc1f57e..9327331b4d 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOPlace/MSFT_EXOPlace.psm1 @@ -181,6 +181,12 @@ function Get-TargetResource } } + $TagsValue = [Array] $place.Tags + if ($place.Tags -eq $null) + { + $TagsValue = @() + } + $result = @{ Identity = $place.Identity AudioDeviceName = $place.AudioDeviceName @@ -203,7 +209,7 @@ function Get-TargetResource PostalCode = $place.PostalCode State = $place.State Street = $place.Street - Tags = [Array] $place.Tags + Tags = $TagsValue VideoDeviceName = $place.VideoDeviceName Credential = $Credential Ensure = 'Present' diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 index 0cea524e88..89055e9a3f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOTransportRule/MSFT_EXOTransportRule.psm1 @@ -967,6 +967,16 @@ function Get-TargetResource TenantId = $TenantId AccessTokens = $AccessTokens } + $inputParams = (Get-Command 'Get-TargetResource').Parameters + foreach ($key in $inputParams.Keys) + { + $propertyInfo = $inputParams.$key + $curVar = Get-Variable -Name $key -ErrorAction SilentlyContinue + if ($propertyInfo.ParameterType.Name -eq 'String[]' -and $curVar -ne $null -and $curVar.Value -eq $null) + { + $result.$key = @() + } + } # Formats DateTime as String if ($null -ne $result.ActivationDate) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 index e845b47cb9..7bbc0ac35a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.psm1 @@ -8,6 +8,7 @@ function Get-TargetResource [System.String] $Identity, + # DEPRECATED [Parameter()] [System.String[]] $Users, @@ -66,22 +67,6 @@ function Get-TargetResource $policy = Get-CsTeamsUpgradePolicy -Identity $Identity ` -ErrorAction SilentlyContinue - if ($Identity -eq 'Global') - { - [array]$users = Get-CsOnlineUser -Filter "TeamsUpgradePolicy eq null" - } - else - { - try - { - [array]$users = Get-CsOnlineUser -Filter "TeamsUpgradePolicy eq '$Identity'" - } - catch - { - [array]$users = Get-CsOnlineUser | Where-Object -Filter { $_.TeamsUpgradePolicy -eq $Identity } - } - } - if ($null -eq $policy) { throw "No Teams Upgrade Policy with Identity {$Identity} was found" @@ -95,7 +80,8 @@ function Get-TargetResource Write-Verbose -Message "Found Teams Upgrade Policy with Identity {$Identity}" return @{ Identity = $Identity - Users = $usersList + #DEPRECATED + #Users = $usersList MigrateMeetingsToTeams = $MigrateMeetingsToTeams Credential = $Credential ApplicationId = $ApplicationId @@ -126,6 +112,7 @@ function Set-TargetResource [System.String] $Identity, + # DEPRECATED [Parameter()] [System.String[]] $Users, @@ -204,6 +191,7 @@ function Test-TargetResource [System.String] $Identity, + # DEPRECATED [Parameter()] [System.String[]] $Users, @@ -255,6 +243,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $PSBoundParameters)" $ValuesToCheck = $PSBoundParameters + $ValuesToCheck.Remove("Users") | Out-Null $TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.schema.mof index dcd1b3df49..6168d86186 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUpgradePolicy/MSFT_TeamsUpgradePolicy.schema.mof @@ -2,7 +2,7 @@ class MSFT_TeamsUpgradePolicy : OMI_BaseResource { [Key, Description("Identity of the Teams Upgrade Policy.")] String Identity; - [Write, Description("List of users that will be granted the Upgrade Policy to. Use value * to apply the policy globally.")] String Users[]; + [Write, Description("DEPRECATED. Use the TeamsUserPolicyAssignment resource instead.")] String Users[]; [Write, Description("Specifies whether to move existing Skype for Business meetings organized by the user to Teams. This parameter can only be true if the mode of the specified policy instance is either TeamsOnly or SfBWithTeamsCollabAndMeetings, and if the policy instance is being granted to a specific user. It not possible to trigger meeting migration when granting TeamsUpgradePolicy to the entire tenant.")] Boolean MigrateMeetingsToTeams; [Write, Description("Credentials of the Teams Admin"), EmbeddedInstance("MSFT_Credential")] string Credential; [Write, Description("Id of the Azure Active Directory application to authenticate with.")] String ApplicationId; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUserPolicyAssignment/MSFT_TeamsUserPolicyAssignment.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUserPolicyAssignment/MSFT_TeamsUserPolicyAssignment.psm1 index ce927c2248..76c6feb52f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUserPolicyAssignment/MSFT_TeamsUserPolicyAssignment.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsUserPolicyAssignment/MSFT_TeamsUserPolicyAssignment.psm1 @@ -143,31 +143,164 @@ function Get-TargetResource Write-Verbose -Message "User Policy Assignment not found for $User" return $null } + + $CallingLineIdentityValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'CallingLineIdentity'}).PolicyName + if ([System.String]::IsNullOrEmpty($CallingLineIdentityValue)) + { + $CallingLineIdentityValue = 'Global' + } + + $ExternalAccessPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'ExternalAccessPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($ExternalAccessPolicyValue)) + { + $ExternalAccessPolicyValue = 'Global' + } + + $OnlineVoicemailPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'OnlineVoicemailPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($OnlineVoicemailPolicyValue)) + { + $OnlineVoicemailPolicyValue = 'Global' + } + + $OnlineVoiceRoutingPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'OnlineVoiceRoutingPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($OnlineVoiceRoutingPolicyValue)) + { + $OnlineVoiceRoutingPolicyValue = 'Global' + } + + $TeamsAppPermissionPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsAppPermissionPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsAppPermissionPolicyValue)) + { + $TeamsAppPermissionPolicyValue = 'Global' + } + + $TeamsAppSetupPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsAppSetupPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsAppSetupPolicyValue)) + { + $TeamsAppSetupPolicyValue = 'Global' + } + + $TeamsAudioConferencingPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsAudioConferencingPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsAudioConferencingPolicyValue)) + { + $TeamsAudioConferencingPolicyValue = 'Global' + } + + $TeamsCallHoldPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsCallHoldPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsCallHoldPolicyValue)) + { + $TeamsCallHoldPolicyValue = 'Global' + } + + $TeamsCallingPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsCallingPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsCallingPolicyValue)) + { + $TeamsCallingPolicyValue = 'Global' + } + + $TeamsCallParkPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsCallParkPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsCallParkPolicyValue)) + { + $TeamsCallParkPolicyValue = 'Global' + } + + $TeamsChannelsPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsChannelsPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsChannelsPolicyValue)) + { + $TeamsChannelsPolicyValue = 'Global' + } + + $TeamsEmergencyCallingPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEmergencyCallingPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsEmergencyCallingPolicyValue)) + { + $TeamsEmergencyCallingPolicyValue = 'Global' + } + + $TeamsEmergencyCallRoutingPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEmergencyCallRoutingPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsEmergencyCallRoutingPolicyValue)) + { + $TeamsEmergencyCallRoutingPolicyValue = 'Global' + } + + $TeamsEnhancedEncryptionPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEnhancedEncryptionPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsEnhancedEncryptionPolicyValue)) + { + $TeamsEnhancedEncryptionPolicyValue = 'Global' + } + + $TeamsEventsPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEventsPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsEventsPolicyValue)) + { + $TeamsEventsPolicyValue = 'Global' + } + + $TeamsMeetingBroadcastPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMeetingBroadcastPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsMeetingBroadcastPolicyValue)) + { + $TeamsMeetingBroadcastPolicyValue = 'Global' + } + + $TeamsMeetingPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMeetingPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsMeetingPolicyValue)) + { + $TeamsMeetingPolicyValue = 'Global' + } + + $TeamsMessagingPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMessagingPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsMessagingPolicyValue)) + { + $TeamsMessagingPolicyValue = 'Global' + } + + $TeamsMobilityPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMobilityPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsMobilityPolicyValue)) + { + $TeamsMobilityPolicyValue = 'Global' + } + + $TeamsUpdateManagementPolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsUpdateManagementPolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsUpdateManagementPolicyValue)) + { + $TeamsUpdateManagementPolicyValue = 'Global' + } + + $TeamsUpgradePolicyValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsUpgradePolicy'}).PolicyName + if ([System.String]::IsNullOrEmpty($TeamsUpgradePolicyValue)) + { + $TeamsUpgradePolicyValue = 'Global' + } + + $TenantDialPlanValue = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TenantDialPlan'}).PolicyName + if ([System.String]::IsNullOrEmpty($TenantDialPlanValue)) + { + $TenantDialPlanValue = 'Global' + } + Write-Verbose -Message "Found Policy Assignment for user {$User}" return @{ User = $User - CallingLineIdentity = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'CallingLineIdentity'}).PolicyName - ExternalAccessPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'ExternalAccessPolicy'}).PolicyName - OnlineVoicemailPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'OnlineVoicemailPolicy'}).PolicyName - OnlineVoiceRoutingPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'OnlineVoiceRoutingPolicy'}).PolicyName - TeamsAppPermissionPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsAppPermissionPolicy'}).PolicyName - TeamsAppSetupPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsAppSetupPolicy'}).PolicyName - TeamsAudioConferencingPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsAudioConferencingPolicy'}).PolicyName - TeamsCallHoldPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsCallHoldPolicy'}).PolicyName - TeamsCallingPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsCallingPolicy'}).PolicyName - TeamsCallParkPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsCallParkPolicy'}).PolicyName - TeamsChannelsPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsChannelsPolicy'}).PolicyName - TeamsEmergencyCallingPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEmergencyCallingPolicy'}).PolicyName - TeamsEmergencyCallRoutingPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEmergencyCallRoutingPolicy'}).PolicyName - TeamsEnhancedEncryptionPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEnhancedEncryptionPolicy'}).PolicyName - TeamsEventsPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsEventsPolicy'}).PolicyName - TeamsMeetingBroadcastPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMeetingBroadcastPolicy'}).PolicyName - TeamsMeetingPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMeetingPolicy'}).PolicyName - TeamsMessagingPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMessagingPolicy'}).PolicyName - TeamsMobilityPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsMobilityPolicy'}).PolicyName - TeamsUpdateManagementPolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsUpdateManagementPolicy'}).PolicyName - TeamsUpgradePolicy = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TeamsUpgradePolicy'}).PolicyName - TenantDialPlan = ($assignment | Where-Object -FilterScript {$_.PolicyType -eq 'TenantDialPlan'}).PolicyName + CallingLineIdentity = $CallingLineIdentityValue + ExternalAccessPolicy = $ExternalAccessPolicyValue + OnlineVoicemailPolicy = $OnlineVoicemailPolicyValue + OnlineVoiceRoutingPolicy = $OnlineVoiceRoutingPolicyValue + TeamsAppPermissionPolicy = $TeamsAppPermissionPolicyValue + TeamsAppSetupPolicy = $TeamsAppSetupPolicyValue + TeamsAudioConferencingPolicy = $TeamsAudioConferencingPolicyValue + TeamsCallHoldPolicy = $TeamsCallHoldPolicyValue + TeamsCallingPolicy = $TeamsCallingPolicyValue + TeamsCallParkPolicy = $TeamsCallParkPolicyValue + TeamsChannelsPolicy = $TeamsChannelsPolicyValue + TeamsEmergencyCallingPolicy = $TeamsEmergencyCallingPolicyValue + TeamsEmergencyCallRoutingPolicy = $TeamsEmergencyCallRoutingPolicyValue + TeamsEnhancedEncryptionPolicy = $TeamsEnhancedEncryptionPolicyValue + TeamsEventsPolicy = $TeamsEventsPolicyValue + TeamsMeetingBroadcastPolicy = $TeamsMeetingBroadcastPolicyValue + TeamsMeetingPolicy = $TeamsMeetingPolicyValue + TeamsMessagingPolicy = $TeamsMessagingPolicyValue + TeamsMobilityPolicy = $TeamsMobilityPolicyValue + TeamsUpdateManagementPolicy = $TeamsUpdateManagementPolicyValue + TeamsUpgradePolicy = $TeamsUpgradePolicyValue + TenantDialPlan = $TenantDialPlanValue Credential = $Credential ApplicationId = $ApplicationId TenantId = $TenantId @@ -324,116 +457,205 @@ function Set-TargetResource $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftTeams' -InboundParameters $PSBoundParameters + $currentInstance = Get-TargetResource @PSBoundParameters try { - if ($null -ne $CallingLineIdentity) + if ($null -ne $CallingLineIdentity -and $CallingLineIdentity -ne $currentInstance.CallingLineIdentity) { Write-Verbose -Message "Assigning the Call Line Identity Policy {$CallingLineIdentity} to user {$User}" + if ($CallingLineIdentity -eq 'Global') + { + $CallingLineIdentity = $null + } Grant-CsCallingLineIdentity -Identity $User -PolicyName $CallingLineIdentity | Out-Null } - if ($null -ne $ExternalAccessPolicy) + if ($null -ne $ExternalAccessPolicy -and $ExternalAccessPolicy -ne $currentInstance.ExternalAccessPolicy) { Write-Verbose -Message "Assigning the External Access Policy {$ExternalAccessPolicy} to user {$User}" - Grant-CsExternalAccessPolicy -Identity $User -PolicyName $CallingLineIdentity | Out-Null + if ($ExternalAccessPolicy -eq 'Global') + { + $ExternalAccessPolicy = $null + } + Grant-CsExternalAccessPolicy -Identity $User -PolicyName $ExternalAccessPolicy | Out-Null } - if ($null -ne $OnlineVoicemailPolicy) + if ($null -ne $OnlineVoicemailPolicy -and $OnlineVoicemailPolicy -ne $currentInstance.OnlineVoicemailPolicy) { Write-Verbose -Message "Assigning the Online Voicemail Policy {$OnlineVoicemailPolicy} to user {$User}" + if ($OnlineVoicemailPolicy -eq 'Global') + { + $OnlineVoicemailPolicy = $null + } Grant-CsOnlineVoicemailPolicy -Identity $User -PolicyName $OnlineVoicemailPolicy | Out-Null } - if ($null -ne $OnlineVoiceRoutingPolicy) + if ($null -ne $OnlineVoiceRoutingPolicy -and $OnlineVoiceRoutingPolicy -ne $currentInstance.OnlineVoiceRoutingPolicy) { Write-Verbose -Message "Assigning the Online Voice Routing Policy {$OnlineVoiceRoutingPolicy} to user {$User}" + if ($OnlineVoiceRoutingPolicy -eq 'Global') + { + $OnlineVoiceRoutingPolicy = $null + } Grant-CsOnlineVoiceRoutingPolicy -Identity $User -PolicyName $OnlineVoiceRoutingPolicy | Out-Null } - if ($null -ne $TeamsAppPermissionPolicy) + if ($null -ne $TeamsAppPermissionPolicy -and $TeamsAppPermissionPolicy -ne $currentInstance.TeamsAppPermissionPolicy) { Write-Verbose -Message "Assigning the Apps Permission Policy {$TeamsAppPermissionPolicy} to user {$User}" + if ($TeamsAppPermissionPolicy -eq 'Global') + { + $TeamsAppPermissionPolicy = $null + } Grant-CsTeamsAppPermissionPolicy -Identity $User -PolicyName $TeamsAppPermissionPolicy | Out-Null } - if ($null -ne $TeamsAppSetupPolicy) + if ($null -ne $TeamsAppSetupPolicy -and $TeamsAppSetupPolicy -ne $currentInstance.TeamsAppSetupPolicy) { Write-Verbose -Message "Assigning the Apps Setup Policy {$TeamsAppSetupPolicy} to user {$User}" + if ($TeamsAppSetupPolicy -eq 'Global') + { + $TeamsAppSetupPolicy = $null + } Grant-CsTeamsAppSetupPolicy -Identity $User -PolicyName $TeamsAppSetupPolicy | Out-Null } - if ($null -ne $TeamsAudioConferencingPolicy) + if ($null -ne $TeamsAudioConferencingPolicy -and $TeamsAudioConferencingPolicy -ne $currentInstance.TeamsAudioConferencingPolicy) { Write-Verbose -Message "Assigning the Audio COnferencing Policy {$TeamsAudioConferencingPolicy} to user {$User}" + if ($TeamsAudioConferencingPolicy -eq 'Global') + { + $TeamsAudioConferencingPolicy = $null + } Grant-CsTeamsAudioConferencingPolicy -Identity $User -PolicyName $TeamsAudioConferencingPolicy | Out-Null } - if ($null -ne $TeamsCallHoldPolicy) + if ($null -ne $TeamsCallHoldPolicy -and $TeamsCallHoldPolicy -ne $currentInstance.TeamsCallHoldPolicy) { Write-Verbose -Message "Assigning the Call Hold Policy {$TeamsCallHoldPolicy} to user {$User}" + if ($TeamsCallHoldPolicy -eq 'Global') + { + $TeamsCallHoldPolicy = $null + } Grant-CsTeamsCallHoldPolicy -Identity $User -PolicyName $TeamsCallHoldPolicy | Out-Null } - if ($null -ne $TeamsCallingPolicy) + if ($null -ne $TeamsCallingPolicy -and $TeamsCallingPolicy -ne $currentInstance.TeamsCallingPolicy) { - Write-Verbose -Message "Assigning the Calling Policy {$TeamsCallingPolicy} to user {$User}" + Write-Verbose -Message "Assigning the Calling Policy {$TeamsCallParkPolicy} to user {$User}" + if ($TeamsCallParkPolicy -eq 'Global') + { + $TeamsCallParkPolicy = $null + } Grant-CsTeamsCallingPolicy -Identity $User -PolicyName $TeamsCallingPolicy | Out-Null } - if ($null -ne $TeamsCallParkPolicy) + if ($null -ne $TeamsCallParkPolicy -and $TeamsCallParkPolicy -ne $currentInstance.TeamsCallParkPolicy) { Write-Verbose -Message "Assigning the Call Park Policy {$TeamsCallParkPolicy} to user {$User}" + if ($TeamsCallParkPolicy -eq 'Global') + { + $TeamsCallParkPolicy = $null + } Grant-CsTeamsCallParkPolicy -Identity $User -PolicyName $TeamsCallParkPolicy | Out-Null } - if ($null -ne $TeamsChannelsPolicy) + if ($null -ne $TeamsChannelsPolicy -and $TeamsChannelsPolicy -ne $currentInstance.TeamsChannelsPolicy) { Write-Verbose -Message "Assigning the Channels Policy {$TeamsChannelsPolicy} to user {$User}" + if ($TeamsChannelsPolicy -eq 'Global') + { + $TeamsChannelsPolicy = $null + } Grant-CsTeamsChannelsPolicy -Identity $User -PolicyName $TeamsChannelsPolicy | Out-Null } - if ($null -ne $TeamsEmergencyCallingPolicy) + if ($null -ne $TeamsEmergencyCallingPolicy -and $TeamsEmergencyCallingPolicy -ne $currentInstance.TeamsEmergencyCallingPolicy) { Write-Verbose -Message "Assigning the Emergency Calling Policy {$TeamsEmergencyCallingPolicy} to user {$User}" + if ($TeamsEmergencyCallingPolicy -eq 'Global') + { + $TeamsEmergencyCallingPolicy = $null + } Grant-CsTeamsEmergencyCallingPolicy -Identity $User -PolicyName $TeamsEmergencyCallingPolicy | Out-Null } - if ($null -ne $TeamsEmergencyCallRoutingPolicy) + if ($null -ne $TeamsEmergencyCallRoutingPolicy -and $TeamsEmergencyCallRoutingPolicy -ne $currentInstance.TeamsEmergencyCallRoutingPolicy) { Write-Verbose -Message "Assigning the Emergency Call Routing Policy {$TeamsEmergencyCallRoutingPolicy} to user {$User}" + if ($TeamsEmergencyCallRoutingPolicy -eq 'Global') + { + $TeamsEmergencyCallRoutingPolicy = $null + } Grant-CsTeamsEmergencyCallRoutingPolicy -Identity $User -PolicyName $TeamsEmergencyCallRoutingPolicy | Out-Null } - if ($null -ne $TeamsEnhancedEncryptionPolicy) + if ($null -ne $TeamsEnhancedEncryptionPolicy -and $TeamsEnhancedEncryptionPolicy -ne $currentInstance.TeamsEnhancedEncryptionPolicy) { Write-Verbose -Message "Assigning the Enhanced Encryption Policy {$TeamsEnhancedEncryptionPolicy} to user {$User}" + if ($TeamsEnhancedEncryptionPolicy -eq 'Global') + { + $TeamsEnhancedEncryptionPolicy = $null + } Grant-CsTeamsEnhancedEncryptionPolicy -Identity $User -PolicyName $TeamsEnhancedEncryptionPolicy | Out-Null } - if ($null -ne $TeamsEventsPolicy) + if ($null -ne $TeamsEventsPolicy -and $TeamsEventsPolicy -ne $currentInstance.TeamsEventsPolicy) { Write-Verbose -Message "Assigning the Events Policy {$TeamsEventsPolicy} to user {$User}" + if ($TeamsEventsPolicy -eq 'Global') + { + $TeamsEventsPolicy = $null + } Grant-CsTeamsEventsPolicy -Identity $User -PolicyName $TeamsEventsPolicy | Out-Null } - if ($null -ne $TeamsMeetingBroadcastPolicy) + if ($null -ne $TeamsMeetingBroadcastPolicy -and $TeamsMeetingBroadcastPolicy -ne $currentInstance.TeamsMeetingBroadcastPolicy) { Write-Verbose -Message "Assigning the Meeting Broadcast Policy {$TeamsMeetingBroadcastPolicy} to user {$User}" + if ($TeamsMeetingBroadcastPolicy -eq 'Global') + { + $TeamsMeetingBroadcastPolicy = $null + } Grant-CsTeamsMeetingBroadcastPolicy -Identity $User -PolicyName $TeamsMeetingBroadcastPolicy | Out-Null } - if ($null -ne $TeamsMeetingPolicy) + if ($null -ne $TeamsMeetingPolicy -and $TeamsMeetingPolicy -ne $currentInstance.TeamsMeetingPolicy) { Write-Verbose -Message "Assigning the Meeting Policy {$TeamsMeetingPolicy} to user {$User}" + if ($TeamsMeetingPolicy -eq 'Global') + { + $TeamsMeetingPolicy = $null + } Grant-CsTeamsMeetingPolicy -Identity $User -PolicyName $TeamsMeetingPolicy | Out-Null } - if ($null -ne $TeamsMessagingPolicy) + if ($null -ne $TeamsMessagingPolicy -and $TeamsMessagingPolicy -ne $currentInstance.TeamsMessagingPolicy) { Write-Verbose -Message "Assigning the Messaging Policy {$TeamsMessagingPolicy} to user {$User}" + if ($TeamsMessagingPolicy -eq 'Global') + { + $TeamsMessagingPolicy = $null + } Grant-CsTeamsMessagingPolicy -Identity $User -PolicyName $TeamsMessagingPolicy | Out-Null } - if ($null -ne $TeamsMobilityPolicy) + if ($null -ne $TeamsMobilityPolicy -and $TeamsMobilityPolicy -ne $currentInstance.TeamsMobilityPolicy) { Write-Verbose -Message "Assigning the Mobility Policy {$TeamsMobilityPolicy} to user {$User}" + if ($TeamsMobilityPolicy -eq 'Global') + { + $TeamsMobilityPolicy = $null + } Grant-CsTeamsMobilityPolicy -Identity $User -PolicyName $TeamsMobilityPolicy | Out-Null } - if ($null -ne $TeamsUpdateManagementPolicy) + if ($null -ne $TeamsUpdateManagementPolicy -and $TeamsUpdateManagementPolicy -ne $currentInstance.TeamsUpdateManagementPolicy) { Write-Verbose -Message "Assigning the Update Management Policy {$TeamsUpdateManagementPolicy} to user {$User}" + if ($TeamsUpdateManagementPolicy -eq 'Global') + { + $TeamsUpdateManagementPolicy = $null + } Grant-CsTeamsUpdateManagementPolicy -Identity $User -PolicyName $TeamsUpdateManagementPolicy | Out-Null } - if ($null -ne $TeamsUpgradePolicy) + if ($null -ne $TeamsUpgradePolicy -and $TeamsUpgradePolicy -ne $currentInstance.TeamsUpgradePolicy) { Write-Verbose -Message "Assigning the Upgrade Policy {$TeamsUpgradePolicy} to user {$User}" + if ($TeamsUpgradePolicy -eq 'Global') + { + $TeamsUpgradePolicy = $null + } Grant-CsTeamsUpgradePolicy -Identity $User -PolicyName $TeamsUpgradePolicy | Out-Null } - if ($null -ne $TenantDialPlan) + if ($null -ne $TenantDialPlan -and $TenantDialPlan -ne $currentInstance.TenantDialPlan) { Write-Verbose -Message "Assigning the Tenant Dial Plan {$TenantDialPlan} to user {$User}" + if ($TenantDialPlan -eq 'Global') + { + $TenantDialPlan = $null + } Grant-CsTenantDialPlan -Identity $User -PolicyName $TenantDialPlan | Out-Null } } diff --git a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 index 42d1488d67..e6dd487257 100644 --- a/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 +++ b/Modules/Microsoft365DSC/Dependencies/Manifest.psd1 @@ -18,7 +18,7 @@ }, @{ ModuleName = 'DSCParser' - RequiredVersion = '2.0.0.12' + RequiredVersion = '2.0.0.14' }, @{ ModuleName = 'ExchangeOnlineManagement' @@ -26,99 +26,99 @@ }, @{ ModuleName = 'Microsoft.Graph.Applications' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Applications' - Requiredversion = '2.24.0' + Requiredversion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Authentication' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.DeviceManagement' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Devices.CorporateManagement' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.DeviceManagement.Administration' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.DeviceManagement.Enrollment' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.NetworkAccess' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Identity.DirectoryManagement' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Identity.Governance' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Identity.SignIns' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Reports' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Search' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Teams' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.DeviceManagement.Administration' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.DirectoryObjects' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Groups' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Beta.Groups' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Planner' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Sites' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Users' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.Graph.Users.Actions' - RequiredVersion = '2.24.0' + RequiredVersion = '2.25.0' }, @{ ModuleName = 'Microsoft.PowerApps.Administration.PowerShell' - RequiredVersion = '2.0.199' + RequiredVersion = '2.0.200' }, @{ ModuleName = 'MicrosoftTeams' - RequiredVersion = '6.6.0' + RequiredVersion = '6.7.0' }, @{ ModuleName = "MSCloudLoginAssistant" @@ -127,6 +127,7 @@ @{ ModuleName = 'PnP.PowerShell' RequiredVersion = '1.12.0' + InstallLocation = 'WindowsPowerShell' }, @{ ModuleName = 'PSDesiredStateConfiguration' diff --git a/Modules/Microsoft365DSC/Examples/Resources/TeamsUpgradePolicy/1-AssignUsersToTeamsUpgradePolicy.ps1 b/Modules/Microsoft365DSC/Examples/Resources/TeamsUpgradePolicy/1-AssignUsersToTeamsUpgradePolicy.ps1 index bfefa45dcd..921a068beb 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/TeamsUpgradePolicy/1-AssignUsersToTeamsUpgradePolicy.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/TeamsUpgradePolicy/1-AssignUsersToTeamsUpgradePolicy.ps1 @@ -16,7 +16,6 @@ Configuration Example TeamsUpgradePolicy 'ConfigureIslandsPolicy' { Identity = 'Islands' - Users = @("John.Smith@contoso.com", "Nik.Charlebois@contoso.com") MigrateMeetingsToTeams = $true Credential = $Credscredential } diff --git a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 index 2ba46fb602..22f7ae49f8 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1 @@ -982,7 +982,11 @@ function ConvertTo-IntunePolicyAssignment } elseif ($assignment.dataType -like '*GroupAssignmentTarget') { - $group = Get-MgGroup -GroupId ($assignment.groupId) -ErrorAction SilentlyContinue + $group = $null + if (-not [System.String]::IsNullOrEmpty($assignment.groupId)) + { + $group = Get-MgGroup -GroupId ($assignment.groupId) -ErrorAction SilentlyContinue + } if ($null -eq $group) { if ($assignment.groupDisplayName) diff --git a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 index 80031f2ce7..5343487a47 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 @@ -3204,11 +3204,14 @@ function Update-M365DSCDependencies [Parameter()] [Switch] $ValidateOnly, + [Parameter()] [ValidateSet("CurrentUser", "AllUsers")] $Scope = "AllUsers" ) + $isPSResourceGetInstalled = Get-Module -Name Microsoft.PowerShell.PSResourceGet -ListAvailable + try { $Global:MaximumFunctionCount = 32767 @@ -3258,14 +3261,14 @@ function Update-M365DSCDependencies } if (-not $errorFound) { - if (-not $dependency.PowerShellCore -and $Script:IsPowerShellCore) + if (($dependency.PowerShellCore -eq $false -or $dependency.InstallLocation -eq "WindowsPowerShell") -and $Script:IsPowerShellCore) { - Write-Warning "The dependency {$($dependency.ModuleName)} does not support PowerShell Core. Please run Update-M365DSCDependencies in Windows PowerShell." + Write-Warning "The dependency {$($dependency.ModuleName)} requires Windows PowerShell for installation. Please run Update-M365DSCDependencies in Windows PowerShell." continue } elseif ($dependency.PowerShellCore -and -not $Script:IsPowerShellCore) { - Write-Warning "The dependency {$($dependency.ModuleName)} requires PowerShell Core. Please run Update-M365DSCDependencies in PowerShell Core." + Write-Warning "The dependency {$($dependency.ModuleName)} requires PowerShell Core for installation. Please run Update-M365DSCDependencies in PowerShell Core." continue } @@ -3276,7 +3279,15 @@ function Update-M365DSCDependencies Remove-Module 'Microsoft.Graph.Authentication' -Force -ErrorAction SilentlyContinue } Remove-Module $dependency.ModuleName -Force -ErrorAction SilentlyContinue - Install-Module $dependency.ModuleName -RequiredVersion $dependency.RequiredVersion -AllowClobber -Force -Scope "$Scope" + + if ($null -eq $isPSResourceGetInstalled) + { + Install-Module $dependency.ModuleName -RequiredVersion $dependency.RequiredVersion -AllowClobber -Force -Scope $Scope + } + else + { + Install-PSResource -Name $dependency.ModuleName -Version $dependency.RequiredVersion -AcceptLicense -Scope $Scope -Reinstall -TrustRepository + } } } @@ -3829,6 +3840,10 @@ function Get-M365DSCExportContentForResource { $primaryKey = $Results.UserPrincipalName } + elseif ($Keys.Contains('User')) + { + $primaryKey = $Results.User + } $instanceName = $ResourceName if (-not [System.String]::IsNullOrEmpty($primaryKey)) diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 index 04217fe254..c8fe4e0e46 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.TeamsUpgradePolicy.Tests.ps1 @@ -49,7 +49,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BeforeAll { $testParams = @{ Identity = 'Test Policy' - Users = @('john.smith@contoso.onmicrosoft.com') MigrateMeetingsToTeams = $false Credential = $Credential } @@ -64,46 +63,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } - Context -Name 'When the policy already exists and is NOT in the Desired State' -Fixture { - BeforeAll { - $testParams = @{ - Identity = 'Test Policy' - Users = @('john.smith@contoso.onmicrosoft.com') - MigrateMeetingsToTeams = $false - Credential = $Credential - } - - Mock -CommandName Get-CsTeamsUpgradePolicy -MockWith { - return @{ - Identity = 'Test Policy' - Description = 'This is a configuration drift' - NotifySfBUsers = $false - } - } - - Mock -CommandName Get-CsOnlineUser -MockWith { - return @{ - UserPrincipalName = 'Bob.Houle@contoso.onmicrosoft.com' - TeamsUpgradePolicy = 'Global' - } - } - } - - It 'Should return false from the Test method' { - Test-TargetResource @testParams | Should -Be $false - } - - It 'Should update the policy from the Set method' { - Set-TargetResource @testParams - Should -Invoke -CommandName Grant-CsTeamsUpgradePolicy -Exactly 1 - } - } - Context -Name 'When the policy already exists and IS in the Desired State' -Fixture { BeforeAll { $testParams = @{ Identity = 'Islands' - Users = @('john.smith@contoso.onmicrosoft.com') MigrateMeetingsToTeams = $false Credential = $Credential } @@ -115,13 +78,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NotifySfBUsers = $false } } - - Mock -CommandName Get-CsOnlineUser -MockWith { - return @{ - UserPrincipalName = 'John.Smith@contoso.onmicrosoft.com' - TeamsUpgradePolicy = 'Islands' - } - } } It 'Should return true from the Test method' { @@ -144,13 +100,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NotifySfBUsers = $false } } - - Mock -CommandName Get-CsOnlineUser -MockWith { - return @{ - UserPrincipalName = 'John.Smith@contoso.onmicrosoft.com' - TeamsUpgradePolicy = 'Islands' - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/docs/docs/resources/teams/TeamsUpgradePolicy.md b/docs/docs/resources/teams/TeamsUpgradePolicy.md index e27774070c..2ed3aff363 100644 --- a/docs/docs/resources/teams/TeamsUpgradePolicy.md +++ b/docs/docs/resources/teams/TeamsUpgradePolicy.md @@ -5,7 +5,7 @@ | Parameter | Attribute | DataType | Description | Allowed Values | | --- | --- | --- | --- | --- | | **Identity** | Key | String | Identity of the Teams Upgrade Policy. | | -| **Users** | Write | StringArray[] | List of users that will be granted the Upgrade Policy to. Use value * to apply the policy globally. | | +| **Users** | Write | StringArray[] | DEPRECATED. Use the TeamsUserPolicyAssignment resource instead. | | | **MigrateMeetingsToTeams** | Write | Boolean | Specifies whether to move existing Skype for Business meetings organized by the user to Teams. This parameter can only be true if the mode of the specified policy instance is either TeamsOnly or SfBWithTeamsCollabAndMeetings, and if the policy instance is being granted to a specific user. It not possible to trigger meeting migration when granting TeamsUpgradePolicy to the entire tenant. | | | **Credential** | Write | PSCredential | Credentials of the Teams Admin | | | **ApplicationId** | Write | String | Id of the Azure Active Directory application to authenticate with. | | @@ -68,7 +68,6 @@ Configuration Example TeamsUpgradePolicy 'ConfigureIslandsPolicy' { Identity = 'Islands' - Users = @("John.Smith@contoso.com", "Nik.Charlebois@contoso.com") MigrateMeetingsToTeams = $true Credential = $Credscredential }