Skip to content

Commit

Permalink
Merge pull request #5454 from NikCharlebois/TeamsUserPolicyAssignment
Browse files Browse the repository at this point in the history
Teams Policies Improvements
  • Loading branch information
NikCharlebois authored Nov 25, 2024
2 parents dee59f1 + ed71c71 commit 4249602
Show file tree
Hide file tree
Showing 7 changed files with 284 additions and 116 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
* Added support for AccessTokens.
* IntuneAndroidManagedStoreAppConfiguration
* Initial release.
* 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function Get-TargetResource
[System.String]
$Identity,

# DEPRECATED
[Parameter()]
[System.String[]]
$Users,
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -126,6 +112,7 @@ function Set-TargetResource
[System.String]
$Identity,

# DEPRECATED
[Parameter()]
[System.String[]]
$Users,
Expand Down Expand Up @@ -204,6 +191,7 @@ function Test-TargetResource
[System.String]
$Identity,

# DEPRECATED
[Parameter()]
[System.String[]]
$Users,
Expand Down Expand Up @@ -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) `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 4249602

Please sign in to comment.