授與建立 Azure 企業版訂用帳戶的權限 (舊版)

因為您是 Enterprise 合約 (EA) 上的 Azure 客戶,所以可以授與另一位使用者或服務主體建立由您帳戶付費的訂用帳戶。 在本文中,您將了解如何使用 Azure 角色型存取控制 (Azure RBAC) 來共用建立訂用帳戶的能力,以及稽核訂用帳戶建立的方法。 您對於要共用的帳戶必須具有「擁有者」角色。

注意

注意

建議您使用 Azure Az PowerShell 模組來與 Azure 互動。 請參閱安裝 Azure PowerShell 以開始使用。 若要了解如何移轉至 Az PowerShell 模組,請參閱將 Azure PowerShell 從 AzureRM 移轉至 Az

授予存取權

若要在註冊帳戶下建立訂用帳戶,使用者必須擁有該帳戶的 Azure RBAC 擁有者角色。 您可以遵循下列步驟,將註冊帳戶上的 Azure RBAC 擁有者角色授與使用者或使用者群組:

  1. 針對您想要對其授與存取權的註冊帳戶,取得其物件識別碼

    若要將註冊帳戶的 Azure RBAC 擁有者角色授與其他人,您必須是帳戶擁有者或帳戶的 Azure RBAC 擁有者。

    要求列出您有權存取的所有註冊帳戶:

    GET https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts?api-version=2018-03-01-preview
    

    Azure 會以您可以存取的所有註冊帳戶清單來回應:

    {
      "value": [
        {
          "id": "/providers/Microsoft.Billing/enrollmentAccounts/747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "name": "747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "type": "Microsoft.Billing/enrollmentAccounts",
          "properties": {
            "principalName": "SignUpEngineering@contoso.com"
          }
        },
        {
          "id": "/providers/Microsoft.Billing/enrollmentAccounts/4cd2fcf6-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "name": "4cd2fcf6-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "type": "Microsoft.Billing/enrollmentAccounts",
          "properties": {
            "principalName": "BillingPlatformTeam@contoso.com"
          }
        }
      ]
    }
    

    使用 principalName 屬性來識別您想要對其授與 Azure RBAC 擁有者存取權的帳戶。 複製該帳戶的 name。 例如,如果您想要將 Azure RBAC 擁有者存取權授與 SignUpEngineering@contoso.com 註冊帳戶,您會複製 747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx。 這是註冊帳戶的物件識別碼。 將此值貼在某處,以便您在下一個步驟中作為 enrollmentAccountObjectId 使用。

    使用 principalName 屬性來識別您想要對其授與 Azure RBAC 擁有者存取權的帳戶。 複製該帳戶的 name。 例如,如果您想要將 Azure RBAC 擁有者存取權授與 SignUpEngineering@contoso.com 註冊帳戶,您會複製 747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx。 這是註冊帳戶的物件識別碼。 將此值貼在某處,以便您在下一個步驟中作為 enrollmentAccountObjectId 使用。

  2. 取得您想要授與 Azure RBAC 擁有者角色的使用者或群組的物件 ID

    1. 在 Azure 入口網站中,搜尋 [Microsoft Entra ID]
    2. 如果您想要將存取權授與使用者,請在左側功能表中選取 [使用者]。 若要將存取權授與群組,請選取 [群組]
    3. 選取您想要對其授與 Azure RBAC 擁有者角色的使用者或群組。
    4. 如果您選取了使用者,您會在 [設定檔] 頁面中找到物件識別碼。 如果您選取了群組,物件識別碼會在 [概觀] 頁面中。 選取文字方塊右邊的圖示,以複製 ObjectID。 將此值貼在某處,以便您在下一個步驟中作為 userObjectId 使用。
  3. 將註冊帳戶上的 Azure RBAC 擁有者角色授與使用者或群組

    使用您在前兩個步驟中收集的值,將註冊帳戶上的 Azure RBAC 擁有者角色授與使用者或群組。

    執行下列命令,將 <enrollmentAccountObjectId> 取代為您在第一個步驟中複製的 name (747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx)。 將 <userObjectId> 取代為您從第二個步驟中複製的物件識別碼。

    PUT  https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts/<enrollmentAccountObjectId>/providers/Microsoft.Authorization/roleAssignments/<roleAssignmentGuid>?api-version=2015-07-01
    
    {
      "properties": {
        "roleDefinitionId": "/providers/Microsoft.Billing/enrollmentAccounts/<enrollmentAccountObjectId>/providers/Microsoft.Authorization/roleDefinitions/<ownerRoleDefinitionId>",
        "principalId": "<userObjectId>"
      }
    }
    

    順利在註冊帳戶範圍指派「擁有者」角色之後,Azure 會以角色指派資訊來回應:

    {
      "properties": {
        "roleDefinitionId": "/providers/Microsoft.Billing/enrollmentAccounts/providers/Microsoft.Authorization/roleDefinitions/<ownerRoleDefinitionId>",
        "principalId": "<userObjectId>",
        "scope": "/providers/Microsoft.Billing/enrollmentAccounts/747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "createdOn": "2018-03-05T08:36:26.4014813Z",
        "updatedOn": "2018-03-05T08:36:26.4014813Z",
        "createdBy": "<assignerObjectId>",
        "updatedBy": "<assignerObjectId>"
      },
      "id": "/providers/Microsoft.Billing/enrollmentAccounts/providers/Microsoft.Authorization/roleDefinitions/<ownerRoleDefinitionId>",
      "type": "Microsoft.Authorization/roleAssignments",
      "name": "<roleAssignmentGuid>"
    }
    

使用活動記錄來稽核建立訂用帳戶的人員

若要追蹤透過此 API 建立的訂用帳戶,請使用租用戶活動記錄 API。 目前無法使用 PowerShell、CLI 或 Azure 入口網站來追蹤訂用帳戶的建立。

  1. 以 Microsoft Entra 租用戶的租用戶管理員身分提高存取權,然後將 /providers/microsoft.insights/eventtypes/management 範圍的 [讀者] 角色指派給稽核使用者。 此存取權可以讀者角色、監視參與者角色或自訂角色來取得。

  2. 以稽核使用者身分呼叫租用戶活動記錄 API,以查看訂用帳戶建立活動。 範例:

    GET "/providers/Microsoft.Insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '{greaterThanTimeStamp}' and eventTimestamp le '{lessThanTimestamp}' and eventChannels eq 'Operation' and resourceProvider eq 'Microsoft.Subscription'"
    

若要以便利的方式從命令列呼叫此 API,請嘗試 ARMClient

下一步