获取发票科目中某个角色的定义。 只有协议类型为 Microsoft 客户协议的计费帐户支持该操作。
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}?api-version=2020-05-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
billingAccountName
|
path |
True
|
string
|
唯一标识计费帐户的 ID。
|
billingProfileName
|
path |
True
|
string
|
唯一标识计费对象信息的 ID。
|
billingRoleDefinitionName
|
path |
True
|
string
|
唯一标识角色定义的 ID。
|
invoiceSectionName
|
path |
True
|
string
|
唯一标识发票科目的 ID。
|
api-version
|
query |
True
|
string
|
要与客户端请求一起使用的 API 的版本。 当前版本为 2020-05-01。
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 流。
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 |
说明 |
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
调用方对计费帐户的允许操作和不允许的操作集
名称 |
类型 |
说明 |
actions
|
string[]
|
允许调用方执行的操作集。
|
notActions
|
string[]
|
不允许调用方执行的操作集。
|
BillingRoleDefinition
角色定义的属性。
名称 |
类型 |
说明 |
id
|
string
|
资源 ID。
|
name
|
string
|
资源名称。
|
properties.description
|
string
|
角色说明
|
properties.permissions
|
BillingPermissionsProperties[]
|
角色具有的 billingPermissions
|
properties.roleName
|
string
|
角色的名称
|
type
|
string
|
资源类型。
|
ErrorDetails
错误的详细信息。
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
details
|
ErrorSubDetails[]
|
错误的子详细信息。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|
ErrorResponse
错误响应指示服务无法处理传入请求。 错误消息中提供了原因。
ErrorSubDetails
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|