Forum Discussion

ElCamino_ST's avatar
ElCamino_ST
Copper Contributor
Jul 24, 2023

How can I revoke assignment of personal TeamsFilesPolicy to user?

To remove the Files tab from the Teams channel i found the solution to set the Global TeamsFilesPolicy Settings to:

 

Identity : Global
NativeFileEntryPoints : Disabled
SPChannelFilesTab : Disabled

 

Because I did not want to directly change the global settings for the whole Organisation before exactly knowing that is going to happen I decided to first try this Settings with a custom Policy on my Own user account.

 

For this I proceeded as described here:

 

Turn off Teams Native File Upload policy - Microsoft Teams | Microsoft Learn

 

I did run the commands using the Microsoft PowerShell in the following order:

 

1. New-CsTeamsFilesPolicy -Identity UserPolicy -SPChannelFilesTab Disabled

 

2. Grant-CsTeamsFilesPolicy -identity "email address removed for privacy reasons" -PolicyName UserPolicy

 

Until to that point everything worked as expected.

 

 

 

 

 

 

 

But then i tried to remove the assignment of this new created TeamsFilesPolicy "UserPolicy" from the user "email address removed for privacy reasons".

 

 

First I tried it with the command:

 

Remove-CsTeamsFilesPolicy -Identity UserPolicy

 

which gives me the following error:

 

Remove-CsTeamsFilesPolicy : The policy "UserPolicy" is currently assigned to one or more users or groups. Ensure
policy is not assigned before removing.
In Zeile:1 Zeichen:1
+ Remove-CsTeamsFilesPolicy -Identity UserPolicy
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ ConfigType = ... = UserPolicy }:<>f__AnonymousType92`2) [Remove-CsT
eamsFilesPolicy], Exception
+ FullyQualifiedErrorId : ClientError,Microsoft.Teams.ConfigApi.Cmdlets.RemoveCsTeamsFilesPolicy

 

 

I can assure you that this policy is only assigned to the one user "email address removed for privacy reasons".

 

 

 

 

 

Then I tried to use the following approach:

 

Grant-CsTeamsFilesPolicy -Identity email address removed for privacy reasons -PolicyName "$null"

 

This command works fine, but when i later check which polices are assigned to the user "email address removed for privacy reasons" with the command:

 

Get-CsUserPolicyAssignment -Identity email address removed for privacy reasons

 

I get the follwoing output:

 

 

PolicyType                     PolicyName            PolicySource
----------                        ----------               ------------

xxxxx                                  xxxxx                         xxxxx

xxxxx                                  xxxxx                         xxxxx

xxxxx                                  xxxxx                         xxxxx

TeamsFilesPolicy         UserPolicy            {UserPolicy}

xxxxx                                  xxxxx                         xxxxx

xxxxx xxxxx xxxxx

xxxxx xxxxx xxxxx

xxxxx xxxxx xxxxx

 

 

Which tells me that Granting the "policy" $null did not work.

 

 

 

 

 

 

 

Can anyone tell me how i remove the user specific policy "UserPolicy" from any choosen user so that the global policy will be active again?

 

Thanks for your help!

 

7 Replies

    • ElCamino_ST's avatar
      ElCamino_ST
      Copper Contributor
      Hi Vasil, thanks a lot for your reply. Sadly this results in the same behavoiour like the command with the quotes. The command is acceptet but the UserPolicy stays assigned.
      • VasilMichev's avatar
        VasilMichev
        MVP

        You sure about that? Might be a replication delay, but if you're still seeing the old value best open a support case.

         

        [18:10:44][Login script]# Get-CsUserPolicyAssignment -User email address removed for privacy reasons
        
        PolicyType         PolicyName                 PolicySource
        ----------         ----------                 ------------
        LocationProfile    US                         {US}
        MeetingPolicy      BposSAllModality           {BposSAllModality}
        MobilityPolicy     MobilityEnableOutsideVoice {MobilityEnableOutsideVoice}
        TeamsFilesPolicy   UserPolicy                 {UserPolicy}
        TeamsMeetingPolicy RestrictedAnonymousAccess  {RestrictedAnonymousAccess}
        TeamsUpgradePolicy UpgradeToTeams             {UpgradeToTeams}
        
        [18:10:47][Login script]# Grant-CsTeamsFilesPolicy -Identity email address removed for privacy reasons -PolicyName $null
        
        [18:11:05][Login script]# Get-CsUserPolicyAssignment -User email address removed for privacy reasons
        
        PolicyType         PolicyName                 PolicySource
        ----------         ----------                 ------------
        LocationProfile    US                         {US}
        MeetingPolicy      BposSAllModality           {BposSAllModality}
        MobilityPolicy     MobilityEnableOutsideVoice {MobilityEnableOutsideVoice}
        TeamsMeetingPolicy RestrictedAnonymousAccess  {RestrictedAnonymousAccess}
        TeamsUpgradePolicy UpgradeToTeams             {UpgradeToTeams}
        

          

Resources