列出按计费对象信息计费的客户。 只有协议类型为 Microsoft 合作伙伴协议的计费帐户支持该操作。
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers?api-version=2020-05-01
With optional parameters:
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers?api-version=2020-05-01&$search={$search}&$filter={$filter}
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
billingAccountName
|
path |
True
|
string
|
唯一标识计费帐户的 ID。
|
billingProfileName
|
path |
True
|
string
|
唯一标识计费对象信息的 ID。
|
api-version
|
query |
True
|
string
|
要与客户端请求一起使用的 API 的版本。 当前版本为 2020-05-01。
|
$filter
|
query |
|
string
|
可用于筛选客户列表。
|
$search
|
query |
|
string
|
用于按客户名称搜索客户。 任何名称中包含搜索文本的客户都将包含在响应中
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 流。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
CustomersListByBillingProfile
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers?api-version=2020-05-01
/** Samples for Customers ListByBillingProfile. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomersListByBillingProfile.json
*/
/**
* Sample code: CustomersListByBillingProfile.
*
* @param manager Entry point to BillingManager.
*/
public static void customersListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.customers()
.listByBillingProfile(
"{billingAccountName}", "{billingProfileName}", null, null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.billing import BillingManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-billing
# USAGE
python customers_list_by_billing_profile.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BillingManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.customers.list_by_billing_profile(
billing_account_name="{billingAccountName}",
billing_profile_name="{billingProfileName}",
)
for item in response:
print(item)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomersListByBillingProfile.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbilling_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomersListByBillingProfile.json
func ExampleCustomersClient_NewListByBillingProfilePager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbilling.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewCustomersClient().NewListByBillingProfilePager("{billingAccountName}", "{billingProfileName}", &armbilling.CustomersClientListByBillingProfileOptions{Search: nil,
Filter: nil,
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.CustomerListResult = armbilling.CustomerListResult{
// Value: []*armbilling.Customer{
// {
// Name: to.Ptr("22000000-0000-0000-0000-000000000000"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/customers"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/22000000-0000-0000-0000-000000000000"),
// Properties: &armbilling.CustomerProperties{
// BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/11000000-0000-0000-0000-000000000000"),
// DisplayName: to.Ptr("customer1"),
// },
// },
// {
// Name: to.Ptr("22000000-0000-0000-0000-000000000011"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/customers"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/22000000-0000-0000-0000-000000000011"),
// Properties: &armbilling.CustomerProperties{
// BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/11000000-0000-0000-0000-000000000000"),
// DisplayName: to.Ptr("customer2"),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BillingManagementClient } = require("@azure/arm-billing");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @summary Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomersListByBillingProfile.json
*/
async function customersListByBillingProfile() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const billingProfileName = "{billingProfileName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.customers.listByBillingProfile(
billingAccountName,
billingProfileName
)) {
resArray.push(item);
}
console.log(resArray);
}
customersListByBillingProfile().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/22000000-0000-0000-0000-000000000000",
"name": "22000000-0000-0000-0000-000000000000",
"type": "Microsoft.Billing/billingAccounts/customers",
"properties": {
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/11000000-0000-0000-0000-000000000000",
"billingProfileDisplayName": "Contoso Operations Billing",
"displayName": "customer1"
}
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/22000000-0000-0000-0000-000000000011",
"name": "22000000-0000-0000-0000-000000000011",
"type": "Microsoft.Billing/billingAccounts/customers",
"properties": {
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/11000000-0000-0000-0000-000000000000",
"billingProfileDisplayName": "Contoso Operations Billing",
"displayName": "customer2"
}
}
]
}
定义
AzurePlan
Azure 计划的详细信息。
名称 |
类型 |
说明 |
skuDescription
|
string
|
SKU 说明。
|
skuId
|
string
|
SKU ID。
|
Customer
合作伙伴的客户。
名称 |
类型 |
说明 |
id
|
string
|
资源 ID。
|
name
|
string
|
资源名称。
|
properties.billingProfileDisplayName
|
string
|
发票科目的计费对象信息的名称。
|
properties.billingProfileId
|
string
|
发票科目的计费配置文件的 ID。
|
properties.displayName
|
string
|
客户的名称。
|
properties.enabledAzurePlans
|
AzurePlan[]
|
为客户启用的 Azure 计划。
|
properties.resellers
|
Reseller[]
|
为其为客户启用了 Azure 计划的经销商列表。
|
type
|
string
|
资源类型。
|
CustomerListResult
客户列表。
名称 |
类型 |
说明 |
nextLink
|
string
|
指向下一页结果的链接 (url) 。
|
totalCount
|
number
|
总记录数。
|
value
|
Customer[]
|
客户列表。
|
ErrorDetails
错误的详细信息。
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
details
|
ErrorSubDetails[]
|
错误的子详细信息。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|
ErrorResponse
错误响应指示服务无法处理传入请求。 错误消息中提供了原因。
ErrorSubDetails
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|
Reseller
经销商的详细信息。
名称 |
类型 |
说明 |
description
|
string
|
经销商的名称。
|
resellerId
|
string
|
经销商的 MPN ID。
|