Copilot 크레딧은 Power Platform 환경 전반에서 Copilot Studio를 사용해 구축하는 에이전트 및 Copilot 사용량을 지원합니다. 관리자는 필요한 환경에 크레딧을 할당하고 환경이 할당된 크레딧이 부족할 때 어떤 일이 발생하는지 결정합니다.
Power Platform 관리 센터 환경 외에도 Power Platform API 및 관리(관리자) SDK를 사용하여 코드로 Copilot 크레딧 할당을 관리할 수 있습니다. 크레딧 할당 자동화는 여러 환경에 용량을 분산하거나, 초과분 동작을 표준화하거나, 배포 파이프라인의 일부로 할당을 관리하는 경우에 유용합니다.
이 자습서에서는 다음 방법을 알아봅니다.
- Power Platform 관리 센터에서 Copilot 크레딧을 관리합니다.
- Power Platform API를 사용하여 인증합니다.
- 할당할 수 있는 Copilot 크레딧을 봅니다.
- 환경에 Copilot 크레딧을 할당합니다.
- 환경이 테넌트 용량을 사용하는지 여부를 제어합니다.
Copilot 크레딧은 자격 ID MCSMessages 로 표시되며 Power Platform API의 작업을 통해 licensing/allocationsV2 관리됩니다. 작업은 allocationsV2/availability 할당할 수 있는 용량을 보고하고 allocationsV2 작업은 환경의 할당을 기록합니다. 이 문서의 모든 프로그래밍 예제는 API 버전을 2024-10-01사용합니다.
각 환경 할당은 환경이 할당된 크레딧을 사용할 때 발생하는 작업을 결정하는 일련의 적용 규칙을 전달합니다. 관리 센터의 내 테넌트의 사용 가능한 용량에서 사용 옵션은 TenantPool 적용 규칙에 해당합니다. 이 옵션을 사용하도록 설정하면 환경 자체에 할당된 용량이 소진된 후에도 할당되지 않은 테넌트 용량을 계속 사용하고, 사용하지 않도록 설정하면 환경은 할당된 용량까지만 사용할 수 있습니다.
Warning
게시된 환경 그룹 규칙이 내 테넌트의 사용 가능한 용량에서 그리기를 제어하는 경우 개별 환경에 대한 설정을 재정의할 수 없습니다. Power Platform 관리 센터, Power Platform API 또는 관리 SDK를 통한 업데이트는 오류와 함께 TenantPoolLockedByPolicy 거부됩니다. 환경 그룹에 대한 규칙을 변경하고 다시 게시하거나 그룹에서 환경을 제거 하여 설정을 독립적으로 관리합니다. 제거 후 환경에서는 그룹이 마지막으로 적용한 값을 유지하지만 설정을 편집할 수 있게 됩니다. 사용 가능한 그룹 규칙에 대한 자세한 내용은 환경 그룹에 대한 규칙을 참조하세요.
사전 요구 사항
Power Platform API에 대해 구성된 앱 등록입니다. 앱 등록의 애플리케이션(클라이언트) ID 및 디렉터리(테넌트) ID를 확인합니다.
라이선스 및 용량을 관리할 수 있는 권한입니다.
Power Platform 관리자 또는 전역 관리자 역할 또는 라이선스 및 용량을 관리할 수 있는 동등한 역할을 사용하여 사용자로 로그인합니다.
SDK 예제의 경우 공개 갤러리에 매월 제공되는 SDK를 설치합니다.
dotnet add package Microsoft.PowerPlatform.Management
pip install powerplatform-management
Copilot 크레딧 할당 관리
이 섹션에서는 Power Platform 관리 센터와 각 SDK에서 무엇을 사용할 수 있는지 확인하고, 환경에 크레딧을 할당하고, 해당 환경이 테넌트 용량을 사용하도록 할지 제어하는 동일한 엔드투엔드 흐름을 보여 줍니다. 탭을 사용하여 관리 센터와 기본 설정 언어 간에 전환합니다.
Power Platform 관리 센터에 로그인합니다.
탐색 창에서 라이선싱을 선택합니다.
제품에서 Copilot Studio 선택한 다음, Copilot 크레딧 관리를 선택합니다.
관리하려는 환경을 선택합니다.
검색 상자를 사용하여 이름으로 환경을 찾습니다.
할당 용량에서 환경에 할당할 Copilot 크레딧 수를 입력합니다. 창에는 사용된 크레딧 수, 이미 할당된 크레딧 수 및 테넌트에서 할당할 수 있는 크레딧이 표시됩니다.
용량 초과에서 내 테넌트의 사용 가능한 용량에서 그리기를 선택하거나 선택 취소하여 환경에서 해당 할당이 소진될 때 발생하는 상황을 제어합니다.
-
선택됨: 환경에 할당된 크레딧이 소진된 후에는 테넌트의 할당되지 않은 용량을 계속 사용합니다.
-
해제됨: 환경은 할당량으로 제한되며, 할당량이 소진되면 리소스 소비를 중단합니다.
저장을 선택합니다.
다음 예제에서는 현재 사용자로 대화형 로그인한 다음, 할당 가능한 Copilot 크레딧을 확인하고, 환경에 크레딧을 할당한 후 내 테넌트의 사용 가능한 용량에서 가져오기를 해제하여 환경이 할당된 크레딧 한도까지만 사용되도록 합니다.
# Requires the MSAL.PS module: Install-Module MSAL.PS -Scope CurrentUser
Import-Module "MSAL.PS"
$clientId = "<application (client) ID of your app registration>"
$tenantId = "<directory (tenant) ID>"
$environmentId = "<environment ID>"
$apiBaseUrl = "https://api.powerplatform.com"
$apiVersion = "2024-10-01"
# Sign in interactively and request a token for the Power Platform API
$auth = Get-MsalToken -ClientId $clientId -TenantId $tenantId -Scope "https://api.powerplatform.com/.default" -Interactive
$headers = @{ Authorization = "Bearer $($auth.AccessToken)" }
# 1. View the Copilot Credits available to allocate for the environment
$filter = [uri]::EscapeDataString("environmentId eq '$environmentId' and EntitlementId in ('MCSMessages')")
$availability = Invoke-RestMethod -Method Get `
-Uri "$apiBaseUrl/licensing/allocationsV2/availability?api-version=$apiVersion&`$filter=$filter" `
-Headers $headers
$availability.entitlementAllocationsAvailable |
ForEach-Object { Write-Host "$($_.entitlementId): $($_.availableQuantity) available" }
# 2. Allocate Copilot Credits to the environment and turn off tenant capacity draw
$allocationBody = @{
scope = @{ environmentId = $environmentId }
allocatedEntitlements = @(
@{
entitlementId = "MCSMessages"
allocation = @{ quantity = 5000 }
enforcementRules = @(
# Disable TenantPool so the environment is capped at its allocation.
# Set enabled = $true to let the environment draw from tenant capacity.
@{ ruleType = "TenantPool"; enabled = $false }
)
}
)
} | ConvertTo-Json -Depth 10
Invoke-RestMethod -Method Put `
-Uri "$apiBaseUrl/licensing/allocationsV2?api-version=$apiVersion" `
-Headers $headers -ContentType "application/json" -Body $allocationBody
Write-Host "Updated Copilot credit allocation for environment $environmentId"
다음 예제에서는 앱 등록의 클라이언트 ID를 사용하여 대화형으로 로그인하고, 할당할 수 있는 Copilot 크레딧을 읽고, 환경에 크레딧을 할당하고, 내 테넌트의 사용 가능한 용량에서 그리기를 꺼서 환경이 해당 할당으로 제한됩니다.
using Microsoft.PowerPlatform.Management;
using Microsoft.PowerPlatform.Management.Models;
// Create an interactive client using your app registration's client ID.
// A browser window opens for sign-in.
var factory = new ServiceClientFactory();
var client = factory.Create("YOUR_CLIENT_ID");
var environmentId = "<environment ID>";
var apiVersion = "2024-10-01";
// 1. View the Copilot Credits available to allocate for the environment
var availability = await client.Licensing.AllocationsV2.Availability.GetAsync(config =>
{
config.QueryParameters.ApiVersion = apiVersion;
config.QueryParameters.Filter =
$"environmentId eq '{environmentId}' and EntitlementId in (MCSMessages)";
});
foreach (var entitlement in availability.EntitlementAllocationsAvailable)
{
Console.WriteLine($"{entitlement.EntitlementId}: {entitlement.AvailableQuantity} available");
}
// 2. Allocate Copilot Credits to the environment and turn off tenant capacity draw
var request = new AllocationPutRequestModel
{
Scope = new ScopeModel { EnvironmentId = environmentId },
AllocatedEntitlements = new List<EntitlementAllocationModel>
{
new EntitlementAllocationModel
{
EntitlementId = "MCSMessages",
Allocation = new AllocationModel { Quantity = 5000 },
EnforcementRules = new List<AllocationEnforcementRule>
{
// Disable TenantPool so the environment is capped at its allocation.
// Set Enabled = true to let the environment draw from tenant capacity.
new AllocationEnforcementRule
{
RuleType = AllocationEnforcementRuleTypes.TenantPool,
Enabled = false
}
}
}
}
};
await client.Licensing.AllocationsV2.PutAsync(request, config =>
{
config.QueryParameters.ApiVersion = apiVersion;
});
Console.WriteLine($"Updated Copilot credit allocation for environment {environmentId}");
다음 예제에서는 앱 등록의 클라이언트 ID를 사용하여 대화형으로 로그인하고, 할당할 수 있는 Copilot 크레딧을 읽고, 환경에 크레딧을 할당하고, 내 테넌트의 사용 가능한 용량에서 그리기를 꺼서 환경이 해당 할당으로 제한됩니다.
import asyncio
from azure.identity import InteractiveBrowserCredential
from kiota_abstractions.base_request_configuration import RequestConfiguration
from kiota_authentication_azure.azure_identity_authentication_provider import (
AzureIdentityAuthenticationProvider,
)
from kiota_http.httpx_request_adapter import HttpxRequestAdapter
from mspp_management.service_client_base import ServiceClientBase
from mspp_management.licensing.allocations_v2.allocations_v2_request_builder import (
AllocationsV2RequestBuilder,
)
from mspp_management.licensing.allocations_v2.availability.availability_request_builder import (
AvailabilityRequestBuilder,
)
from mspp_management.models.allocation_put_request_model import AllocationPutRequestModel
from mspp_management.models.scope_model import ScopeModel
from mspp_management.models.entitlement_allocation_model import EntitlementAllocationModel
from mspp_management.models.allocation_model import AllocationModel
from mspp_management.models.allocation_enforcement_rule import AllocationEnforcementRule
from mspp_management.models.allocation_enforcement_rule_types import (
AllocationEnforcementRuleTypes,
)
API_VERSION = "2024-10-01"
async def manage_copilot_credits(client: ServiceClientBase, environment_id: str):
# 1. View the Copilot Credits available to allocate for the environment
query_params = AvailabilityRequestBuilder.AvailabilityRequestBuilderGetQueryParameters(
api_version=API_VERSION,
filter=f"environmentId eq '{environment_id}' and EntitlementId in (MCSMessages)",
)
availability = await client.licensing.allocations_v2.availability.get(
request_configuration=RequestConfiguration(query_parameters=query_params)
)
for entitlement in availability.entitlement_allocations_available:
print(f"{entitlement.entitlement_id}: {entitlement.available_quantity} available")
# 2. Allocate Copilot Credits to the environment and turn off tenant capacity draw
# Disable TenantPool so the environment is capped at its allocation.
# Set enabled = True to let the environment draw from tenant capacity.
tenant_pool_rule = AllocationEnforcementRule()
tenant_pool_rule.rule_type = AllocationEnforcementRuleTypes.TenantPool
tenant_pool_rule.enabled = False
entitlement = EntitlementAllocationModel()
entitlement.entitlement_id = "MCSMessages"
entitlement.allocation = AllocationModel()
entitlement.allocation.quantity = 5000
entitlement.enforcement_rules = [tenant_pool_rule]
request = AllocationPutRequestModel()
request.scope = ScopeModel()
request.scope.environment_id = environment_id
request.allocated_entitlements = [entitlement]
put_params = AllocationsV2RequestBuilder.AllocationsV2RequestBuilderPutQueryParameters(
api_version=API_VERSION,
)
await client.licensing.allocations_v2.put(
request, request_configuration=RequestConfiguration(query_parameters=put_params)
)
print(f"Updated Copilot credit allocation for environment {environment_id}")
async def main():
# Sign in interactively using your app registration's client ID.
credential = InteractiveBrowserCredential(client_id="YOUR_CLIENT_ID")
auth_provider = AzureIdentityAuthenticationProvider(
credentials=credential,
scopes=["https://api.powerplatform.com/.default"],
)
adapter = HttpxRequestAdapter(authentication_provider=auth_provider)
client = ServiceClientBase(adapter)
await manage_copilot_credits(client, environment_id="<environment ID>")
asyncio.run(main())