取得發票區段上角色的定義。 只有合約類型為 Microsoft 客戶合約的計費帳戶才支援此作業。
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}?api-version=2020-05-01
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
billingAccountName
|
path |
True
|
string
|
可唯一識別計費帳戶的標識碼。
|
billingProfileName
|
path |
True
|
string
|
可唯一識別帳單配置檔的標識碼。
|
billingRoleDefinitionName
|
path |
True
|
string
|
可唯一識別角色定義的標識碼。
|
invoiceSectionName
|
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
|
模擬您的用戶帳戶
|
範例
InvoiceSectionRoleDefinition
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}?api-version=2020-05-01
/** Samples for BillingRoleDefinitions GetByInvoiceSection. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionRoleDefinition.json
*/
/**
* Sample code: InvoiceSectionRoleDefinition.
*
* @param manager Entry point to BillingManager.
*/
public static void invoiceSectionRoleDefinition(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.billingRoleDefinitions()
.getByInvoiceSectionWithResponse(
"{billingAccountName}",
"{billingProfileName}",
"{invoiceSectionName}",
"{billingRoleDefinitionName}",
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_section_role_definition.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BillingManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.billing_role_definitions.get_by_invoice_section(
billing_account_name="{billingAccountName}",
billing_profile_name="{billingProfileName}",
invoice_section_name="{invoiceSectionName}",
billing_role_definition_name="{billingRoleDefinitionName}",
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionRoleDefinition.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/InvoiceSectionRoleDefinition.json
func ExampleRoleDefinitionsClient_GetByInvoiceSection() {
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.NewRoleDefinitionsClient().GetByInvoiceSection(ctx, "{billingAccountName}", "{billingProfileName}", "{invoiceSectionName}", "{billingRoleDefinitionName}", 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.RoleDefinition = armbilling.RoleDefinition{
// Name: to.Ptr("{billingRoleDefinitionName}"),
// Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleDefinitions"),
// ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}"),
// Properties: &armbilling.RoleDefinitionProperties{
// Description: to.Ptr("The Owner role gives the user all permissions including access management rights to the invoice section."),
// Permissions: []*armbilling.PermissionsProperties{
// {
// Actions: []*string{
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000008"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000001"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000002"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"),
// to.Ptr("20000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"),
// to.Ptr("20000000-aaaa-bbbb-cccc-200000000002"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000008")},
// NotActions: []*string{
// },
// }},
// RoleName: to.Ptr("Invoice section owner"),
// },
// }
}
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 the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement.
*
* @summary Gets the definition for a role on an invoice section. 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/InvoiceSectionRoleDefinition.json
*/
async function invoiceSectionRoleDefinition() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const billingProfileName = "{billingProfileName}";
const invoiceSectionName = "{invoiceSectionName}";
const billingRoleDefinitionName = "{billingRoleDefinitionName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.billingRoleDefinitions.getByInvoiceSection(
billingAccountName,
billingProfileName,
invoiceSectionName,
billingRoleDefinitionName
);
console.log(result);
}
invoiceSectionRoleDefinition().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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}",
"name": "{billingRoleDefinitionName}",
"properties": {
"description": "The Owner role gives the user all permissions including access management rights to the invoice section.",
"permissions": [
{
"actions": [
"10000000-aaaa-bbbb-cccc-200000000000",
"10000000-aaaa-bbbb-cccc-200000000008",
"10000000-aaaa-bbbb-cccc-200000000001",
"10000000-aaaa-bbbb-cccc-200000000002",
"10000000-aaaa-bbbb-cccc-200000000003",
"10000000-aaaa-bbbb-cccc-200000000006",
"10000000-aaaa-bbbb-cccc-200000000007",
"20000000-aaaa-bbbb-cccc-200000000000",
"30000000-aaaa-bbbb-cccc-200000000000",
"40000000-aaaa-bbbb-cccc-200000000000",
"30000000-aaaa-bbbb-cccc-200000000009",
"20000000-aaaa-bbbb-cccc-200000000002",
"30000000-aaaa-bbbb-cccc-200000000015",
"30000000-aaaa-bbbb-cccc-200000000004",
"30000000-aaaa-bbbb-cccc-200000000007",
"30000000-aaaa-bbbb-cccc-200000000001",
"30000000-aaaa-bbbb-cccc-200000000010",
"40000000-aaaa-bbbb-cccc-200000000007",
"40000000-aaaa-bbbb-cccc-200000000006",
"40000000-aaaa-bbbb-cccc-200000000008"
],
"notActions": []
}
],
"roleName": "Invoice section owner"
},
"type": "Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleDefinitions"
}
定義
BillingPermissionsProperties
呼叫端在計費帳戶上擁有的一組允許動作和不允許的動作
名稱 |
類型 |
Description |
actions
|
string[]
|
允許呼叫端執行的一組動作。
|
notActions
|
string[]
|
不允許呼叫端執行的一組動作。
|
BillingRoleDefinition
角色定義的屬性。
名稱 |
類型 |
Description |
id
|
string
|
資源標識碼。
|
name
|
string
|
資源名稱。
|
properties.description
|
string
|
角色描述
|
properties.permissions
|
BillingPermissionsProperties[]
|
角色具有的 billingPermissions
|
properties.roleName
|
string
|
角色的名稱
|
type
|
string
|
資源類型。
|
ErrorDetails
錯誤的詳細數據。
名稱 |
類型 |
Description |
code
|
string
|
錯誤碼。
|
details
|
ErrorSubDetails[]
|
錯誤的子詳細數據。
|
message
|
string
|
錯誤訊息,指出作業失敗的原因。
|
target
|
string
|
特定錯誤的目標。
|
ErrorResponse
錯誤回應表示服務無法處理傳入要求。 錯誤訊息中會提供原因。
ErrorSubDetails
名稱 |
類型 |
Description |
code
|
string
|
錯誤碼。
|
message
|
string
|
錯誤訊息,指出作業失敗的原因。
|
target
|
string
|
特定錯誤的目標。
|