Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}?api-version=2020-05-01
With optional parameters:
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}?api-version=2020-05-01&$expand={$expand}
URI Parameters
Name |
In |
Required |
Type |
Description |
billingAccountName
|
path |
True
|
string
|
The ID that uniquely identifies a billing account.
|
customerName
|
path |
True
|
string
|
The ID that uniquely identifies a customer.
|
api-version
|
query |
True
|
string
|
The version of the API to be used with the client request. The current version is 2020-05-01.
|
$expand
|
query |
|
string
|
May be used to expand enabledAzurePlans and resellers
|
Responses
Name |
Type |
Description |
200 OK
|
Customer
|
OK. The request has succeeded.
|
Other Status Codes
|
ErrorResponse
|
Error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
Customer
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}?api-version=2020-05-01
/** Samples for Customers Get. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Customer.json
*/
/**
* Sample code: Customer.
*
* @param manager Entry point to BillingManager.
*/
public static void customer(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.customers()
.getWithResponse("{billingAccountName}", "{customerName}", 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 customer.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.get(
billing_account_name="{billingAccountName}",
customer_name="{customerName}",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Customer.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/Customer.json
func ExampleCustomersClient_Get_customer() {
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)
}
res, err := clientFactory.NewCustomersClient().Get(ctx, "{billingAccountName}", "{customerName}", &armbilling.CustomersClientGetOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Customer = armbilling.Customer{
// Name: to.Ptr("{customerName}"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/customers"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}"),
// 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"),
// },
// }
}
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 Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @summary Gets a customer by its ID. 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/Customer.json
*/
async function customer() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const customerName = "{customerName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.customers.get(billingAccountName, customerName);
console.log(result);
}
customer().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
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}",
"name": "{customerName}",
"type": "Microsoft.Billing/billingAccounts/customers",
"properties": {
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/11000000-0000-0000-0000-000000000000",
"billingProfileDisplayName": "Contoso Operations Billing",
"displayName": "customer1"
}
}
CustomerWithExpand
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}?api-version=2020-05-01&$expand=enabledAzurePlans,resellers
/** Samples for Customers Get. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomerWithExpand.json
*/
/**
* Sample code: CustomerWithExpand.
*
* @param manager Entry point to BillingManager.
*/
public static void customerWithExpand(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.customers()
.getWithResponse(
"{billingAccountName}",
"{customerName}",
"enabledAzurePlans,resellers",
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 customer_with_expand.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.get(
billing_account_name="{billingAccountName}",
customer_name="{customerName}",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomerWithExpand.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/azcore/to"
"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/CustomerWithExpand.json
func ExampleCustomersClient_Get_customerWithExpand() {
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)
}
res, err := clientFactory.NewCustomersClient().Get(ctx, "{billingAccountName}", "{customerName}", &armbilling.CustomersClientGetOptions{Expand: to.Ptr("enabledAzurePlans,resellers")})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Customer = armbilling.Customer{
// Name: to.Ptr("{customerName}"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/customers"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}"),
// 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("customerName1"),
// EnabledAzurePlans: []*armbilling.AzurePlan{
// {
// SKUDescription: to.Ptr("Microsoft Azure Plan for DevTest"),
// SKUID: to.Ptr("0002"),
// }},
// Resellers: []*armbilling.Reseller{
// {
// Description: to.Ptr("Reseller1"),
// ResellerID: to.Ptr("89e87bdf-a2a2-4687-925f-4c18b27bccfd"),
// },
// {
// Description: to.Ptr("Reseller2"),
// ResellerID: to.Ptr("3b65b5a8-bd4f-4084-90e9-e1bd667a2b19"),
// }},
// },
// }
}
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 Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
*
* @summary Gets a customer by its ID. 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/CustomerWithExpand.json
*/
async function customerWithExpand() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const customerName = "{customerName}";
const expand = "enabledAzurePlans,resellers";
const options = { expand };
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.customers.get(billingAccountName, customerName, options);
console.log(result);
}
customerWithExpand().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
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}",
"name": "{customerName}",
"type": "Microsoft.Billing/billingAccounts/customers",
"properties": {
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/11000000-0000-0000-0000-000000000000",
"billingProfileDisplayName": "Contoso Operations Billing",
"displayName": "customerName1",
"enabledAzurePlans": [
{
"skuId": "0002",
"skuDescription": "Microsoft Azure Plan for DevTest"
}
],
"resellers": [
{
"resellerId": "89e87bdf-a2a2-4687-925f-4c18b27bccfd",
"description": "Reseller1"
},
{
"resellerId": "3b65b5a8-bd4f-4084-90e9-e1bd667a2b19",
"description": "Reseller2"
}
]
}
}
Definitions
AzurePlan
Details of the Azure plan.
Name |
Type |
Description |
skuDescription
|
string
|
The sku description.
|
skuId
|
string
|
The sku id.
|
Customer
A partner's customer.
Name |
Type |
Description |
id
|
string
|
Resource Id.
|
name
|
string
|
Resource name.
|
properties.billingProfileDisplayName
|
string
|
The name of the billing profile for the invoice section.
|
properties.billingProfileId
|
string
|
The ID of the billing profile for the invoice section.
|
properties.displayName
|
string
|
The name of the customer.
|
properties.enabledAzurePlans
|
AzurePlan[]
|
Azure plans enabled for the customer.
|
properties.resellers
|
Reseller[]
|
The list of resellers for which an Azure plan is enabled for the customer.
|
type
|
string
|
Resource type.
|
ErrorDetails
The details of the error.
Name |
Type |
Description |
code
|
string
|
Error code.
|
details
|
ErrorSubDetails[]
|
The sub details of the error.
|
message
|
string
|
Error message indicating why the operation failed.
|
target
|
string
|
The target of the particular error.
|
ErrorResponse
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.
Name |
Type |
Description |
error
|
ErrorDetails
|
The details of the error.
|
ErrorSubDetails
Name |
Type |
Description |
code
|
string
|
Error code.
|
message
|
string
|
Error message indicating why the operation failed.
|
target
|
string
|
The target of the particular error.
|
Reseller
Details of the reseller.
Name |
Type |
Description |
description
|
string
|
The name of the reseller.
|
resellerId
|
string
|
The MPN ID of the reseller.
|