يمكنك استخدام واجهات برمجة تطبيقات فوترة Azure من أجل رفع مستوى نفسك برمجيًا لإدارة جميع حسابات الفوترة في دليلك.
البحث عن جميع حسابات الفوترة في الدليل الخاص بك
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts?includeAllOrgs=true&api-version=2020-05-01
تعرض استجابة واجهة برمجة التطبيقات قائمة بحسابات الفوترة في الدليل الخاص بك.
{
"value": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx",
"name": "6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx",
"properties": {
"accountStatus": "Active",
"accountType": "Individual",
"agreementType": "MicrosoftCustomerAgreement",
"billingProfiles": {
"hasMoreResults": false
},
"displayName": "Connie Wilson",
"hasReadAccess": true
},
"type": "Microsoft.Billing/billingAccounts"
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx",
"name": "5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx",
"properties": {
"accountStatus": "Active",
"accountType": "Enterprise",
"agreementType": "MicrosoftCustomerAgreement",
"billingProfiles": {
"hasMoreResults": false
},
"displayName": "Contoso",
"hasReadAccess": true
},
"type": "Microsoft.Billing/billingAccounts"
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/4e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx",
"name": "4e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx",
"properties": {
"accountStatus": "Active",
"accountType": "Individual",
"agreementType": "MicrosoftCustomerAgreement",
"billingProfiles": {
"hasMoreResults": false
},
"displayName": "Tomas Wilson",
"hasReadAccess": true
},
"type": "Microsoft.Billing/billingAccounts"
}
]
}
استخدم خاصية displayName
لحساب الفوترة من أجل تحديد حساب الفوترة الذي تريد رفع الوصول إليه. نسخ name
حساب الفوترة. على سبيل المثال، إذا كنت ترغب في رفع مستوى نفسك كمالك في حساب فوترة كوني ويلسون، فيمكنك نسخ 6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx
. الصق القيمة في مكان ما بحيث يمكنك استخدامها في الخطوة التالية.
قم بالحصول على تعريفات الأدوار المتوفرة لحساب الفوترة
قم بإجراء الطلب التالي، مع استبدال <billingAccountName>
بـ name
المنسوخ في الخطوة الأولى (6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx
).
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/<billingAccountName>/billingRoleDefinitions?api-version=2020-05-01
تعرض استجابة واجهة برمجة التطبيقات قائمة بالأدوار المتاحة لحساب الفوترة الخاص بك.
{
"value": [
{
"id": "/providers/Microsoft.Billing/billingAccounts/6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx/billingRoleDefinitions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"name": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"properties": {
"description": "The Owner role gives the user all permissions including access management on a billing account.",
"permissions": [
{
"actions": [
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1"
]
}
],
"roleName": "Billing account owner"
},
"type": "Microsoft.Billing/billingAccounts/billingRoleDefinitions"
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx/billingRoleDefinitions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"name": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"properties": {
"description": "The Contributor role gives the user all permissions except access management on a billing account.",
"permissions": [
{
"actions": [
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
]
}
],
"roleName": "Billing account contributor"
},
"type": "Microsoft.Billing/billingAccounts/billingRoleDefinitions"
},
{
"id": "/providers/Microsoft.Billing/billingAccounts/6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx/billingRoleDefinitions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"name": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"properties": {
"description": "The Reader role gives the user read permissions to a billing account.",
"permissions": [
{
"actions": [
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
]
}
],
"roleName": "Billing account reader"
},
"type": "Microsoft.Billing/billingAccounts/billingRoleDefinitions"
}
]
}
استخدم الخاصية roleName
لتحديد تعريف دور المالك. قم بنسخ name
لتعريف الدور. على سبيل المثال، من استجابة واجهة برمجة التطبيقات أعلاه، يُمكنك نسخ a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1
. لصق هذه القيمة في مكان ما بحيث يمكنك استخدامه في الخطوة التالية.
أضف نفسك كمالك
قم بإجراء الطلب التالي، مع استبدال <billingAccountName>
بـ name
المنسوخ في الخطوة الأولى (6e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx_xxxx-xx-xx
).
PUT https://management.azure.com/providers/Microsoft.Billing/billingAccounts/<billingAccountName>/createBillingRoleAssignment?api-version=2020-05-01
نص الطلب
من أجل إضافة نفسك كمالك، تحتاج إلى الحصول على معرف العنصر الخاص بك. يمكنك العثور على معرف الكائن إما في صفحة المستخدمين في قسم معرف Microsoft Entra في مدخل Microsoft Azure أو يمكنك استخدام واجهة برمجة تطبيقات Microsoft Graph للحصول على معرف العنصر.
في نص الطلب، استبدل <roleDefinitionName>
بـ name
المنسوخ من الخطوة 2. استبدل <principalId>
بمعرف العنصر الذي حصلت عليه إما من مدخل Microsoft Azure أو من خلال واجهة برمجة تطبيقات Microsoft Graph.
{
"principalId": "<principalId>",
"roleDefinitionId": "<roleDefinitionName>"
}