How to Remove Copilot Licenses in Bulk With PowerShell
🔍 WiseChecker

How to Remove Copilot Licenses in Bulk With PowerShell

If your organization has assigned Microsoft Copilot licenses to hundreds or thousands of users and you need to reclaim them, the Microsoft 365 admin center is too slow. You need a bulk removal method that works fast and without errors. The root cause of this problem is that Copilot licenses are assigned per user through Azure Active Directory group-based licensing or direct assignment, and there is no single toggle to remove them all at once. This article explains how to use PowerShell to remove Copilot licenses from multiple users in one script, saving hours of manual work.

Key Takeaways: Bulk License Removal With PowerShell

  • Connect-MgGraph -Scopes “User.ReadWrite.All”, “Organization.Read.All”: Required to authenticate and modify user licenses via Microsoft Graph.
  • Get-MgUserLicenseDetail -UserId: Retrieves the exact SKU ID for the Copilot license assigned to each user.
  • Set-MgUserLicense -UserId -AddLicenses @() -RemoveLicenses @(“SKU_ID”): The command that removes the Copilot license from a single user or an array of users.

ADVERTISEMENT

How Copilot License Assignment Works in Microsoft 365

Microsoft Copilot for Microsoft 365 is licensed as an add-on SKU. The SKU name varies by plan: for example, Microsoft 365 Copilot uses SKU ID CFQ7TTC0LG0Z in some tenants, but the actual product name in Azure AD is Microsoft 365 Copilot with a specific GUID. When you assign a Copilot license to a user, Azure AD records the assignment in the user’s assignedLicenses property. To remove the license, you must know the SKU ID (also called the product ID) of that Copilot plan. You can find it by running Get-MgSubscribedSku in the Microsoft Graph PowerShell SDK. The bulk removal script loops through a list of users, retrieves each user’s current licenses, and removes only the Copilot SKU while leaving other licenses intact.

Prerequisites

Before you run any PowerShell commands, you need:

  • The Microsoft Graph PowerShell module installed. Run Install-Module Microsoft.Graph -Scope CurrentUser in an elevated PowerShell window.
  • A Global Administrator or License Administrator role in Microsoft Entra ID.
  • A list of users with Copilot licenses. You can export this from the Microsoft 365 admin center or generate it from a CSV file.

Steps to Remove Copilot Licenses in Bulk With PowerShell

  1. Connect to Microsoft Graph
    Open PowerShell as an administrator. Run Connect-MgGraph -Scopes "User.ReadWrite.All", "Organization.Read.All". Sign in with your admin account when prompted. This establishes the session required to read and modify user license assignments.
  2. Find the Copilot SKU ID
    Run Get-MgSubscribedSku | Select-Object SkuPartNumber, SkuId. Look for the entry where SkuPartNumber contains Microsoft 365 Copilot or Copilot. Copy the SkuId value — it looks like a GUID such as cfq7ttc0lg0z (example). Save it as a variable: $copilotSkuId = "YOUR_SKU_ID".
  3. Prepare the user list
    Create a CSV file named users.csv with one column UserPrincipalName. List each user on a separate line. Example content:
    user1@contoso.com
    user2@contoso.com
    Import the list into PowerShell: $users = Import-Csv -Path "C:\path\to\users.csv"
  4. Loop through each user and remove the Copilot license
    Run the following script block:
    foreach ($user in $users) {
        $userId = $user.UserPrincipalName
        $currentLicenses = Get-MgUserLicenseDetail -UserId $userId
        $copilotLicense = $currentLicenses | Where-Object { $_.SkuId -eq $copilotSkuId }
        if ($copilotLicense) {
            Set-MgUserLicense -UserId $userId -AddLicenses @() -RemoveLicenses @($copilotSkuId)
            Write-Host "Removed Copilot license from $userId" -ForegroundColor Green
        } else {
            Write-Host "No Copilot license found for $userId" -ForegroundColor Yellow
        }
    }
  5. Verify the removal
    After the script completes, check a few users by running Get-MgUserLicenseDetail -UserId "user@contoso.com" | Select-Object SkuPartNumber. Confirm that the Copilot SKU no longer appears. You can also check the Microsoft 365 admin center under Users > Active Users and select a user to see the license tab.

ADVERTISEMENT

Common Issues When Removing Licenses in Bulk

The script returns an access denied error

This happens when the account used to connect to Microsoft Graph lacks the required permissions. Ensure you have the User.ReadWrite.All and Organization.Read.All scopes. Reconnect with Disconnect-MgGraph then Connect-MgGraph -Scopes "User.ReadWrite.All", "Organization.Read.All". Also verify your admin role in the Microsoft Entra admin center under Roles and administrators.

The SKU ID is not found in Get-MgSubscribedSku

If the Copilot SKU does not appear, your tenant may use a different product name. Run Get-MgSubscribedSku | Format-Table SkuPartNumber, SkuId and look for any entry containing COPILOT or M365_COPILOT. In some tenants, the SKU part number is M365_COPILOT. Use the corresponding SkuId.

The script removes the wrong license from a user

This can occur if the $copilotSkuId variable contains an incorrect GUID. Double-check the SKU ID by comparing it against the output from Get-MgSubscribedSku. Also, the script only removes licenses that match the exact SKU ID you provide. If a user has multiple licenses, other licenses remain unaffected.

PowerShell Bulk Removal vs Manual Removal in Admin Center

Item PowerShell Bulk Removal Manual Removal in Admin Center
Time to remove 500 licenses 2-5 minutes 2-4 hours
Error handling Built-in with try-catch blocks None — must redo failed steps
Audit trail PowerShell transcript or Write-Host output Manual logging required
Requires admin role Global Admin or License Admin Global Admin or License Admin
Supports group-based licensing Yes, with additional commands No — must remove user from group

For organizations with more than 50 users, PowerShell bulk removal is the faster and more reliable method. The manual approach in the admin center works for one-off removals but scales poorly.

You can now remove Copilot licenses from any number of users using the PowerShell script provided. To extend this process, consider automating it with Azure Automation or a scheduled runbook. As an advanced tip, use the -WhatIf parameter with Set-MgUserLicense before running the actual removal to preview which licenses would be removed.

ADVERTISEMENT