获取可用许可证的列表

本文介绍如何获取指定客户用户可用的许可证列表。

以下示例返回 group1 提供的许可证,即表示由Azure Active Directory (Azure AD) 管理的许可证的默认许可证组。 若要获取指定许可证组的可用许可证,请参阅 按许可证组获取可用许可证的列表

必备条件

  • 合作伙伴中心身份验证中所述的凭据。 此方案只支持使用应用凭据和用户凭据进行身份验证。

  • 客户 ID (customer-tenant-id)。 如果不知道客户的 ID,则可以在合作伙伴中心仪表板中查找它。 从“合作伙伴中心”菜单中选择“CSP” ,然后选择“客户” 。 从客户列表中选择客户,然后选择“帐户” 。 在客户的“帐户”页上的“客户帐户信息” 部分查找 Microsoft ID。 Microsoft ID 与客户 ID (customer-tenant-id) 相同。

GDAP 角色:目录读取者、全局读取者

C#

检索从默认许可证组提供给客户用户的许可证列表:

  1. IAggregatePartner.Customers.ById 方法与客户 ID 配合使用来标识客户。

  2. 获取 SubscribedSkus 属性的值,以检索客户订阅的 SKU 收集操作的接口。

  3. 调用 Get 或 GetAsync 方法以检索许可证列表。

// string selectedCustomerId;
// IAggregatePartner partnerOperations;

var customerUserSubscribedSkus = partnerOperations.Customers.ById(selectedCustomerId).SubscribedSkus.Get();

有关示例,请参阅以下内容:

  • 示例: 控制台测试应用
  • Project:合作伙伴中心 SDK 示例
  • 类: GetCustomerSubscribedSkus.cs

REST 请求

请求语法

方法 请求 URI
GET {baseURL}/v1/customers/{customer-id}/subscribedskus HTTP/1.1

URI 参数

请使用以下路径参数来标识客户。

名称 类型 必需 说明
customer-id string 标识客户的 GUID 格式字符串。

请求标头

有关详细信息,请参阅合作伙伴中心 REST 标头

请求正文

无。

请求示例

GET https://api.partnercenter.microsoft.com/v1/customers/0c39d6d5-c70d-4c55-bc02-f620844f3fd1/subscribedskus HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 53308f82-1bf7-44e2-8dda-4517e4688bd4
MS-CorrelationId: 95660db2-7425-4021-babe-a26ddbcb0187
X-Locale: en-US
Host: api.partnercenter.microsoft.com

REST 响应

如果成功,响应正文包含 SubscribedSku 资源的集合。

响应的成功和错误代码

每个响应都带有一个 HTTP 状态代码,用于指示成功或失败以及其他调试信息。 请使用网络跟踪工具来读取此代码、错误类型和其他参数。 有关完整列表,请参阅 合作伙伴中心 REST 错误代码

响应示例

HTTP/1.1 200 OK
Content-Length: 4859
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 95660db2-7425-4021-babe-a26ddbcb0187
MS-RequestId: 53308f82-1bf7-44e2-8dda-4517e4688bd4
MS-CV: 7BQ0jitzXUCLwRM6.0
MS-ServerId: 020021921
Date: Fri, 09 Jun 2017 17:50:46 GMT

 {
    "totalCount": 2,
    "items": [{
            "availableUnits": 4,
            "activeUnits": 5,
            "consumedUnits": 1,
            "suspendedUnits": 0,
            "totalUnits": 5,
            "warningUnits": 0,
            "productSku": {
                "id": "efccb6f7-5641-4e0e-bd10-b4976e1bf68e",
                "name": "Enterprise Mobility + Security E3",
                "skuPartNumber": "EMS",
                "targetType": "User",
                "licenseGroupId": "group1"
            },
            "servicePlans": [{
                    "displayName": "Azure Information Protection Premium P1",
                    "serviceName": "RMS_S_PREMIUM",
                    "id": "6c57d4b6-3b23-47a5-9bc9-69f17b4947b3",
                    "capabilityStatus": "Enabled",
                    "targetType": "User"
                }, {
                    "displayName": "Microsoft Intune A Direct",
                    "serviceName": "INTUNE_A",
                    "id": "c1ec4a95-1f05-45b3-a911-aa3fa01094f5",
                    "capabilityStatus": "Enabled",
                    "targetType": "User"
                }, {
                    "displayName": "Microsoft Azure Active Directory Rights",
                    "serviceName": "RMS_S_ENTERPRISE",
                    "id": "bea4c11e-220a-4e6d-8eb8-8ea15d019f90",
                    "capabilityStatus": "Enabled",
                    "targetType": "User"
                }, {
                    "displayName": "Azure Active Directory Premium P1",
                    "serviceName": "AAD_PREMIUM",
                    "id": "41781fb2-bc02-4b7c-bd55-b576c07bb09d",
                    "capabilityStatus": "Enabled",
                    "targetType": "User"
                }, {
                    "displayName": "Microsoft Azure Multi-Factor Authentication",
                    "serviceName": "MFA_PREMIUM",
                    "id": "8a256a2b-b617-496d-b51b-e76466e88db0",
                    "capabilityStatus": "Enabled",
                    "targetType": "User"
                }
            ],
            "capabilityStatus": "Enabled",
            "attributes": {
                "objectType": "SubscribedSku"
            }
        },  {
            "availableUnits": 0,
            "activeUnits": 1,
            "consumedUnits": 1,
            "suspendedUnits": 0,
            "totalUnits": 1,
            "warningUnits": 0,
            "productSku": {
                "id": "f8a1db68-be16-40ed-86d5-cb42ce701560",
                "name": "Power BI Pro",
                "skuPartNumber": "POWER_BI_PRO",
                "targetType": "User",
                "licenseGroupId": "group1"
            },
            "servicePlans": [{
                    "displayName": "Exchange Foundation",
                    "serviceName": "EXCHANGE_S_FOUNDATION",
                    "id": "113feb6c-3fe4-4440-bddc-54d774bf0318",
                    "capabilityStatus": "Enabled",
                    "targetType": "Tenant"
                }, {
                    "displayName": "Power BI Pro",
                    "serviceName": "BI_AZURE_P2",
                    "id": "70d33638-9c74-4d01-bfd3-562de28bd4ba",
                    "capabilityStatus": "Enabled",
                    "targetType": "User"
                }
            ],
            "capabilityStatus": "Enabled",
            "attributes": {
                "objectType": "SubscribedSku"
            }
        }
    ],
    "attributes": {
        "objectType": "Collection"
    }
}