Wyświetla listę opłat na podstawie zdefiniowanego zakresu.
GET https://management.azure.com/{scope}/providers/Microsoft.Consumption/charges?api-version=2024-08-01
Z parametrami opcjonalnymi:
GET https://management.azure.com/{scope}/providers/Microsoft.Consumption/charges?api-version=2024-08-01&startDate={startDate}&endDate={endDate}&$filter={$filter}&$apply={$apply}
Parametry identyfikatora URI
| Nazwa |
W |
Wymagane |
Typ |
Opis |
|
scope
|
path |
True
|
string
|
W pełni kwalifikowany identyfikator zasobu usługi Azure Resource Manager.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Wersja interfejsu API do użycia dla tej operacji.
|
|
$apply
|
query |
|
string
|
Może służyć do grupowania opłat za zakres billingAccount według właściwości/billingProfileId, properties/invoiceSectionId, properties/customerId (specyficzny dla identyfikatora Led partnera) lub dla zakresu billingProfile według właściwości/invoiceSectionId.
|
|
$filter
|
query |
|
string
|
Może służyć do filtrowania opłat według właściwości/użyciaEnd (czas utc), properties/usageStart (czas utc). Filtr obsługuje wartości "eq", "lt", "gt", "le", "ge" i "and". Obecnie nie obsługuje "ne", "lub" lub "nie". Filtr tagu to ciąg pary klucz-wartość, w którym klucz i wartość są oddzielone dwukropkiem (:).
|
|
endDate
|
query |
|
string
|
Data zakończenia
|
|
startDate
|
query |
|
string
|
Data rozpoczęcia
|
Odpowiedzi
Zabezpieczenia
azure_auth
Przepływ protokołu OAuth2 usługi Azure Active Directory.
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
| Nazwa |
Opis |
|
user_impersonation
|
personifikacja konta użytkownika
|
Przykłady
ChangesForBillingPeriodByDepartment-Legacy
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges?api-version=2024-08-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_for_billing_period_by_department.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/BillingAccounts/1234/departments/42425",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesForBillingPeriodByDepartment.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesForBillingPeriodByDepartment.json
func ExampleChargesClient_List_changesForBillingPeriodByDepartmentLegacy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/departments/42425", 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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.LegacyChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy),
// Properties: &armconsumption.LegacyChargeSummaryProperties{
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "legacy",
"properties": {
"azureCharges": 5000,
"azureMarketplaceCharges": 100,
"billingPeriodId": "/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804",
"chargesBilledSeparately": 60.9,
"currency": "USD",
"usageEnd": "2018-04-30",
"usageStart": "2018-04-01"
}
}
]
}
ChangesForBillingPeriodByEnrollmentAccount-Legacy
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges?api-version=2024-08-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_for_billing_period_by_enrollment_account.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesForBillingPeriodByEnrollmentAccount.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesForBillingPeriodByEnrollmentAccount.json
func ExampleChargesClient_List_changesForBillingPeriodByEnrollmentAccountLegacy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425", 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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.LegacyChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy),
// Properties: &armconsumption.LegacyChargeSummaryProperties{
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "legacy",
"properties": {
"azureCharges": 5000,
"azureMarketplaceCharges": 100,
"billingPeriodId": "/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804",
"chargesBilledSeparately": 60.9,
"currency": "USD",
"usageEnd": "2018-04-30",
"usageStart": "2018-04-01"
}
}
]
}
ChargesListByBillingAccount-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges?api-version=2024-08-01&startDate=2019-09-01&endDate=2019-10-31
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_billing_account.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/billingAccounts/1234:56789",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernBillingAccount.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernBillingAccount.json
func ExampleChargesClient_List_chargesListByBillingAccountModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{
EndDate: to.Ptr("2019-10-31"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-10-31"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 0
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910",
"billingProfileId": null,
"chargesBilledSeparately": {
"currency": "USD",
"value": 265.09
},
"invoiceSectionId": null,
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 0
},
"usageEnd": "2019-10-31",
"usageStart": "2019-09-01"
}
}
]
}
ChargesListByBillingAccountGroupByBillingProfileId-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges?api-version=2024-08-01&startDate=2019-09-01&endDate=2019-09-30&$apply=groupby((properties/billingProfileId))
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_billing_account_group_by_billing_profile_id.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/billingAccounts/1234:56789",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernBillingAccountGroupByBillingProfileId.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernBillingAccountGroupByBillingProfileId.json
func ExampleChargesClient_List_chargesListByBillingAccountGroupByBillingProfileIdModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{
Apply: to.Ptr("groupby((properties/billingProfileId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId2"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/42425/providers/Microsoft.Consumption/charges/chargeSummaryId2"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
},
{
"name": "chargeSummaryId2",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/42425/providers/Microsoft.Consumption/charges/chargeSummaryId2",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
}
]
}
ChargesListByBillingAccountGroupByCustomerId-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges?api-version=2024-08-01&startDate=2019-09-01&endDate=2019-09-30&$apply=groupby((properties/customerId))
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_billing_account_group_by_customer_id.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/billingAccounts/1234:56789",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernBillingAccountGroupByCustomerId.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernBillingAccountGroupByCustomerId.json
func ExampleChargesClient_List_chargesListByBillingAccountGroupByCustomerIdModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{
Apply: to.Ptr("groupby((properties/customerId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890"),
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId2"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/123456/providers/Microsoft.Consumption/charges/chargeSummaryId2"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/123456"),
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"customerId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890",
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
},
{
"name": "chargeSummaryId2",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/123456/providers/Microsoft.Consumption/charges/chargeSummaryId2",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"customerId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/123456",
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
}
]
}
ChargesListByBillingAccountGroupByInvoiceSectionId-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/providers/Microsoft.Consumption/charges?api-version=2024-08-01&startDate=2019-09-01&endDate=2019-09-30&$apply=groupby((properties/invoiceSectionId))
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_billing_account_group_by_invoice_section_id.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernBillingAccountGroupByInvoiceSectionId.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernBillingAccountGroupByInvoiceSectionId.json
func ExampleChargesClient_List_chargesListByBillingAccountGroupByInvoiceSectionIdModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425", &armconsumption.ChargesClientListOptions{
Apply: to.Ptr("groupby((properties/invoiceSectionId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId2"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
},
{
"name": "chargeSummaryId2",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
}
]
}
ChargesListByBillingProfile-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2460/providers/Microsoft.Consumption/charges?api-version=2024-08-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_billing_profile.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2460",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernBillingProfile.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernBillingProfile.json
func ExampleChargesClient_List_chargesListByBillingProfileModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2460", 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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2023-05-31"),
// UsageStart: to.Ptr("2023-03-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 0
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460",
"chargesBilledSeparately": {
"currency": "USD",
"value": 265.09
},
"invoiceSectionId": null,
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 0
},
"usageEnd": "2023-05-31",
"usageStart": "2023-03-01"
}
}
]
}
ChargesListByBillingProfileGroupByInvoiceSectionId-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/providers/Microsoft.Consumption/charges?api-version=2024-08-01&startDate=2019-09-01&endDate=2019-09-30&$apply=groupby((properties/invoiceSectionId))
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_billing_profile_group_by_invoice_section_id.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernBillingProfileGroupByInvoiceSectionId.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernBillingProfileGroupByInvoiceSectionId.json
func ExampleChargesClient_List_chargesListByBillingProfileGroupByInvoiceSectionIdModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425", &armconsumption.ChargesClientListOptions{
Apply: to.Ptr("groupby((properties/invoiceSectionId))"),
EndDate: to.Ptr("2019-09-30"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId2"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
},
{
"name": "chargeSummaryId2",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
}
]
}
ChargesListByBillingProfileInvoiceSection-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges?api-version=2024-08-01&startDate=2019-09-01&endDate=2019-10-31
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_billing_profile_invoice_section.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernBillingProfileInvoiceSection.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernBillingProfileInvoiceSection.json
func ExampleChargesClient_List_chargesListByBillingProfileInvoiceSectionModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890", &armconsumption.ChargesClientListOptions{
EndDate: to.Ptr("2019-10-31"),
StartDate: to.Ptr("2019-09-01")})
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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-09-30"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId2"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2019-10-31"),
// UsageStart: to.Ptr("2019-09-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-09-30",
"usageStart": "2019-09-01"
}
},
{
"name": "chargeSummaryId2",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 5000
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425",
"chargesBilledSeparately": {
"currency": "USD",
"value": 60.9
},
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 100
},
"usageEnd": "2019-10-31",
"usageStart": "2019-09-01"
}
}
]
}
ChargesListByCustomer-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges?api-version=2024-08-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_customer.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/67890",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernCustomer.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernCustomer.json
func ExampleChargesClient_List_chargesListByCustomerModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/67890", 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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2023-05-31"),
// UsageStart: to.Ptr("2023-03-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 0
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910",
"billingProfileId": null,
"chargesBilledSeparately": {
"currency": "USD",
"value": 265.09
},
"invoiceSectionId": null,
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 0
},
"usageEnd": "2023-05-31",
"usageStart": "2023-03-01"
}
}
]
}
ChargesListByDepartment-Legacy
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges?api-version=2024-08-01&$filter=usageStart eq '2018-04-01' AND usageEnd eq '2018-05-30'
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_for_department_filter_by_start_end_date.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/BillingAccounts/1234/departments/42425",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListForDepartmentFilterByStartEndDate.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListForDepartmentFilterByStartEndDate.json
func ExampleChargesClient_List_chargesListByDepartmentLegacy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/departments/42425", &armconsumption.ChargesClientListOptions{
Filter: to.Ptr("usageStart eq '2018-04-01' AND usageEnd eq '2018-05-30'")})
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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.LegacyChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy),
// Properties: &armconsumption.LegacyChargeSummaryProperties{
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "legacy",
"properties": {
"azureCharges": 5000,
"azureMarketplaceCharges": 100,
"billingPeriodId": "/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804",
"chargesBilledSeparately": 60.9,
"currency": "USD",
"usageEnd": "2018-04-30",
"usageStart": "2018-04-01"
}
}
]
}
ChargesListByInvoiceSectionId-Modern
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/97531/providers/Microsoft.Consumption/charges?api-version=2024-08-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_by_modern_invoice_section_id.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/97531",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListByModernInvoiceSectionId.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListByModernInvoiceSectionId.json
func ExampleChargesClient_List_chargesListByInvoiceSectionIdModern() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/97531", 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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.ModernChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindModern),
// Properties: &armconsumption.ModernChargeSummaryProperties{
// AzureCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"),
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"),
// BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460"),
// ChargesBilledSeparately: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531"),
// IsInvoiced: to.Ptr(false),
// MarketplaceCharges: &armconsumption.Amount{
// Currency: to.Ptr("USD"),
// },
// UsageEnd: to.Ptr("2023-05-31"),
// UsageStart: to.Ptr("2023-03-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "modern",
"properties": {
"azureCharges": {
"currency": "USD",
"value": 12
},
"billingAccountId": "/providers/Microsoft.Billing/billingAccounts/1234:56789",
"billingPeriodId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910",
"billingProfileId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460",
"chargesBilledSeparately": {
"currency": "USD",
"value": 0
},
"invoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531",
"isInvoiced": false,
"marketplaceCharges": {
"currency": "USD",
"value": 0
},
"usageEnd": "2023-05-31",
"usageStart": "2023-03-01"
}
}
]
}
ChargesListForEnrollmentAccount-Legacy
Przykładowe żądanie
GET https://management.azure.com/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges?api-version=2024-08-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.consumption import ConsumptionManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-consumption
# USAGE
python charges_list_for_enrollment_account_filter_by_start_end_date.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 = ConsumptionManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.charges.list(
scope="providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425",
)
print(response)
# x-ms-original-file: 2024-08-01/ChargesListForEnrollmentAccountFilterByStartEndDate.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 armconsumption_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2"
)
// Generated from example definition: 2024-08-01/ChargesListForEnrollmentAccountFilterByStartEndDate.json
func ExampleChargesClient_List_chargesListForEnrollmentAccountLegacy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armconsumption.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425", 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 = armconsumption.ChargesClientListResponse{
// ChargesListResult: &armconsumption.ChargesListResult{
// Value: []armconsumption.ChargeSummaryClassification{
// &armconsumption.LegacyChargeSummary{
// Name: to.Ptr("chargeSummaryId1"),
// Type: to.Ptr("Microsoft.Consumption/charges"),
// ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"),
// Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy),
// Properties: &armconsumption.LegacyChargeSummaryProperties{
// BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"),
// Currency: to.Ptr("USD"),
// UsageEnd: to.Ptr("2018-04-30"),
// UsageStart: to.Ptr("2018-04-01"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"value": [
{
"name": "chargeSummaryId1",
"type": "Microsoft.Consumption/charges",
"id": "/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1",
"kind": "legacy",
"properties": {
"azureCharges": 5000,
"azureMarketplaceCharges": 100,
"billingPeriodId": "/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804",
"chargesBilledSeparately": 60.9,
"currency": "USD",
"usageEnd": "2018-04-30",
"usageStart": "2018-04-01"
}
}
]
}
Definicje
amount
Objekt
Kwota plus waluta .
| Nazwa |
Typ |
Opis |
|
currency
|
string
|
Kwota waluty.
|
|
value
|
number
(decimal)
|
Kwota.
|
ChargesListResult
Objekt
Wynik podsumowania opłat za wyświetlenie listy.
| Nazwa |
Typ |
Opis |
|
value
|
ChargeSummary[]:
|
Lista podsumowania opłat
|
ChargeSummaryKind
Wyliczenie
Określa rodzaj podsumowania opłat.
| Wartość |
Opis |
|
legacy
|
|
|
modern
|
|
createdByType
Wyliczenie
Typ tożsamości, która utworzyła zasób.
| Wartość |
Opis |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Objekt
Dodatkowe informacje o błędzie zarządzania zasobami.
| Nazwa |
Typ |
Opis |
|
info
|
object
|
Dodatkowe informacje.
|
|
type
|
string
|
Dodatkowy typ informacji.
|
ErrorDetail
Objekt
Szczegóły błędu.
| Nazwa |
Typ |
Opis |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Dodatkowe informacje o błędzie.
|
|
code
|
string
|
Kod błędu.
|
|
details
|
ErrorDetail[]
|
Szczegóły błędu.
|
|
message
|
string
|
Komunikat o błędzie.
|
|
target
|
string
|
Element docelowy błędu.
|
ErrorResponse
Objekt
Odpowiedź na błąd
LegacyChargeSummary
Objekt
Podsumowanie starszych opłat.
| Nazwa |
Typ |
Opis |
|
eTag
|
string
|
Element eTag zasobu. Aby obsłużyć scenariusz aktualizacji współbieżnych, to pole będzie używane do określenia, czy użytkownik aktualizuje najnowszą wersję, czy nie.
|
|
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Przykład - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
kind
|
string:
legacy
|
Określa rodzaj podsumowania opłat.
|
|
name
|
string
|
Nazwa zasobu
|
|
properties.azureCharges
|
number
(decimal)
|
Opłaty za platformę Azure.
|
|
properties.azureMarketplaceCharges
|
number
(decimal)
|
Opłaty za witrynę Marketplace.
|
|
properties.billingPeriodId
|
string
|
Identyfikator zasobu okresu rozliczeniowego, do którego należy opłata.
|
|
properties.chargesBilledSeparately
|
number
(decimal)
|
Opłaty rozliczane oddzielnie.
|
|
properties.currency
|
string
|
Kod waluty
|
|
properties.usageEnd
|
string
|
Data zakończenia użycia.
|
|
properties.usageStart
|
string
|
Data rozpoczęcia użycia.
|
|
systemData
|
systemData
|
Metadane usługi Azure Resource Manager zawierające informacje „createdBy” i „modifiedBy”.
|
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
ModernChargeSummary
Objekt
Podsumowanie nowoczesnych opłat.
| Nazwa |
Typ |
Opis |
|
eTag
|
string
|
Element eTag zasobu. Aby obsłużyć scenariusz aktualizacji współbieżnych, to pole będzie używane do określenia, czy użytkownik aktualizuje najnowszą wersję, czy nie.
|
|
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Przykład - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
kind
|
string:
modern
|
Określa rodzaj podsumowania opłat.
|
|
name
|
string
|
Nazwa zasobu
|
|
properties.azureCharges
|
amount
|
Opłaty za platformę Azure.
|
|
properties.billingAccountId
|
string
|
Identyfikator konta rozliczeniowego
|
|
properties.billingPeriodId
|
string
|
Identyfikator zasobu okresu rozliczeniowego, do którego należy opłata.
|
|
properties.billingProfileId
|
string
|
Identyfikator profilu rozliczeniowego
|
|
properties.chargesBilledSeparately
|
amount
|
Opłaty rozliczane oddzielnie.
|
|
properties.customerId
|
string
|
Identyfikator klienta
|
|
properties.invoiceSectionId
|
string
|
Identyfikator sekcji faktury
|
|
properties.isInvoiced
|
boolean
|
Jest naliczana opłata zafakturowana
|
|
properties.marketplaceCharges
|
amount
|
Opłaty za witrynę Marketplace.
|
|
properties.subscriptionId
|
string
|
Identyfikator GUID subskrypcji.
|
|
properties.usageEnd
|
string
|
Data zakończenia użycia.
|
|
properties.usageStart
|
string
|
Data rozpoczęcia użycia.
|
|
systemData
|
systemData
|
Metadane usługi Azure Resource Manager zawierające informacje „createdBy” i „modifiedBy”.
|
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
systemData
Objekt
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
| Nazwa |
Typ |
Opis |
|
createdAt
|
string
(date-time)
|
Sygnatura czasowa tworzenia zasobu (UTC).
|
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
|
lastModifiedAt
|
string
(date-time)
|
Sygnatura czasowa ostatniej modyfikacji zasobu (UTC)
|
|
lastModifiedBy
|
string
|
Tożsamość, która jako ostatnia zmodyfikowała zasób.
|
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która jako ostatnia zmodyfikowała zasób.
|