모든 고객의 사용량 레코드 가져오기
적용 대상: 파트너 센터 | Microsoft Cloud for US Government 파트너 센터
파트너는 CustomerMonthlyUsageRecord 리소스 컬렉션을 사용하여 모든 고객의 사용량 레코드를 가져올 수 있습니다. 이 리소스는 모든 고객의 사용량 레코드를 나타냅니다. 여기에는 Microsoft Azure(MS-AZR-0145P) 구독 또는 Azure 플랜을 사용하는 고객이 포함됩니다.
필수 구성 요소
자격 증명(파트너 센터 인증에서 설명). 이 시나리오는 앱 + 사용자 자격 증명을 사용한 인증만 지원합니다.
고객 ID (
customer-tenant-id
). 고객의 ID를 모르는 경우 고객 작업 영역, 고객 목록에서 고객, 계정을 차례로 선택하여 파트너 센터에서 조회할 수 있습니다. 고객 계정 페이지의 고객 계정 정보 섹션에서 Microsoft ID를 찾습니다. Microsoft ID는 고객 ID(customer-tenant-id
)와 동일합니다.
C#
현재 청구 기간 동안 특정 Azure 서비스 또는 리소스를 구매한 모든 고객의 모든 사용 레코드를 얻으려면 다음을 수행합니다.
IAggregatePartner.Customers 컬렉션을 사용하여 ById() 메서드를 호출합니다.
UsageRecords 속성을 호출한 다음 Get() 또는 GetAsync() 메서드를 호출합니다.
// IAggregatePartner partnerOperations; var usageRecords = partnerOperations.Customers.UsageRecords.Get();
예제를 보려면 다음 샘플을 참조하세요.
- 샘플: 콘솔 테스트 앱
- 프로젝트: PartnerSDK.FeatureSamples
- 클래스: GetCustomerUsageRecords.cs
REST 요청
요청 구문
방법 | 요청 URI |
---|---|
GET | {baseURL}/v1/customers/usagerecords HTTP/1.1 |
요청 헤더
자세한 내용은 파트너 센터 REST 헤더를 참조하세요.
요청 본문
없음
요청 예제
GET https://api.partnercenter.microsoft.com/v1/customers/usagerecords HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: e128c8e2-4c33-4940-a3e2-2e59b0abdc67
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
REST 응답
성공하면 이 메서드는 응답 본문에 CustomerMonthlyUsageRecord 리소스를 반환합니다.
응답 성공 및 오류 코드
각 응답에는 성공 또는 실패와 추가 디버깅 정보를 나타내는 HTTP 상태 코드가 함께 제공됩니다. 네트워크 추적 도구를 사용하여 코드, 오류 유형 및 추가 매개 변수를 읽을 수 있습니다. 전체 목록은 오류 코드를 참조하세요.
응답 예제
isUpgraded 속성을 사용하여 Azure 플랜이 있는 고객을 식별할 수 있습니다. isUpgraded 값이 true이면 고객에게 Azure 플랜이 있다는 의미입니다.
HTTP/1.1 200 OK
Content-Length: 1120
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: e128c8e2-4c33-4940-a3e2-2e59b0abdc67
Date: Tue, 17 Sep 2019 20:31:45 GMT
{
"totalCount": 25,
"items": [
{
"budget": {
"attributes": {
"objectType": "SpendingBudget"
}
},
"customerSpendingBudget": {
"attributes": {
"objectType": "SpendingBudget"
}
},
"percentUsed": 0,
"isUpgraded": false,
"resourceId": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"id": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"resourceName": "LEGACY AZURE CUSTOMER SE",
"name": "LEGACY AZURE CUSTOMER SE",
"totalCost": 0,
"currencyLocale": "fr-FR",
"usdTotalCost": 0,
"lastModifiedDate": "2019-08-01T23:00:16.57+00:00",
"attributes": {
"objectType": "CustomerMonthlyUsageRecord"
}
},
{
"budget": {
"amount": 20,
"attributes": {
"objectType": "SpendingBudget"
}
},
"percentUsed": 602.84,
"isUpgraded": true,
"resourceId": "b1b1b1b1-cccc-dddd-eeee-f2f2f2f2f2f2",
"id": "b1b1b1b1-cccc-dddd-eeee-f2f2f2f2f2f2",
"resourceName": "Modern Azure Customer SE",
"name": "Modern Azure Customer SE",
"totalCost": 120.5682999999995904716,
"currencyCode": "SEK",
"usdTotalCost": 12.39999999999999985235,
"lastModifiedDate": "2019-09-17T17:08:11.1433333+00:00",
"attributes": {
"objectType": "CustomerMonthlyUsageRecord"
}
},
{
"budget": {
"attributes": {
"objectType": "SpendingBudget"
}
},
"percentUsed": 0,
"isUpgraded": true,
"resourceId": "c2c2c2c2-dddd-eeee-ffff-a3a3a3a3a3a3",
"id": "c2c2c2c2-dddd-eeee-ffff-a3a3a3a3a3a3",
"resourceName": "Test_Test_MA20190829_14",
"name": "Test_Test_MA20190829_14",
"totalCost": 0,
"currencyCode": "GBP",
"usdTotalCost": 0,
"lastModifiedDate": "2019-09-17T17:08:11.1433333+00:00",
"attributes": {
"objectType": "CustomerMonthlyUsageRecord"
}
},
{
"budget": {
"amount": 97,
"attributes": {
"objectType": "SpendingBudget"
}
},
"percentUsed": 28.08,
"isUpgraded": true,
"resourceId": "d3d3d3d3-eeee-ffff-aaaa-b4b4b4b4b4b4",
"id": "d3d3d3d3-eeee-ffff-aaaa-b4b4b4b4b4b4",
"resourceName": "Modern Azure Customer UK",
"name": "Modern Azure Customer UK",
"totalCost": 27.23292827625710931604,
"currencyCode": "GBP",
"usdTotalCost": 33.280000000000001044,
"lastModifiedDate": "2019-09-17T17:08:11.1433333+00:00",
"attributes": {
"objectType": "CustomerMonthlyUsageRecord"
}
}
],
"links": {
"self": {
"uri": "/customers/usagerecords",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Collection"
}
}