Gets a billing account by its ID.
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}?api-version=2024-04-01
URI Parameters
Name |
In |
Required |
Type |
Description |
billingAccountName
|
path |
True
|
string
pattern: ^([0-9]+|([Pp][Cc][Nn]\.[A-Za-z0-9]+)|[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}(:[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}_[0-9]{4}(-[0-9]{2}){2})?)$
|
The ID that uniquely identifies a billing account.
|
api-version
|
query |
True
|
string
|
The version of the API to be used with the client request. The current version is 2024-04-01.
|
Responses
Name |
Type |
Description |
200 OK
|
BillingAccount
|
A billing account.
|
Other Status Codes
|
ErrorResponse
|
Error response describing why the operation failed.
|
Examples
BillingAccountsGet
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31?api-version=2024-04-01
/**
* Samples for BillingAccounts Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.json
*/
/**
* Sample code: BillingAccountsGet.
*
* @param manager Entry point to BillingManager.
*/
public static void billingAccountsGet(com.azure.resourcemanager.billing.BillingManager manager) {
manager.billingAccounts().getWithResponse(
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
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 billing_accounts_get.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.billing_accounts.get(
billing_account_name="10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.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/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.json
func ExampleAccountsClient_Get_billingAccountsGet() {
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.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", 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.Account = armbilling.Account{
// Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// SystemData: &armbilling.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()),
// },
// Properties: &armbilling.AccountProperties{
// AccountStatus: to.Ptr(armbilling.AccountStatusActive),
// AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise),
// AccountType: to.Ptr(armbilling.AccountTypeBusiness),
// AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement),
// DisplayName: to.Ptr("Premier Business Account"),
// HasReadAccess: to.Ptr(true),
// PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"),
// },
// }
}
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 billing account by its ID.
*
* @summary Gets a billing account by its ID.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.json
*/
async function billingAccountsGet() {
const billingAccountName =
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential);
const result = await client.billingAccounts.get(billingAccountName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Billing.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Billing;
// Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.json
// this example is just showing the usage of "BillingAccounts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this BillingAccountResource
BillingAccountCollection collection = tenantResource.GetBillingAccounts();
// invoke the operation
string billingAccountName = "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
NullableResponse<BillingAccountResource> response = await collection.GetIfExistsAsync(billingAccountName);
BillingAccountResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BillingAccountData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"name": "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"properties": {
"accountStatus": "Active",
"accountType": "Business",
"accountSubType": "Enterprise",
"agreementType": "MicrosoftCustomerAgreement",
"displayName": "Premier Business Account",
"hasReadAccess": true,
"primaryBillingTenantId": "20000000-0000-0000-0000-000000000001"
},
"type": "Microsoft.Billing/billingAccounts",
"systemData": {
"createdAt": "2023-01-04T22:39:34.2606750Z",
"lastModifiedAt": "2023-01-05T22:39:34.2606750Z"
}
}
BillingAccountsGetEA
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/6575495?api-version=2024-04-01
/**
* Samples for BillingAccounts Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.json
*/
/**
* Sample code: BillingAccountsGetEA.
*
* @param manager Entry point to BillingManager.
*/
public static void billingAccountsGetEA(com.azure.resourcemanager.billing.BillingManager manager) {
manager.billingAccounts().getWithResponse("6575495", 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 billing_accounts_get_ea.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.billing_accounts.get(
billing_account_name="6575495",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.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/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.json
func ExampleAccountsClient_Get_billingAccountsGetEa() {
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.NewAccountsClient().Get(ctx, "6575495", 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.Account = armbilling.Account{
// Name: to.Ptr("6575495"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6575495"),
// Properties: &armbilling.AccountProperties{
// AgreementType: to.Ptr(armbilling.AgreementTypeEnterpriseAgreement),
// EnrollmentDetails: &armbilling.AccountPropertiesEnrollmentDetails{
// BillingCycle: to.Ptr("Monthly"),
// Channel: to.Ptr("EaDirect"),
// Cloud: to.Ptr("Azure Commercial"),
// CountryCode: to.Ptr("US"),
// Currency: to.Ptr("USD"),
// EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()),
// ExtendedTermOption: to.Ptr(armbilling.ExtendedTermOptionOptedOut),
// IndirectRelationshipInfo: &armbilling.EnrollmentDetailsIndirectRelationshipInfo{
// BillingAccountName: to.Ptr("pcn.12345"),
// BillingProfileName: to.Ptr(""),
// DisplayName: to.Ptr("Test partner"),
// },
// InvoiceRecipient: to.Ptr("abc@contoso.com"),
// MarkupStatus: to.Ptr(armbilling.MarkupStatusPublished),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()),
// SupportCoverage: to.Ptr("1/26/2021 - 6/30/2021"),
// SupportLevel: to.Ptr(armbilling.SupportLevelStandard),
// Language: to.Ptr("en"),
// },
// SoldTo: &armbilling.AccountPropertiesSoldTo{
// AddressLine1: to.Ptr("Test Address"),
// AddressLine2: to.Ptr("Test Address"),
// AddressLine3: to.Ptr("Test Address"),
// City: to.Ptr("City"),
// Country: to.Ptr("US"),
// PostalCode: to.Ptr("00000"),
// Region: to.Ptr("WA"),
// },
// },
// }
}
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 billing account by its ID.
*
* @summary Gets a billing account by its ID.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.json
*/
async function billingAccountsGetEa() {
const billingAccountName = "6575495";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential);
const result = await client.billingAccounts.get(billingAccountName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Billing.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Billing;
// Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.json
// this example is just showing the usage of "BillingAccounts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this BillingAccountResource
BillingAccountCollection collection = tenantResource.GetBillingAccounts();
// invoke the operation
string billingAccountName = "6575495";
NullableResponse<BillingAccountResource> response = await collection.GetIfExistsAsync(billingAccountName);
BillingAccountResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BillingAccountData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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/6575495",
"name": "6575495",
"properties": {
"agreementType": "EnterpriseAgreement",
"enrollmentDetails": {
"startDate": "2018-05-01T17:32:28Z",
"endDate": "2019-05-31T17:32:28Z",
"currency": "USD",
"channel": "EaDirect",
"language": "en",
"countryCode": "US",
"billingCycle": "Monthly",
"extendedTermOption": "Opted-Out",
"supportLevel": "Standard",
"supportCoverage": "1/26/2021 - 6/30/2021",
"cloud": "Azure Commercial",
"markupStatus": "Published",
"indirectRelationshipInfo": {
"billingAccountName": "pcn.12345",
"billingProfileName": "",
"displayName": "Test partner"
},
"invoiceRecipient": "abc@contoso.com"
},
"soldTo": {
"addressLine1": "Test Address",
"addressLine2": "Test Address",
"addressLine3": "Test Address",
"city": "City",
"country": "US",
"postalCode": "00000",
"region": "WA"
}
},
"type": "Microsoft.Billing/billingAccounts"
}
BillingAccountsGetWithExpand
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31?api-version=2024-04-01
/**
* Samples for BillingAccounts Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand.
* json
*/
/**
* Sample code: BillingAccountsGetWithExpand.
*
* @param manager Entry point to BillingManager.
*/
public static void billingAccountsGetWithExpand(com.azure.resourcemanager.billing.BillingManager manager) {
manager.billingAccounts().getWithResponse(
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
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 billing_accounts_get_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.billing_accounts.get(
billing_account_name="10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand.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/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand.json
func ExampleAccountsClient_Get_billingAccountsGetWithExpand() {
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.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", 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.Account = armbilling.Account{
// Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// SystemData: &armbilling.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()),
// },
// Properties: &armbilling.AccountProperties{
// AccountStatus: to.Ptr(armbilling.AccountStatusActive),
// AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise),
// AccountType: to.Ptr(armbilling.AccountTypeBusiness),
// AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement),
// DisplayName: to.Ptr("Premier Business Account"),
// HasReadAccess: to.Ptr(true),
// PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"),
// SoldTo: &armbilling.AccountPropertiesSoldTo{
// AddressLine1: to.Ptr("1 Microsoft Way"),
// City: to.Ptr("Redmond"),
// CompanyName: to.Ptr("Contoso"),
// Country: to.Ptr("US"),
// IsValidAddress: to.Ptr(true),
// PostalCode: to.Ptr("98052-8300"),
// Region: to.Ptr("WA"),
// },
// },
// }
}
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 billing account by its ID.
*
* @summary Gets a billing account by its ID.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand.json
*/
async function billingAccountsGetWithExpand() {
const billingAccountName =
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential);
const result = await client.billingAccounts.get(billingAccountName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Billing.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Billing;
// Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand.json
// this example is just showing the usage of "BillingAccounts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this BillingAccountResource
BillingAccountCollection collection = tenantResource.GetBillingAccounts();
// invoke the operation
string billingAccountName = "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
NullableResponse<BillingAccountResource> response = await collection.GetIfExistsAsync(billingAccountName);
BillingAccountResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BillingAccountData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"name": "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"properties": {
"accountStatus": "Active",
"accountType": "Business",
"accountSubType": "Enterprise",
"agreementType": "MicrosoftCustomerAgreement",
"displayName": "Premier Business Account",
"hasReadAccess": true,
"primaryBillingTenantId": "20000000-0000-0000-0000-000000000001",
"soldTo": {
"addressLine1": "1 Microsoft Way",
"city": "Redmond",
"companyName": "Contoso",
"country": "US",
"postalCode": "98052-8300",
"region": "WA",
"isValidAddress": true
}
},
"type": "Microsoft.Billing/billingAccounts",
"systemData": {
"createdAt": "2023-01-04T22:39:34.2606750Z",
"lastModifiedAt": "2023-01-05T22:39:34.2606750Z"
}
}
BillingAccountWithExpandForPONumber
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/8608480?api-version=2024-04-01
/**
* Samples for BillingAccounts Get.
*/
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/
* billingAccountWithExpandForPONumber.json
*/
/**
* Sample code: BillingAccountWithExpandForPONumber.
*
* @param manager Entry point to BillingManager.
*/
public static void billingAccountWithExpandForPONumber(com.azure.resourcemanager.billing.BillingManager manager) {
manager.billingAccounts().getWithResponse("8608480", 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 billing_account_with_expand_for_po_number.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.billing_accounts.get(
billing_account_name="8608480",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithExpandForPONumber.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/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithExpandForPONumber.json
func ExampleAccountsClient_Get_billingAccountWithExpandForPoNumber() {
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.NewAccountsClient().Get(ctx, "8608480", 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.Account = armbilling.Account{
// Name: to.Ptr("6564892"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892"),
// SystemData: &armbilling.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()),
// },
// Properties: &armbilling.AccountProperties{
// AccountStatus: to.Ptr(armbilling.AccountStatusActive),
// AccountType: to.Ptr(armbilling.AccountTypeEnterprise),
// AgreementType: to.Ptr(armbilling.AgreementTypeEnterpriseAgreement),
// DisplayName: to.Ptr("Enterprise Account"),
// EnrollmentDetails: &armbilling.AccountPropertiesEnrollmentDetails{
// BillingCycle: to.Ptr("Monthly"),
// Channel: to.Ptr("EaDirect"),
// Cloud: to.Ptr("Azure Commercial"),
// CountryCode: to.Ptr("US"),
// Currency: to.Ptr("USD"),
// EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()),
// ExtendedTermOption: to.Ptr(armbilling.ExtendedTermOptionOptedOut),
// PoNumber: to.Ptr("poNumber123"),
// StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()),
// SupportCoverage: to.Ptr("1/26/2021 - 6/30/2021"),
// SupportLevel: to.Ptr(armbilling.SupportLevelStandard),
// Language: to.Ptr("en"),
// },
// HasReadAccess: to.Ptr(true),
// },
// }
}
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 billing account by its ID.
*
* @summary Gets a billing account by its ID.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithExpandForPONumber.json
*/
async function billingAccountWithExpandForPoNumber() {
const billingAccountName = "8608480";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential);
const result = await client.billingAccounts.get(billingAccountName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Billing.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Billing;
// Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithExpandForPONumber.json
// this example is just showing the usage of "BillingAccounts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this BillingAccountResource
BillingAccountCollection collection = tenantResource.GetBillingAccounts();
// invoke the operation
string billingAccountName = "8608480";
NullableResponse<BillingAccountResource> response = await collection.GetIfExistsAsync(billingAccountName);
BillingAccountResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BillingAccountData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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/6564892",
"name": "6564892",
"properties": {
"accountStatus": "Active",
"accountType": "Enterprise",
"agreementType": "EnterpriseAgreement",
"displayName": "Enterprise Account",
"enrollmentDetails": {
"startDate": "2018-05-01T17:32:28Z",
"endDate": "2019-05-31T17:32:28Z",
"currency": "USD",
"channel": "EaDirect",
"language": "en",
"countryCode": "US",
"billingCycle": "Monthly",
"extendedTermOption": "Opted-Out",
"supportLevel": "Standard",
"supportCoverage": "1/26/2021 - 6/30/2021",
"cloud": "Azure Commercial",
"poNumber": "poNumber123"
},
"hasReadAccess": true
},
"type": "Microsoft.Billing/billingAccounts",
"systemData": {
"createdAt": "2023-01-04T22:39:34.2606750Z",
"lastModifiedAt": "2023-01-05T22:39:34.2606750Z"
}
}
BillingAccountWithRegistrationNumberWithDefaultType
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31?api-version=2024-04-01
/**
* Samples for BillingAccounts Get.
*/
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/
* billingAccountWithRegistrationNumberWithDefaultType.json
*/
/**
* Sample code: BillingAccountWithRegistrationNumberWithDefaultType.
*
* @param manager Entry point to BillingManager.
*/
public static void
billingAccountWithRegistrationNumberWithDefaultType(com.azure.resourcemanager.billing.BillingManager manager) {
manager.billingAccounts().getWithResponse(
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
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 billing_account_with_registration_number_with_default_type.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.billing_accounts.get(
billing_account_name="10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithDefaultType.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/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithDefaultType.json
func ExampleAccountsClient_Get_billingAccountWithRegistrationNumberWithDefaultType() {
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.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", 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.Account = armbilling.Account{
// Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// SystemData: &armbilling.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()),
// },
// Properties: &armbilling.AccountProperties{
// AccountStatus: to.Ptr(armbilling.AccountStatusActive),
// AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise),
// AccountType: to.Ptr(armbilling.AccountTypeBusiness),
// AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement),
// DisplayName: to.Ptr("Premier Business Account"),
// HasReadAccess: to.Ptr(true),
// PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"),
// RegistrationNumber: &armbilling.AccountPropertiesRegistrationNumber{
// Type: []*string{
// to.Ptr("RegistrationNumber")},
// ID: to.Ptr("RegistrationId"),
// },
// },
// }
}
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 billing account by its ID.
*
* @summary Gets a billing account by its ID.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithDefaultType.json
*/
async function billingAccountWithRegistrationNumberWithDefaultType() {
const billingAccountName =
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential);
const result = await client.billingAccounts.get(billingAccountName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Billing.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Billing;
// Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithDefaultType.json
// this example is just showing the usage of "BillingAccounts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this BillingAccountResource
BillingAccountCollection collection = tenantResource.GetBillingAccounts();
// invoke the operation
string billingAccountName = "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
NullableResponse<BillingAccountResource> response = await collection.GetIfExistsAsync(billingAccountName);
BillingAccountResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BillingAccountData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"name": "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"properties": {
"accountStatus": "Active",
"accountType": "Business",
"accountSubType": "Enterprise",
"agreementType": "MicrosoftCustomerAgreement",
"displayName": "Premier Business Account",
"hasReadAccess": true,
"primaryBillingTenantId": "20000000-0000-0000-0000-000000000001",
"registrationNumber": {
"id": "RegistrationId",
"type": [
"RegistrationNumber"
]
}
},
"type": "Microsoft.Billing/billingAccounts",
"systemData": {
"createdAt": "2023-01-04T22:39:34.2606750Z",
"lastModifiedAt": "2023-01-05T22:39:34.2606750Z"
}
}
BillingAccountWithRegistrationNumberWithType
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31?api-version=2024-04-01
/**
* Samples for BillingAccounts Get.
*/
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/
* billingAccountWithRegistrationNumberWithType.json
*/
/**
* Sample code: BillingAccountWithRegistrationNumberWithType.
*
* @param manager Entry point to BillingManager.
*/
public static void
billingAccountWithRegistrationNumberWithType(com.azure.resourcemanager.billing.BillingManager manager) {
manager.billingAccounts().getWithResponse(
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
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 billing_account_with_registration_number_with_type.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.billing_accounts.get(
billing_account_name="10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithType.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/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithType.json
func ExampleAccountsClient_Get_billingAccountWithRegistrationNumberWithType() {
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.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", 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.Account = armbilling.Account{
// Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"),
// SystemData: &armbilling.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()),
// },
// Properties: &armbilling.AccountProperties{
// AccountStatus: to.Ptr(armbilling.AccountStatusActive),
// AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise),
// AccountType: to.Ptr(armbilling.AccountTypeBusiness),
// AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement),
// DisplayName: to.Ptr("Premier Business Account"),
// HasReadAccess: to.Ptr(true),
// PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"),
// RegistrationNumber: &armbilling.AccountPropertiesRegistrationNumber{
// Type: []*string{
// to.Ptr("TIN")},
// ID: to.Ptr("SomeRegistrationId"),
// Required: to.Ptr(true),
// },
// },
// }
}
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 billing account by its ID.
*
* @summary Gets a billing account by its ID.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithType.json
*/
async function billingAccountWithRegistrationNumberWithType() {
const billingAccountName =
"10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential);
const result = await client.billingAccounts.get(billingAccountName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Billing.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Billing;
// Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithType.json
// this example is just showing the usage of "BillingAccounts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
// get the collection of this BillingAccountResource
BillingAccountCollection collection = tenantResource.GetBillingAccounts();
// invoke the operation
string billingAccountName = "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31";
NullableResponse<BillingAccountResource> response = await collection.GetIfExistsAsync(billingAccountName);
BillingAccountResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BillingAccountData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
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/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"name": "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31",
"properties": {
"accountStatus": "Active",
"accountType": "Business",
"accountSubType": "Enterprise",
"agreementType": "MicrosoftCustomerAgreement",
"displayName": "Premier Business Account",
"hasReadAccess": true,
"primaryBillingTenantId": "20000000-0000-0000-0000-000000000001",
"registrationNumber": {
"id": "SomeRegistrationId",
"required": true,
"type": [
"TIN"
]
}
},
"type": "Microsoft.Billing/billingAccounts",
"systemData": {
"createdAt": "2023-01-04T22:39:34.2606750Z",
"lastModifiedAt": "2023-01-05T22:39:34.2606750Z"
}
}
Definitions
AccountStatus
Enumeration
The current status of the billing account.
Value |
Description |
Other
|
|
Active
|
|
UnderReview
|
|
Disabled
|
|
Deleted
|
|
Extended
|
|
Pending
|
|
New
|
|
Expired
|
|
Terminated
|
|
Transferred
|
|
AccountSubType
Enumeration
The tier of the account.
Value |
Description |
Other
|
|
None
|
|
Individual
|
|
Professional
|
|
Enterprise
|
|
AccountType
Enumeration
The type of customer.
Value |
Description |
Other
|
|
Enterprise
|
|
Individual
|
|
Partner
|
|
Reseller
|
|
ClassicPartner
|
|
Internal
|
|
Tenant
|
|
Business
|
|
AgreementType
Enumeration
The type of agreement.
Value |
Description |
Other
|
|
MicrosoftCustomerAgreement
|
|
EnterpriseAgreement
|
|
MicrosoftOnlineServicesProgram
|
|
MicrosoftPartnerAgreement
|
|
BillingAccount
Object
A billing account.
Name |
Type |
Description |
id
|
string
(arm-id)
|
Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
name
|
string
|
The name of the resource
|
properties
|
BillingAccountProperties
|
A billing account.
|
systemData
|
systemData
|
Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
tags
|
object
|
Dictionary of metadata associated with the resource. It may not be populated for all resource types. Maximum key/value length supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
BillingAccountProperties
Object
A billing account.
Name |
Type |
Description |
accountStatus
|
AccountStatus
|
The current status of the billing account.
|
accountStatusReasonCode
|
BillingAccountStatusReasonCode
|
Reason for the specified billing account status.
|
accountSubType
|
AccountSubType
|
The tier of the account.
|
accountType
|
AccountType
|
The type of customer.
|
agreementType
|
AgreementType
|
The type of agreement.
|
billingRelationshipTypes
|
BillingRelationshipType[]
|
Identifies the billing relationships represented by a billing account. The billing relationship may be between Microsoft, the customer, and/or a third-party.
|
displayName
|
string
|
The billing account name.
|
enrollmentDetails
|
EnrollmentDetails
|
The properties of an enrollment.
|
hasNoBillingProfiles
|
boolean
|
Indicates whether or not the billing account has any billing profiles.
|
hasReadAccess
|
boolean
|
Indicates whether user has read access to the billing account.
|
notificationEmailAddress
|
string
|
Notification email address for legacy account. Available for agreement type Microsoft Online Services Program.
|
primaryBillingTenantId
|
string
|
The tenant that was used to set up the billing account. By default, only users from this tenant can get role assignments on the billing account and all purchases are provisioned in this tenant.
|
provisioningState
|
ProvisioningState
|
The provisioning state of the resource during a long-running operation.
|
qualifications
|
string[]
|
Qualifications for pricing on a billing account. Values may be Commercial, Education, Charity or Government.
|
registrationNumber
|
RegistrationNumber
|
Describes the registration number of the organization linked with the billing account.
|
soldTo
|
SoldTo
|
The address of the individual or organization that is responsible for the billing account.
|
taxIds
|
TaxIdentifier[]
|
A list of tax identifiers for the billing account.
|
BillingAccountStatusReasonCode
Enumeration
Reason for the specified billing account status.
Value |
Description |
Other
|
|
UnusualActivity
|
|
ManuallyTerminated
|
|
Expired
|
|
Transferred
|
|
TerminateProcessing
|
|
BillingRelationshipType
Enumeration
Identifies the billing relationships represented by a billing account. The billing relationship may be between Microsoft, the customer, and/or a third-party.
Value |
Description |
Other
|
|
Direct
|
|
IndirectCustomer
|
|
IndirectPartner
|
|
CSPPartner
|
|
CSPCustomer
|
|
createdByType
Enumeration
The type of identity that created the resource.
Value |
Description |
User
|
|
Application
|
|
ManagedIdentity
|
|
Key
|
|
EnrollmentDetails
Object
The properties of an enrollment.
Name |
Type |
Description |
billingCycle
|
string
|
The billing cycle for the enrollment.
|
channel
|
string
|
The channel type of the enrollment.
|
cloud
|
string
|
The cloud of the enrollment.
|
countryCode
|
string
|
The country code of the enrollment.
|
currency
|
string
|
The billing currency for the enrollment.
|
endDate
|
string
(date-time)
|
The end date of the enrollment.
|
extendedTermOption
|
ExtendedTermOption
|
The billing account extension opted by the company.
|
indirectRelationshipInfo
|
IndirectRelationshipInfo
|
The properties of an enrollment which are applicable only for indirect enrollments.
|
invoiceRecipient
|
string
|
The contact who receives invoices of the enrollment.
|
language
|
string
|
The language for the enrollment.
|
markupStatus
|
MarkupStatus
|
Markup status of enrollment, applicable only for indirect enrollments.
|
poNumber
|
string
|
The purchase order number of the enrollment.
|
startDate
|
string
(date-time)
|
The start date of the enrollment.
|
supportCoverage
|
string
|
The support coverage period for the enrollment.
|
supportLevel
|
SupportLevel
|
The support level offer associated with an enrollment.
|
ErrorAdditionalInfo
Object
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
Object
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Object
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
ExtendedTermOption
Enumeration
The billing account extension opted by the company.
Value |
Description |
Other
|
|
Opted-In
|
|
Opted-Out
|
|
IndirectRelationshipInfo
Object
Identifies the billing profile that is linked to another billing profile in indirect purchase motion.
Name |
Type |
Description |
billingAccountName
|
string
|
The billing account name of the partner or the customer for an indirect motion.
|
billingProfileName
|
string
|
The billing profile name of the partner or the customer for an indirect motion.
|
displayName
|
string
|
The display name of the partner or customer for an indirect motion.
|
MarkupStatus
Enumeration
Markup status of enrollment, applicable only for indirect enrollments.
Value |
Description |
Other
|
|
Disabled
|
|
Preview
|
|
Published
|
|
Locked
|
|
ProvisioningState
Enumeration
The provisioning state of the resource during a long-running operation.
Value |
Description |
Succeeded
|
|
Canceled
|
|
Failed
|
|
New
|
|
Pending
|
|
Provisioning
|
|
RegistrationNumber
Object
Describes the registration number of the organization linked with the billing account.
Name |
Type |
Description |
id
|
string
|
The unique identification number of the organization linked with the billing account.
|
required
|
boolean
|
Identifies if the registration number is required for the billing account.
|
type
|
string[]
|
The types of registration number allowed based on the country of the billing account.
|
SoldTo
Object
The address of the individual or organization that is responsible for the billing account.
Name |
Type |
Description |
addressLine1
|
string
minLength: 1
|
Address line 1.
|
addressLine2
|
string
|
Address line 2.
|
addressLine3
|
string
|
Address line 3.
|
city
|
string
|
Address city.
|
companyName
|
string
|
Company name. Optional for MCA Individual (Pay-as-you-go).
|
country
|
string
minLength: 1
|
Country code uses ISO 3166-1 Alpha-2 format.
|
district
|
string
|
Address district.
|
email
|
string
|
Email address.
|
firstName
|
string
|
First name. Optional for MCA Enterprise.
|
isValidAddress
|
boolean
|
Indicates if the address is incomplete.
|
lastName
|
string
|
Last name. Optional for MCA Enterprise.
|
middleName
|
string
|
Middle name.
|
phoneNumber
|
string
|
Phone number.
|
postalCode
|
string
|
Postal code.
|
region
|
string
|
Address region.
|
SupportLevel
Enumeration
The support level offer associated with an enrollment.
Value |
Description |
Other
|
|
Standard
|
|
Pro-Direct
|
|
Developer
|
|
systemData
Object
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
(date-time)
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
(date-time)
|
The timestamp of resource last modification (UTC)
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|
TaxIdentifier
Object
A tax identifier for the billing account.
Name |
Type |
Description |
country
|
string
|
The country of the tax identifier.
|
id
|
string
|
The id of the tax identifier.
|
scope
|
string
|
The scope of the tax identifier.
|
status
|
TaxIdentifierStatus
|
The status of the tax identifier.
|
type
|
TaxIdentifierType
|
The type of the tax identifier.
|
TaxIdentifierStatus
Enumeration
The status of the tax identifier.
Value |
Description |
Other
|
|
Valid
|
|
Invalid
|
|
TaxIdentifierType
Enumeration
The type of the tax identifier.
Value |
Description |
Other
|
|
BrazilCcmId
|
|
BrazilCnpjId
|
|
BrazilCpfId
|
|
CanadianFederalExempt
|
|
CanadianProvinceExempt
|
|
ExternalTaxation
|
|
IndiaFederalTanId
|
|
IndiaFederalServiceTaxId
|
|
IndiaPanId
|
|
IndiaStateCstId
|
|
IndiaStateGstINId
|
|
IndiaStateVatId
|
|
IntlExempt
|
|
USExempt
|
|
VatId
|
|
LoveCode
|
|
MobileBarCode
|
|
NationalIdentificationNumber
|
|
PublicSectorId
|
|