How to Bulk-Assign Copilot Licenses With PowerShell
🔍 WiseChecker

How to Bulk-Assign Copilot Licenses With PowerShell

Assigning Microsoft 365 Copilot licenses to hundreds or thousands of users one by one in the admin center is slow and error-prone. Bulk assignment through PowerShell saves time and reduces mistakes. This article explains how to use the Microsoft Graph PowerShell SDK to assign Copilot licenses to multiple users at once using a CSV file or group membership. You will learn the exact commands, required permissions, and how to handle common errors during bulk license assignment.

Key Takeaways: Bulk-Assign Copilot Licenses With PowerShell

  • Microsoft Graph PowerShell SDK module: Required to connect to your tenant and run license assignment commands.
  • Connect-MgGraph -Scopes User.ReadWrite.All, Organization.Read.All: Scopes needed to read user accounts and assign licenses.
  • Set-MgUserLicense -UserId -AddLicenses : Core cmdlet that adds a Copilot license to a single user.
  • CSV file with UserPrincipalName column: The input format used to loop through multiple users and assign licenses in bulk.

Understanding Copilot License SKUs and Prerequisites

Before you assign licenses, you need the correct SKU identifier for your Copilot plan. Microsoft 365 Copilot uses the SKU name SPE_E5 or Microsoft_365_Copilot depending on your tenant region and offer type. To find the exact SKU for your tenant, run the command Get-MgSubscribedSku after connecting to Microsoft Graph. The output shows each SKU’s SkuPartNumber property. Common Copilot SKU part numbers include:

  • SPE_E5 – Microsoft 365 E5 Copilot
  • Microsoft_365_Copilot – Microsoft 365 Copilot standalone
  • COPILOT_STUDENT – Copilot for Microsoft 365 for students

You also need the following prerequisites:

  • Microsoft Graph PowerShell SDK installed. Install with Install-Module Microsoft.Graph -Scope CurrentUser.
  • Global Administrator or License Administrator role in Microsoft Entra ID.
  • A CSV file listing the users who need the Copilot license. The file must include a column named UserPrincipalName.
  • Enough available Copilot licenses in your tenant. Check in the Microsoft 365 admin center under Billing > Licenses.

Steps to Bulk-Assign Copilot Licenses With PowerShell

Follow these steps to assign Copilot licenses to multiple users from a CSV file. Each step includes the exact PowerShell command to run.

  1. Connect to Microsoft Graph
    Open PowerShell as an administrator. Run Connect-MgGraph -Scopes User.ReadWrite.All, Organization.Read.All. A browser window opens. Sign in with a Global Administrator or License Administrator account. After successful sign-in, the PowerShell prompt shows Welcome to Microsoft Graph!.
  2. Find your Copilot SKU ID
    Run Get-MgSubscribedSku | Select-Object SkuPartNumber, SkuId, ConsumedUnits, PrepaidUnits. Look for the row where SkuPartNumber matches your Copilot plan. Copy the SkuId value. This is a GUID like 184efa21-94c3-4e26-8e13-2b50e88f0e5f.
  3. Prepare your CSV file
    Create a CSV file named CopilotUsers.csv with this exact content (replace with real user principal names):
    UserPrincipalName
    user1@contoso.com
    user2@contoso.com
    user3@contoso.com

    Save the file to C:\Scripts\CopilotUsers.csv.
  4. Run the bulk assignment script
    Run this script in the same PowerShell session:
    $users = Import-Csv -Path "C:\Scripts\CopilotUsers.csv"
    $skuId = "YOUR-SKU-ID-HERE"
    foreach ($user in $users) {
    $upn = $user.UserPrincipalName
    Set-MgUserLicense -UserId $upn -AddLicenses @{SkuId = $skuId} -RemoveLicenses @()
    Write-Host "License assigned to $upn" -ForegroundColor Green
    }

    Replace YOUR-SKU-ID-HERE with the GUID you copied in step 2. The script loops through each user in the CSV and assigns the Copilot license. Green confirmation messages appear for each success.
  5. Verify the assignments
    Run Get-MgUser -UserId user1@contoso.com -Property AssignedLicenses | Select-Object -ExpandProperty AssignedLicenses. Check that the SkuId matches your Copilot SKU. Repeat for a few users from the CSV to confirm all assignments succeeded.

Assign Copilot Licenses Based on Group Membership

If you prefer to assign licenses to all members of a security group, use this alternative method. First, get the group object ID from the Microsoft Entra admin center. Then run:

$groupId = "YOUR-GROUP-OBJECT-ID"
$skuId = "YOUR-SKU-ID-HERE"
$members = Get-MgGroupMember -GroupId $groupId -All
foreach ($member in $members) {
Set-MgUserLicense -UserId $member.Id -AddLicenses @{SkuId = $skuId} -RemoveLicenses @()
Write-Host "License assigned to $($member.Id)" -ForegroundColor Green
}

Replace the placeholders with your group ID and SKU ID. This method does not require a CSV file and automatically includes new group members when you run the script again.

Common Bulk-License Assignment Errors and Fixes

“Insufficient privileges to complete the operation”

This error means your account lacks the required admin role. Sign in with a Global Administrator or License Administrator account. To verify your current role, run (Get-MgContext).Scopes and check that User.ReadWrite.All appears in the list.

“License could not be assigned because the user already has the license”

The script tries to assign a license that the user already holds. To skip these users, add an if condition before the assignment. First, check the user’s current licenses with Get-MgUserLicenseDetail -UserId $upn. If the SKU ID already exists, skip that user.

“The license SKU is not available in this tenant”

You used an incorrect SKU ID. Run Get-MgSubscribedSku again and confirm the exact SkuPartNumber for Copilot. Copy the corresponding SkuId value. If you do not see any Copilot SKU, purchase licenses first in the Microsoft 365 admin center under Billing > Purchase services.

“User not found”

The UserPrincipalName in the CSV does not match any user in your tenant. Open the CSV and verify each email address. Use Get-MgUser -Filter "UserPrincipalName eq 'user@contoso.com'" to test individual entries. Correct any typos and rerun the script.

Bulk PowerShell vs Admin Center: Key Differences

Item PowerShell Bulk Method Microsoft 365 Admin Center
Time to assign 500 licenses 2-5 minutes 30-60 minutes
Error handling Manual with try-catch blocks Built-in retry for failed assignments
CSV or group input CSV file or group object ID Manual user selection or CSV upload
Audit log Write-Host output or export to file Built-in activity log in admin center
Requires admin role Global Admin or License Admin Global Admin or License Admin

You can now assign Copilot licenses to hundreds of users in minutes using PowerShell. Start with a small test group of three users to verify the SKU ID and script logic. Then scale up to your full user list. For recurring assignments such as new hires, save the script as a .ps1 file and run it weekly. Combine this method with group-based licensing in Microsoft Entra ID to automate license assignment when users join or leave security groups.