Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}?api-version=2020-05-01
URI Parameters
Name |
In |
Required |
Type |
Description |
billingAccountName
|
path |
True
|
string
|
The ID that uniquely identifies a billing account.
|
invoiceName
|
path |
True
|
string
|
The ID that uniquely identifies an invoice.
|
api-version
|
query |
True
|
string
|
The version of the API to be used with the client request. The current version is 2020-05-01.
|
Responses
Name |
Type |
Description |
200 OK
|
Invoice
|
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
CreditNote
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}?api-version=2020-05-01
/** Samples for Invoices Get. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CreditNote.json
*/
/**
* Sample code: CreditNote.
*
* @param manager Entry point to BillingManager.
*/
public static void creditNote(com.azure.resourcemanager.billing.BillingManager manager) {
manager.invoices().getWithResponse("{billingAccountName}", "{invoiceName}", 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 credit_note.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.invoices.get(
billing_account_name="{billingAccountName}",
invoice_name="{invoiceName}",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CreditNote.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/CreditNote.json
func ExampleInvoicesClient_Get_creditNote() {
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.NewInvoicesClient().Get(ctx, "{billingAccountName}", "{invoiceName}", 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.Invoice = armbilling.Invoice{
// Name: to.Ptr("{invoiceName}"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"),
// Properties: &armbilling.InvoiceProperties{
// AmountDue: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// AzurePrepaymentApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](15.46),
// },
// BilledAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"),
// CreditAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// CreditForDocumentID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/I000001"),
// DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeCreditNote),
// Documents: []*armbilling.Document{
// {
// Kind: to.Ptr(armbilling.DocumentTypeInvoice),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/invoice.pdf"),
// },
// {
// Kind: to.Ptr(armbilling.DocumentTypeTaxReceipt),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/taxDoc.pdf"),
// }},
// DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-16T17:32:28.000Z"); return t}()),
// FreeAzureCreditApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-15T17:32:28.000Z"); return t}()),
// InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// IsMonthlyInvoice: to.Ptr(false),
// Payments: []*armbilling.PaymentProperties{
// {
// Amount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-14T17:32:28.000Z"); return t}()),
// PaymentMethodFamily: to.Ptr(armbilling.PaymentMethodFamilyCreditCard),
// PaymentMethodType: to.Ptr("visa"),
// PaymentType: to.Ptr("credited"),
// }},
// PurchaseOrderNumber: to.Ptr("123456"),
// Status: to.Ptr(armbilling.InvoiceStatusPaid),
// SubTotal: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// TaxAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// TotalAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// },
// }
}
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 an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
*
* @summary Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CreditNote.json
*/
async function creditNote() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const invoiceName = "{invoiceName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.invoices.get(billingAccountName, invoiceName);
console.log(result);
}
creditNote().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}/invoices/{invoiceName}",
"name": "{invoiceName}",
"type": "Microsoft.Billing/billingAccounts/invoices",
"properties": {
"dueDate": "2018-01-16T17:32:28Z",
"invoiceDate": "2018-01-01T17:32:28Z",
"status": "Paid",
"amountDue": {
"currency": "USD",
"value": 16.53
},
"billedAmount": {
"currency": "USD",
"value": 33.99
},
"azurePrepaymentApplied": {
"currency": "USD",
"value": 15.46
},
"creditAmount": {
"currency": "USD",
"value": 2
},
"freeAzureCreditApplied": {
"currency": "USD",
"value": 0
},
"subTotal": {
"currency": "USD",
"value": 33.99
},
"taxAmount": {
"currency": "USD",
"value": 0
},
"totalAmount": {
"currency": "USD",
"value": 16.53
},
"invoicePeriodStartDate": "2018-01-01T17:32:28Z",
"invoicePeriodEndDate": "2018-01-15T17:32:28Z",
"isMonthlyInvoice": false,
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}",
"billingProfileDisplayName": "Contoso Operations Billing",
"purchaseOrderNumber": "123456",
"documentType": "CreditNote",
"creditForDocumentId": "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/I000001",
"documents": [
{
"kind": "Invoice",
"url": "https://microsoft.com/invoice.pdf",
"source": "DRS"
},
{
"kind": "TaxReceipt",
"url": "https://microsoft.com/taxDoc.pdf",
"source": "DRS"
}
],
"payments": [
{
"date": "2018-01-14T17:32:28Z",
"paymentType": "credited",
"amount": {
"currency": "USD",
"value": 2
},
"paymentMethodFamily": "CreditCard",
"paymentMethodType": "visa"
}
]
}
}
Invoice
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}?api-version=2020-05-01
/** Samples for Invoices Get. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Invoice.json
*/
/**
* Sample code: Invoice.
*
* @param manager Entry point to BillingManager.
*/
public static void invoice(com.azure.resourcemanager.billing.BillingManager manager) {
manager.invoices().getWithResponse("{billingAccountName}", "{invoiceName}", 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 invoice.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.invoices.get(
billing_account_name="{billingAccountName}",
invoice_name="{invoiceName}",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Invoice.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/Invoice.json
func ExampleInvoicesClient_Get_invoice() {
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.NewInvoicesClient().Get(ctx, "{billingAccountName}", "{invoiceName}", 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.Invoice = armbilling.Invoice{
// Name: to.Ptr("{invoiceName}"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"),
// Properties: &armbilling.InvoiceProperties{
// AmountDue: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// AzurePrepaymentApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](15.46),
// },
// BilledAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"),
// CreditAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice),
// Documents: []*armbilling.Document{
// {
// Kind: to.Ptr(armbilling.DocumentTypeInvoice),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/invoice.pdf"),
// },
// {
// Kind: to.Ptr(armbilling.DocumentTypeTaxReceipt),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/taxDoc.pdf"),
// }},
// DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-16T17:32:28.000Z"); return t}()),
// FreeAzureCreditApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-15T17:32:28.000Z"); return t}()),
// InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// IsMonthlyInvoice: to.Ptr(false),
// Payments: []*armbilling.PaymentProperties{
// {
// Amount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-14T17:32:28.000Z"); return t}()),
// PaymentMethodFamily: to.Ptr(armbilling.PaymentMethodFamilyCreditCard),
// PaymentMethodType: to.Ptr("visa"),
// PaymentType: to.Ptr("credited"),
// }},
// PurchaseOrderNumber: to.Ptr("123456"),
// Status: to.Ptr(armbilling.InvoiceStatusDue),
// SubTotal: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// TaxAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// TotalAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// },
// }
}
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 an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
*
* @summary Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Invoice.json
*/
async function invoice() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const invoiceName = "{invoiceName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.invoices.get(billingAccountName, invoiceName);
console.log(result);
}
invoice().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}/invoices/{invoiceName}",
"name": "{invoiceName}",
"type": "Microsoft.Billing/billingAccounts/invoices",
"properties": {
"dueDate": "2018-01-16T17:32:28Z",
"invoiceDate": "2018-01-01T17:32:28Z",
"status": "Due",
"amountDue": {
"currency": "USD",
"value": 16.53
},
"billedAmount": {
"currency": "USD",
"value": 33.99
},
"azurePrepaymentApplied": {
"currency": "USD",
"value": 15.46
},
"creditAmount": {
"currency": "USD",
"value": 2
},
"freeAzureCreditApplied": {
"currency": "USD",
"value": 0
},
"subTotal": {
"currency": "USD",
"value": 33.99
},
"taxAmount": {
"currency": "USD",
"value": 0
},
"totalAmount": {
"currency": "USD",
"value": 16.53
},
"invoicePeriodStartDate": "2018-01-01T17:32:28Z",
"invoicePeriodEndDate": "2018-01-15T17:32:28Z",
"isMonthlyInvoice": false,
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}",
"billingProfileDisplayName": "Contoso Operations Billing",
"purchaseOrderNumber": "123456",
"documentType": "Invoice",
"documents": [
{
"kind": "Invoice",
"url": "https://microsoft.com/invoice.pdf",
"source": "DRS"
},
{
"kind": "TaxReceipt",
"url": "https://microsoft.com/taxDoc.pdf",
"source": "DRS"
}
],
"payments": [
{
"date": "2018-01-14T17:32:28Z",
"paymentType": "credited",
"amount": {
"currency": "USD",
"value": 2
},
"paymentMethodFamily": "CreditCard",
"paymentMethodType": "visa"
}
]
}
}
InvoiceWithRebillDetails
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}?api-version=2020-05-01
/** Samples for Invoices Get. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceWithRebillDetails.json
*/
/**
* Sample code: InvoiceWithRebillDetails.
*
* @param manager Entry point to BillingManager.
*/
public static void invoiceWithRebillDetails(com.azure.resourcemanager.billing.BillingManager manager) {
manager.invoices().getWithResponse("{billingAccountName}", "{invoiceName}", 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 invoice_with_rebill_details.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.invoices.get(
billing_account_name="{billingAccountName}",
invoice_name="{invoiceName}",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceWithRebillDetails.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/InvoiceWithRebillDetails.json
func ExampleInvoicesClient_Get_invoiceWithRebillDetails() {
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.NewInvoicesClient().Get(ctx, "{billingAccountName}", "{invoiceName}", 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.Invoice = armbilling.Invoice{
// Name: to.Ptr("{invoiceName}"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"),
// Properties: &armbilling.InvoiceProperties{
// AmountDue: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// AzurePrepaymentApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](15.46),
// },
// BilledAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"),
// CreditAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice),
// Documents: []*armbilling.Document{
// {
// Kind: to.Ptr(armbilling.DocumentTypeInvoice),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/invoice.pdf"),
// },
// {
// Kind: to.Ptr(armbilling.DocumentTypeTaxReceipt),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/taxDoc.pdf"),
// }},
// DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-16T17:32:28.000Z"); return t}()),
// FreeAzureCreditApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-15T17:32:28.000Z"); return t}()),
// InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// IsMonthlyInvoice: to.Ptr(false),
// Payments: []*armbilling.PaymentProperties{
// {
// Amount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-14T17:32:28.000Z"); return t}()),
// PaymentMethodFamily: to.Ptr(armbilling.PaymentMethodFamilyCreditCard),
// PaymentMethodType: to.Ptr("visa"),
// PaymentType: to.Ptr("credited"),
// }},
// PurchaseOrderNumber: to.Ptr("123456"),
// RebillDetails: map[string]*armbilling.RebillDetails{
// "creditNoteDocumentId": &armbilling.RebillDetails{
// },
// "invoiceDocumentId": &armbilling.RebillDetails{
// },
// "rebillDetails": &armbilling.RebillDetails{
// },
// },
// Status: to.Ptr(armbilling.InvoiceStatusDue),
// SubTotal: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// TaxAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// TotalAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// },
// }
}
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 an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
*
* @summary Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceWithRebillDetails.json
*/
async function invoiceWithRebillDetails() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const invoiceName = "{invoiceName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.invoices.get(billingAccountName, invoiceName);
console.log(result);
}
invoiceWithRebillDetails().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}/invoices/{invoiceName}",
"name": "{invoiceName}",
"type": "Microsoft.Billing/billingAccounts/invoices",
"properties": {
"dueDate": "2018-01-16T17:32:28Z",
"invoiceDate": "2018-01-01T17:32:28Z",
"status": "Due",
"amountDue": {
"currency": "USD",
"value": 16.53
},
"billedAmount": {
"currency": "USD",
"value": 33.99
},
"azurePrepaymentApplied": {
"currency": "USD",
"value": 15.46
},
"creditAmount": {
"currency": "USD",
"value": 2
},
"freeAzureCreditApplied": {
"currency": "USD",
"value": 0
},
"subTotal": {
"currency": "USD",
"value": 33.99
},
"taxAmount": {
"currency": "USD",
"value": 0
},
"totalAmount": {
"currency": "USD",
"value": 16.53
},
"invoicePeriodStartDate": "2018-01-01T17:32:28Z",
"invoicePeriodEndDate": "2018-01-15T17:32:28Z",
"isMonthlyInvoice": false,
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}",
"billingProfileDisplayName": "Contoso Operations Billing",
"purchaseOrderNumber": "123456",
"documentType": "Invoice",
"documents": [
{
"kind": "Invoice",
"url": "https://microsoft.com/invoice.pdf",
"source": "DRS"
},
{
"kind": "TaxReceipt",
"url": "https://microsoft.com/taxDoc.pdf",
"source": "DRS"
}
],
"payments": [
{
"date": "2018-01-14T17:32:28Z",
"paymentType": "credited",
"amount": {
"currency": "USD",
"value": 2
},
"paymentMethodFamily": "CreditCard",
"paymentMethodType": "visa"
}
],
"rebillDetails": {
"creditNoteDocumentId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/CreditNote2",
"invoiceDocumentId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/I000002",
"rebillDetails": {
"creditNoteDocumentId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/CreditNote1",
"invoiceDocumentId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/I000001",
"rebillDetails": null
}
}
}
}
VoidInvoice
Sample request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}?api-version=2020-05-01
/** Samples for Invoices Get. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/VoidInvoice.json
*/
/**
* Sample code: VoidInvoice.
*
* @param manager Entry point to BillingManager.
*/
public static void voidInvoice(com.azure.resourcemanager.billing.BillingManager manager) {
manager.invoices().getWithResponse("{billingAccountName}", "{invoiceName}", 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 void_invoice.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.invoices.get(
billing_account_name="{billingAccountName}",
invoice_name="{invoiceName}",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/VoidInvoice.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/VoidInvoice.json
func ExampleInvoicesClient_Get_voidInvoice() {
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.NewInvoicesClient().Get(ctx, "{billingAccountName}", "{invoiceName}", 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.Invoice = armbilling.Invoice{
// Name: to.Ptr("{invoiceName}"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"),
// Properties: &armbilling.InvoiceProperties{
// AmountDue: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// AzurePrepaymentApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](15.46),
// },
// BilledAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// BilledDocumentID: to.Ptr("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/I000002"),
// BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"),
// CreditAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice),
// Documents: []*armbilling.Document{
// {
// Kind: to.Ptr(armbilling.DocumentTypeInvoice),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/invoice.pdf"),
// },
// {
// Kind: to.Ptr(armbilling.DocumentTypeTaxReceipt),
// Source: to.Ptr(armbilling.DocumentSourceDRS),
// URL: to.Ptr("https://microsoft.com/taxDoc.pdf"),
// }},
// DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-16T17:32:28.000Z"); return t}()),
// FreeAzureCreditApplied: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-15T17:32:28.000Z"); return t}()),
// InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T17:32:28.000Z"); return t}()),
// IsMonthlyInvoice: to.Ptr(false),
// Payments: []*armbilling.PaymentProperties{
// {
// Amount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](2),
// },
// Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-14T17:32:28.000Z"); return t}()),
// PaymentMethodFamily: to.Ptr(armbilling.PaymentMethodFamilyCreditCard),
// PaymentMethodType: to.Ptr("visa"),
// PaymentType: to.Ptr("credited"),
// }},
// PurchaseOrderNumber: to.Ptr("123456"),
// Status: to.Ptr(armbilling.InvoiceStatusVoid),
// SubTotal: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](33.99),
// },
// TaxAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](0),
// },
// TotalAmount: &armbilling.Amount{
// Currency: to.Ptr("USD"),
// Value: to.Ptr[float32](16.53),
// },
// },
// }
}
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 an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
*
* @summary Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/VoidInvoice.json
*/
async function voidInvoice() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const invoiceName = "{invoiceName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.invoices.get(billingAccountName, invoiceName);
console.log(result);
}
voidInvoice().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}/invoices/{invoiceName}",
"name": "{invoiceName}",
"type": "Microsoft.Billing/billingAccounts/invoices",
"properties": {
"dueDate": "2018-01-16T17:32:28Z",
"invoiceDate": "2018-01-01T17:32:28Z",
"status": "Void",
"amountDue": {
"currency": "USD",
"value": 16.53
},
"billedAmount": {
"currency": "USD",
"value": 33.99
},
"azurePrepaymentApplied": {
"currency": "USD",
"value": 15.46
},
"creditAmount": {
"currency": "USD",
"value": 2
},
"freeAzureCreditApplied": {
"currency": "USD",
"value": 0
},
"subTotal": {
"currency": "USD",
"value": 33.99
},
"taxAmount": {
"currency": "USD",
"value": 0
},
"totalAmount": {
"currency": "USD",
"value": 16.53
},
"invoicePeriodStartDate": "2018-01-01T17:32:28Z",
"invoicePeriodEndDate": "2018-01-15T17:32:28Z",
"isMonthlyInvoice": false,
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}",
"billingProfileDisplayName": "Contoso Operations Billing",
"purchaseOrderNumber": "123456",
"documentType": "Invoice",
"billedDocumentId": "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/I000002",
"documents": [
{
"kind": "Invoice",
"url": "https://microsoft.com/invoice.pdf",
"source": "DRS"
},
{
"kind": "TaxReceipt",
"url": "https://microsoft.com/taxDoc.pdf",
"source": "DRS"
}
],
"payments": [
{
"date": "2018-01-14T17:32:28Z",
"paymentType": "credited",
"amount": {
"currency": "USD",
"value": 2
},
"paymentMethodFamily": "CreditCard",
"paymentMethodType": "visa"
}
]
}
}
Definitions
Amount
The amount.
Name |
Type |
Description |
currency
|
string
|
The currency for the amount value.
|
value
|
number
|
Amount value.
|
Document
The properties of a document.
Name |
Type |
Description |
kind
|
DocumentType
|
The type of the document.
|
source
|
DocumentSource
|
The source of the document. ENF for Brazil and DRS for rest of the world.
|
url
|
string
|
Document URL.
|
DocumentSource
The source of the document. ENF for Brazil and DRS for rest of the world.
Name |
Type |
Description |
DRS
|
string
|
|
ENF
|
string
|
|
DocumentType
The type of the document.
Name |
Type |
Description |
CreditNote
|
string
|
|
Invoice
|
string
|
|
TaxReceipt
|
string
|
|
VoidNote
|
string
|
|
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.
|
Invoice
An invoice.
Name |
Type |
Description |
id
|
string
|
Resource Id.
|
name
|
string
|
Resource name.
|
properties.amountDue
|
Amount
|
The amount due as of now.
|
properties.azurePrepaymentApplied
|
Amount
|
The amount of Azure prepayment applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement.
|
properties.billedAmount
|
Amount
|
The total charges for the invoice billing period.
|
properties.billedDocumentId
|
string
|
The Id of the active invoice which is originally billed after this invoice was voided. This field is applicable to the void invoices only.
|
properties.billingProfileDisplayName
|
string
|
The name of the billing profile for which the invoice is generated.
|
properties.billingProfileId
|
string
|
The ID of the billing profile for which the invoice is generated.
|
properties.creditAmount
|
Amount
|
The total refund for returns and cancellations during the invoice billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement.
|
properties.creditForDocumentId
|
string
|
The Id of the invoice which got voided and this credit note was issued as a result. This field is applicable to the credit notes only.
|
properties.documentType
|
InvoiceDocumentType
|
The type of the document.
|
properties.documents
|
Document[]
|
List of documents available to download such as invoice and tax receipt.
|
properties.dueDate
|
string
|
The due date for the invoice.
|
properties.freeAzureCreditApplied
|
Amount
|
The amount of free Azure credits applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement.
|
properties.invoiceDate
|
string
|
The date when the invoice was generated.
|
properties.invoicePeriodEndDate
|
string
|
The end date of the billing period for which the invoice is generated.
|
properties.invoicePeriodStartDate
|
string
|
The start date of the billing period for which the invoice is generated.
|
properties.invoiceType
|
InvoiceType
|
Invoice type.
|
properties.isMonthlyInvoice
|
boolean
|
Specifies if the invoice is generated as part of monthly invoicing cycle or not. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement.
|
properties.payments
|
PaymentProperties[]
|
List of payments.
|
properties.purchaseOrderNumber
|
string
|
An optional purchase order number for the invoice.
|
properties.rebillDetails
|
<string,
RebillDetails>
|
Rebill details for an invoice.
|
properties.status
|
InvoiceStatus
|
The current status of the invoice.
|
properties.subTotal
|
Amount
|
The pre-tax amount due. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement.
|
properties.subscriptionId
|
string
|
The ID of the subscription for which the invoice is generated.
|
properties.taxAmount
|
Amount
|
The amount of tax charged for the billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement.
|
properties.totalAmount
|
Amount
|
The amount due when the invoice was generated. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement.
|
type
|
string
|
Resource type.
|
InvoiceDocumentType
The type of the document.
Name |
Type |
Description |
CreditNote
|
string
|
|
Invoice
|
string
|
|
InvoiceStatus
The current status of the invoice.
Name |
Type |
Description |
Due
|
string
|
|
OverDue
|
string
|
|
Paid
|
string
|
|
Void
|
string
|
|
InvoiceType
Invoice type.
Name |
Type |
Description |
AzureMarketplace
|
string
|
|
AzureService
|
string
|
|
AzureSupport
|
string
|
|
PaymentMethodFamily
The family of payment method.
Name |
Type |
Description |
CheckWire
|
string
|
|
CreditCard
|
string
|
|
Credits
|
string
|
|
None
|
string
|
|
PaymentProperties
The properties of a payment.
Name |
Type |
Description |
amount
|
Amount
|
The paid amount.
|
date
|
string
|
The date when the payment was made.
|
paymentMethodFamily
|
PaymentMethodFamily
|
The family of payment method.
|
paymentMethodType
|
string
|
The type of payment method.
|
paymentType
|
string
|
The type of payment.
|
RebillDetails
The rebill details of an invoice.
Name |
Type |
Description |
creditNoteDocumentId
|
string
|
The ID of credit note.
|
invoiceDocumentId
|
string
|
The ID of invoice.
|
rebillDetails
|
<string,
RebillDetails>
|
Rebill details for an invoice.
|