列出调用方对计费帐户拥有的计费权限。
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions?api-version=2020-05-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
billingAccountName
|
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
|
模拟用户帐户
|
示例
BillingAccountPermissionsList
Sample Request
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions?api-version=2020-05-01
/** Samples for BillingPermissions ListByBillingAccount. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountPermissionsList.json
*/
/**
* Sample code: BillingAccountPermissionsList.
*
* @param manager Entry point to BillingManager.
*/
public static void billingAccountPermissionsList(com.azure.resourcemanager.billing.BillingManager manager) {
manager.billingPermissions().listByBillingAccount("{billingAccountName}", 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 billing_account_permissions_list.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_permissions.list_by_billing_account(
billing_account_name="{billingAccountName}",
)
for item in response:
print(item)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountPermissionsList.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/BillingAccountPermissionsList.json
func ExamplePermissionsClient_NewListByBillingAccountPager() {
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.NewPermissionsClient().NewListByBillingAccountPager("{billingAccountName}", 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.PermissionsListResult = armbilling.PermissionsListResult{
// Value: []*armbilling.PermissionsProperties{
// {
// Actions: []*string{
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000002"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000001"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"),
// to.Ptr("20000000-aaaa-bbbb-cccc-200000000002"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("20000000-aaaa-bbbb-cccc-200000000000"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000008"),
// to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"),
// to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"),
// to.Ptr("30000000-aaaa-bbbb-cccc-200000000001")},
// NotActions: []*string{
// },
// }},
// }
}
}
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 billing permissions the caller has on a billing account.
*
* @summary Lists the billing permissions the caller has on a billing account.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountPermissionsList.json
*/
async function billingAccountPermissionsList() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const billingAccountName = "{billingAccountName}";
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.billingPermissions.listByBillingAccount(billingAccountName)) {
resArray.push(item);
}
console.log(resArray);
}
billingAccountPermissionsList().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": [
{
"actions": [
"10000000-aaaa-bbbb-cccc-200000000006",
"10000000-aaaa-bbbb-cccc-200000000003",
"10000000-aaaa-bbbb-cccc-200000000002",
"10000000-aaaa-bbbb-cccc-200000000001",
"10000000-aaaa-bbbb-cccc-200000000000",
"30000000-aaaa-bbbb-cccc-200000000007",
"30000000-aaaa-bbbb-cccc-200000000004",
"30000000-aaaa-bbbb-cccc-200000000015",
"20000000-aaaa-bbbb-cccc-200000000002",
"30000000-aaaa-bbbb-cccc-200000000009",
"40000000-aaaa-bbbb-cccc-200000000000",
"30000000-aaaa-bbbb-cccc-200000000000",
"20000000-aaaa-bbbb-cccc-200000000000",
"10000000-aaaa-bbbb-cccc-200000000008",
"10000000-aaaa-bbbb-cccc-200000000007",
"40000000-aaaa-bbbb-cccc-200000000008",
"40000000-aaaa-bbbb-cccc-200000000006",
"40000000-aaaa-bbbb-cccc-200000000007",
"30000000-aaaa-bbbb-cccc-200000000010",
"30000000-aaaa-bbbb-cccc-200000000001"
],
"notActions": []
}
]
}
定义
BillingPermissionsListResult
列表计费的结果调用方对计费帐户具有的授权。
BillingPermissionsProperties
调用方对计费帐户的允许操作和不允许的操作集
名称 |
类型 |
说明 |
actions
|
string[]
|
允许调用方执行的操作集。
|
notActions
|
string[]
|
不允许调用方执行的操作集。
|
ErrorDetails
错误的详细信息。
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
details
|
ErrorSubDetails[]
|
错误的子详细信息。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|
ErrorResponse
错误响应指示服务无法处理传入请求。 错误消息中提供了原因。
ErrorSubDetails
名称 |
类型 |
说明 |
code
|
string
|
错误代码。
|
message
|
string
|
指示操作失败原因的错误消息。
|
target
|
string
|
特定错误的目标。
|