列出用戶可存取的發票區段。 只有合約類型為 Microsoft 客戶合約的計費帳戶才支援此作業。
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections?api-version=2020-05-01
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
billingAccountName
|
path |
True
|
string
|
可唯一識別計費帳戶的標識碼。
|
billingProfileName
|
path |
True
|
string
|
可唯一識別帳單配置檔的標識碼。
|
api-version
|
query |
True
|
string
|
要與用戶端要求搭配使用的 API 版本。 目前的版本為 2020-05-01。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
InvoiceSectionsListByBillingProfile
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections?api-version=2020-05-01
/** Samples for InvoiceSections ListByBillingProfile. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionsListByBillingProfile.json
*/
/**
* Sample code: InvoiceSectionsListByBillingProfile.
*
* @param manager Entry point to BillingManager.
*/
public static void invoiceSectionsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.invoiceSections()
.listByBillingProfile("{billingAccountName}", "{billingProfileName}", 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_sections_list_by_billing_profile.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BillingManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.invoice_sections.list_by_billing_profile(
billing_account_name="{billingAccountName}",
billing_profile_name="{billingProfileName}",
)
for item in response:
print(item)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionsListByBillingProfile.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/InvoiceSectionsListByBillingProfile.json
func ExampleInvoiceSectionsClient_NewListByBillingProfilePager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbilling.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewInvoiceSectionsClient().NewListByBillingProfilePager("{billingAccountName}", "{billingProfileName}", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.InvoiceSectionListResult = armbilling.InvoiceSectionListResult{
// Value: []*armbilling.InvoiceSection{
// {
// Name: to.Ptr("22000000-0000-0000-0000-000000000000"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/22000000-0000-0000-0000-000000000000"),
// Properties: &armbilling.InvoiceSectionProperties{
// DisplayName: to.Ptr("invoiceSection1"),
// Labels: map[string]*string{
// "costCategory": to.Ptr("Support"),
// "pcCode": to.Ptr("A123456"),
// },
// State: to.Ptr(armbilling.InvoiceSectionStateActive),
// SystemID: to.Ptr("XX1X-XXAA-XXX-ZZZ"),
// Tags: map[string]*string{
// "costCategory": to.Ptr("Support"),
// "pcCode": to.Ptr("A123456"),
// },
// },
// },
// {
// Name: to.Ptr("22000000-0000-0000-0000-000000000011"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/22000000-0000-0000-0000-000000000011"),
// Properties: &armbilling.InvoiceSectionProperties{
// DisplayName: to.Ptr("invoiceSection2"),
// Labels: map[string]*string{
// "costCategory": to.Ptr("Marketing"),
// "pcCode": to.Ptr("Z223456"),
// },
// State: to.Ptr(armbilling.InvoiceSectionStateRestricted),
// SystemID: to.Ptr("YY1X-BBAA-XXX-ZZZ"),
// Tags: map[string]*string{
// "costCategory": to.Ptr("Marketing"),
// "pcCode": to.Ptr("Z223456"),
// },
// TargetCloud: to.Ptr(armbilling.TargetCloudUSSec),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BillingManagementClient } = require("@azure/arm-billing");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement.
*
* @summary Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionsListByBillingProfile.json
*/
async function invoiceSectionsListByBillingProfile() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const billingProfileName = "{billingProfileName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.invoiceSections.listByBillingProfile(
billingAccountName,
billingProfileName
)) {
resArray.push(item);
}
console.log(resArray);
}
invoiceSectionsListByBillingProfile().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/22000000-0000-0000-0000-000000000000",
"name": "22000000-0000-0000-0000-000000000000",
"type": "Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections",
"properties": {
"displayName": "invoiceSection1",
"labels": {
"pcCode": "A123456",
"costCategory": "Support"
},
"state": "Active",
"systemId": "XX1X-XXAA-XXX-ZZZ",
"tags": {
"pcCode": "A123456",
"costCategory": "Support"
}
}
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/22000000-0000-0000-0000-000000000011",
"name": "22000000-0000-0000-0000-000000000011",
"type": "Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections",
"properties": {
"displayName": "invoiceSection2",
"labels": {
"pcCode": "Z223456",
"costCategory": "Marketing"
},
"state": "Restricted",
"systemId": "YY1X-BBAA-XXX-ZZZ",
"tags": {
"pcCode": "Z223456",
"costCategory": "Marketing"
},
"targetCloud": "USSec"
}
}
]
}
定義
ErrorDetails
錯誤的詳細數據。
名稱 |
類型 |
Description |
code
|
string
|
錯誤碼。
|
details
|
ErrorSubDetails[]
|
錯誤的子詳細數據。
|
message
|
string
|
錯誤訊息,指出作業失敗的原因。
|
target
|
string
|
特定錯誤的目標。
|
ErrorResponse
錯誤回應表示服務無法處理傳入要求。 錯誤訊息中會提供原因。
ErrorSubDetails
名稱 |
類型 |
Description |
code
|
string
|
錯誤碼。
|
message
|
string
|
錯誤訊息,指出作業失敗的原因。
|
target
|
string
|
特定錯誤的目標。
|
InvoiceSection
發票區段。
名稱 |
類型 |
Description |
id
|
string
|
資源標識碼。
|
name
|
string
|
資源名稱。
|
properties.displayName
|
string
|
發票區段的名稱。
|
properties.labels
|
object
|
與發票區段相關聯的元數據字典。
|
properties.state
|
InvoiceSectionState
|
識別發票區段的狀態。
|
properties.systemId
|
string
|
系統為發票區段產生唯一標識符。
|
properties.tags
|
object
|
與發票區段相關聯的元數據字典。 支援的索引鍵/值長度上限為 256 個字元。 索引鍵/值不應空白值或 Null。 索引鍵不能包含 <> % & \ ? /
|
properties.targetCloud
|
targetCloud
|
識別與發票區段相關聯的雲端環境。 這是系統管理的選擇性字段,而且會在發票區段與各種雲端中的帳戶相關聯時更新。
|
type
|
string
|
資源類型。
|
InvoiceSectionListResult
發票區段的清單。
名稱 |
類型 |
Description |
nextLink
|
string
|
連結 (url) 到下一頁的結果。
|
totalCount
|
number
|
總記錄數。
|
value
|
InvoiceSection[]
|
發票區段的清單。
|
InvoiceSectionState
識別發票區段的狀態。
名稱 |
類型 |
Description |
Active
|
string
|
|
Restricted
|
string
|
|
targetCloud
識別與發票區段相關聯的雲端環境。 這是系統管理的選擇性字段,而且會在發票區段與各種雲端中的帳戶相關聯時更新。
名稱 |
類型 |
Description |
USGov
|
string
|
|
USNat
|
string
|
|
USSec
|
string
|
|