Skip to content

Deprovision a Compliance Recording Policy in Microsoft Teams using PowerShell


This articles describes the steps required to remove a Compliance Recording Policy in Microsoft Teams using Powershell cmdlets.

There is an alternative (much easier) method of creating of a recording policy in Microsoft Teams, using MiaRec automation. Check Disconnect MiaRec from Microsoft Teams for details.

Ignore these instructions if you used MiaRec automation to delete a recording policy.


Open PowerShell console as admnistrator

Press Win+R to open Run dialog and enter the following command to run PowerShell console:

powershell.exe Start-Process powershell -Verb runAs

Run PowerShell console

Install Microsoft Teams PowerShell Module

Install-Module MicrosoftTeams

Install-Module MicrosoftTeams


If you see the error PowerShellGet requires NuGet provider version '' or newer..., then run the following commands:

Install-Module PowershellGet -AllowClobber -Force

And try again to install module MicrosoftTeams.

to Microsoft Teams (as tenant global admin)

In PowerShell console, run:


You will be asked to sign in to your Microsoft accounts. Make sure you sing-in with your Teams global administrator account.


After a successfull sign-in, you should see your Teams tenant ID in a console.

Connect-MicrosoftTeams Success

The section below provide instructions how to remove a Compliance Recording Policy in Microsoft Teams account.

Step 1. Define variables

# Replace MIAREC_APPLICATION_ID with the value provided by MiaRec

# Define variables
$PolicyName = "MiaRecRecording"

# Get Recording Application ObjectId
$RecorderObjectId = Get-CsOnlineApplicationInstance `
    | Where-Object {$_.ApplicationId -Match "$RecorderAppID"} `
    | Select-Object -ExpandProperty ObjectId

Step 2. Unassign a recording policy from users

First, check what users have been assigned the recording policy:

# Set your policy name below
$PolicyName = "MiaRecRecording"

Get-CsOnlineUser `
    | Where-Object {$_.TeamsComplianceRecordingPolicy  -eq $PolicyName} `
    | ft UserPrincipalName,TeamsComplianceRecordingPolicy

Next, for each user, run the following command to remove the policy assignment (replace USER_EMAIL_ADDRESS with actual user emails):

# Replace USER_EMAIL_ADDRESS with user's email
Grant-CsTeamsComplianceRecordingPolicy `
    -PolicyName $null `
    -Identity "USER_EMAIL_ADDRESS"

Step 3. Unassign a recording policy from groups

First, check what groups have the recording policy assignement:

Get-CsGroupPolicyAssignment -PolicyType TeamsComplianceRecordingPolicy

Next, for each group, run the following command to remove the policy assignment (replace GROUP_UPN with the users')

# Set the following variable to UPN of the group that 
# will be assigned a recording policy
$RecordedUsersGroup = ""

Remove-CsGroupPolicyAssignment `
    -GroupId $RecordedUsersGroup `
    -PolicyType TeamsComplianceRecordingPolicy

Step 4. Unassign a global recording policy

To unassign a global recording policy, you simply need to delete the Compliance Recording Policy (see the steps below).

Step 5. Delete recording application from a Compliance Recording Policy

Delete an existing association between an application instance of a policy-based recording application and a Teams recording policy for administering automatic policy-based recording in your tenant.

# Delete a policy
Remove-CsTeamsComplianceRecordingPolicy `
    -Identity $PolicyName `

Step 6. Delete a Compliance Recording Policy

Delete an existing Teams recording policy that is used to govern automatic policy-based recording in your tenant (documentation):

# Define variables
$PolicyName = "MiaRecRecording"

# Delete a policy
Remove-CsTeamsComplianceRecordingPolicy `
    -Identity $PolicyName `


This command only works, if no users are assigned to the policy. You will need to remove any users assigned to a policy prior to deletion.

Step 7. Delete the application instance

Microsoft does not provide a cmdlet for removing an online application instance. You can however find the application instance in Azure Active Directory and remove it from there. Application Instances are stored in the directory as a user account.

Login to Microsoft 365 admin center with you Microsoft admin credentials at

Navigate to Users > Active users and locate the MiaRec application user. Use a search box to quickly locate it by name. Select such a user and click Delete button.

MiaRec delete Microsoft Teams integration - delete application user