Edit

Tutorial: Manage Copilot credit allocations programmatically

Copilot credits fund agent and Copilot usage that you build with Copilot Studio across your Power Platform environments. As an administrator, you allocate credits to the environments that need them and decide what happens when an environment runs out of its allocated credits. In addition to the Power Platform admin center experience, you can manage Copilot credit allocations with code by using the Power Platform API and the administration (Admin) SDKs. Automating credit allocation is useful when you distribute capacity across many environments, standardize overage behavior, or manage allocations as part of a deployment pipeline.

In this tutorial, learn how to:

  • Manage Copilot credits in the Power Platform admin center.
  • Authenticate by using Power Platform API.
  • View the Copilot credits available to allocate.
  • Allocate Copilot credits to an environment.
  • Control whether an environment draws from tenant capacity.

Copilot credits are represented by the entitlement ID MCSMessages and are managed through the licensing/allocationsV2 operations of the Power Platform API. The allocationsV2/availability operation reports how much capacity is available to allocate, and the allocationsV2 operation writes an environment's allocation. All programmatic examples in this article use API version 2024-10-01.

Each environment allocation carries a set of enforcement rules that determine what happens when the environment consumes its allocated credits. The Draw from the available capacity in my tenant option in the admin center maps to the TenantPool enforcement rule: when it's enabled, the environment continues to draw from unallocated tenant capacity after its own allocation is exhausted; when it's disabled, the environment is capped at its allocation.

Prerequisites

  • An app registration configured for Power Platform API. Note the app registration's application (client) ID and directory (tenant) ID.

  • Permission to manage licensing and capacity. Sign in as a user with the Power Platform Administrator or Global Administrator role, or an equivalent role that can manage licensing and capacity.

  • For the SDK examples, install the SDK that ships monthly on its public gallery:

    dotnet add package Microsoft.PowerPlatform.Management
    
    pip install powerplatform-management
    

Manage Copilot credit allocations

This section shows the same end-to-end flow—check what's available, allocate credits to an environment, and control whether the environment draws from tenant capacity—in the Power Platform admin center and in each SDK. Use the tabs to switch between the admin center and your preferred language.

  1. Sign in to the Power Platform admin center.

  2. In the navigation pane, select Licensing.

  3. Under Products, select Copilot Studio, and then select Manage Copilot Credits.

    Screenshot of the Copilot Studio licensing page with the Manage Copilot Credits button highlighted.

  4. Select the environment that you want to manage. Use the Search box to find an environment by name.

    Screenshot of the Manage capacity pane with an environment selected from the list.

  5. Under Allocate capacity, enter the number of Copilot credits to allocate to the environment. The pane shows how many credits are consumed, how many are already allocated, and how many are available to be allocated from your tenant.

  6. Under Capacity overages, select or clear Draw from the available capacity in my tenant to control what happens when the environment exhausts its allocation:

    • Selected: after the environment's allocated credits are consumed, it continues to draw from your tenant's unallocated capacity.
    • Cleared: the environment is capped at its allocation and stops consuming when the allocation is exhausted.

    Screenshot of the Manage capacity pane showing the Allocate capacity field and the Draw from the available capacity in my tenant checkbox.

  7. Select Save.