在 Power BI Desktop 中連線到 Azure 使用量見解資料Connect to Azure Consumption Insights data in Power BI Desktop

您可以使用 Power BI Desktop 連線至 Azure,並取得有關貴組織 Azure 服務使用量的深入資料。You can use Power BI desktop to connect to Azure and get in-depth data about your organization's Azure service usage. 有了此資料,您就可以建立自訂報表與量值,以便更充分了解並分析您的 Azure 費用。With this data, you can create custom reports and measures to better understand and analyze your Azure spend.


對 Microsoft Azure 使用量見解 (搶鮮版 (Beta)) 的支援有限。There is limited support for the Microsoft Azure Consumption Insights (Beta). 針對新功能,請使用適用於 Power BI 的 Azure 成本管理連接器For new functionality, use the Azure Cost Management connector for Power BI.

與 Azure 使用量見解進行連線Connect with Azure Consumption Insights

Azure 使用量見解可讓您連線至 Azure Enterprise 合約的帳單帳戶。Azure Consumption Insights allows you to connect to Azure Enterprise Agreement billing accounts.

在本節中,您會了解如何使用 Azure 企業版連接器取得您需要遷移的資料。In this section, you learn how to get the data you need migrate using the Azure Enterprise Connector. 您也可以在 ACI (Azure 使用量見解) API 中找到可用的「使用量詳細資料資料行」對應。You'll also find a usage details columns mapping available in the ACI (Azure Consumption Insights) API.

若要成功使用 Azure 使用量見解 連接器,您需要存取 Azure 入口網站企業版的功能。To successfully use the Azure Consumption Insights connector, you need access to the Azure portal Enterprise features.

Power BI Desktop 中使用 Azure 使用量見解 連接器:To use the Azure Consumption Insights connector in Power BI Desktop:

  1. 從 [常用] 功能區選取 [取得資料]。From the Home ribbon, select Get Data.

  2. 從左側的類別中選取 [線上服務]。From the categories on the left, select Online Services.

  3. 選取 [Microsoft Azure 使用量見解 (搶鮮版 (Beta))]。Select Microsoft Azure Consumption Insights (Beta).

  4. 選取 [連接]。Select Connect.

    Microsoft Azure 使用量見解對話方塊的螢幕擷取畫面。

    在出現的對話方塊中,輸入您的 Azure 註冊號碼In the dialog that appears, enter your Azure Enrollment Number.

    輸入 Azure 註冊號碼對話方塊的螢幕擷取畫面。

Azure 企業入口網站以取得註冊號碼的螢幕擷取畫面。

此連接器版本只支援來自 https://ea.azure.com 的 Enterprise 註冊。This connector version only supports enterprise enrollments from https://ea.azure.com. 中國目前不支援註冊。China enrollments aren't currently supported.

接下來,提供連接用的「存取金鑰」。Next, provide your Access key to connect.

輸入存取金鑰以連線到 Microsoft Azure 使用量見解對話方塊的螢幕擷取畫面。

顯示註冊存取金鑰 Azure 企業入口網站的螢幕擷取畫面。

在您提供「存取金鑰」並選取 [連線] 後,隨即會出現一個 [導覽器] 視窗,顯示九個可用的資料表:Once you provide your Access key and select Connect, a Navigator window appears and shows nine available tables:

資料表Table 描述Description
BudgetsBudgets 預算詳細資料,讓您檢視實際成本或現有預算目標的使用情況。Budget details to view actual costs or usage against existing budget targets.
MarketPlaceMarketPlace 用量型 Azure Marketplace 費用。Usage-based Azure Marketplace charges.
PriceSheetsPriceSheets 註冊計量的適用費率。Applicable rates by meter for an enrollment.
RIChargesRICharges 過去 24 個月與您保留執行個體相關聯的費用。Charges associated to your Reserved Instances over the last 24 months.
RIRecommendations_SingleRIRecommendations_Single 根據您單一訂用帳戶上,過去 7、30 或 60 天的使用量趨勢所提供的保留執行個體購買建議。Reserved Instance purchase recommendations based on your single subscription usage trends over the last 7, 30, or 60 days.
RIRecommendations_SharedRIRecommendations_Shared 根據您所有訂用帳戶上,過去 7、30 或 60 天的使用量趨勢所提供保留執行個體購買建議。Reserved Instance purchase recommendations based on your usage trends across all your subscriptions over the last 7, 30 or 60 days.
RIUsageRIUsage 您現有保留執行個體過去一個月的使用詳細資料。Consumption details for your existing Reserved Instances over the last month.
SummariesSummaries 餘額、新購買、Azure Marketplace 服務費用、調整和超額費用的每月摘要。A monthly summary for balances, new purchases, Azure Marketplace service charges, adjustments, and overage charges.
UsageDetailsUsageDetails 取用量明細和估計註冊費用。A consumed quantities breakdown and estimated enrollment charges.

您可以選取任何資料表旁邊的核取方塊,以便查看預覽。You can select a checkbox beside any table to see a preview. 您可以藉由核取名稱旁邊的方塊,選取一或多個資料表,然後選擇 [載入]。You can select one or more tables by checking the box beside their name, then select Load.

顯示所有可用資料表 [導覽] 對話方塊的螢幕擷取畫面。


SummaryPriceSheet 資料表只可供註冊層級 API 金鑰之用。The Summary and PriceSheet tables are only available for the enrollment-level API Key. 此外,這些資料表中的資料預設具有目前月份的 UsagePriceSheet 資料。Also, the data in these tables has, by default, the current month's data for Usage and PriceSheet. SummaryMarketPlace 資料表不受限於目前月份。The Summary and MarketPlace tables are not constrained to the current month.

當您選取 [載入] 時,資料會載入 Power BI DesktopWhen you select Load, the data is loaded into Power BI Desktop.


您選取的資料載入後,可以在 [欄位] 窗格看到您所選取的資料表和欄位。Once the data you selected is loaded, the tables and fields you selected can be seen in the Fields pane.

從 [導覽] 視窗載入資料表後欄位窗格的螢幕擷取畫面。

使用 Azure 使用深入解析Using Azure Consumption Insights

若要使用 Azure 使用量見解 連接器,您可以存取 Azure 入口網站企業版的功能。To use the Azure Consumption Insights connector, you access to the Azure portal Enterprise features.

使用 Azure 使用量見解 連接器成功載入資料後,您可以使用 [查詢編輯器] 建立您自己的自訂量值和資料行。Once you successfully load data using the Azure Consumption Insights connector, you can create your own custom measures and columns using Query Editor. 您也可以建立視覺效果、報表和儀表板,以在 Power BI 服務 中共用。You can also create visuals, reports, and dashboards for sharing in the Power BI service.

使用空白查詢,您可以擷取範例 Azure 自訂查詢集合。With a blank query, you can retrieve a sample Azure custom queries collection. 您可以透過兩種方式進行此種擷取:There are two ways you can do this retrieval:

Power BI Desktop 中:In Power BI Desktop:

  1. 選取 [常用] 功能區Select the Home ribbon
  2. 選取 [取得資料] > [空白查詢]Select Get Data > Blank Query

或者,在 [查詢編輯器] 中:Or, in Query Editor:

  1. 在左側的 [查詢] 窗格中以滑鼠右鍵按一下Right-click in the left Queries pane
  2. 在出現的功能表中選取 [新查詢] > [空白查詢]Select New Query > Blank Query from the menu that appears

在 [公式列] 中,鍵入: = MicrosoftAzureConsumptionInsights.ContentsIn the Formula bar, type: = MicrosoftAzureConsumptionInsights.Contents.

下圖顯示隨即出現的範例集合。The following image shows a samples collection that appears.


使用報表和建立查詢時,您可以:When working with reports and creating queries, you can:

  • 若要定義從目前日期開始的月份數,請使用 numberOfMonthTo define the number of months starting from the current date, use numberOfMonth
    • 使用介於一到 36 之間的值。Use a value between one and 36. 代表您要匯入的月份數 (從目前的日期開始)。Represent the number of months, from the current date, you want to import. 我們建議您不要取得超過 12 個月份的資料。We recommend getting no more than 12 months of data. 這項限制可以避免到達 Power BI 查詢匯入條件約束和資料量閾值。This limit avoids Power BI query import constraints and data volume thresholds.
  • 若要定義歷程記錄時間範圍中的月份期間,請使用 startBillingDataWindowendBillingDataWindowTo define a period of months in a historical time window, use startBillingDataWindow and endBillingDataWindow
  • 請不要與 startBillingDataWindowendBillingDataWindow 一同搭配使用 numberOfMonthDon't use numberOfMonth together with startBillingDataWindow or endBillingDataWindow

從 Azure 企業版連接器遷移Migrate from the Azure Enterprise Connector

有些客戶已使用「Azure 企業版連接器 (搶鮮版 (Beta))」來建立視覺效果。Some customers created visuals using the Azure Enterprise Connector (Beta). 該連接器最終會由 Azure 使用量見解 連接器取代。Eventually, it will be replaced with the Azure Consumption Insights connector. 新的連接器具備的功能和加強功能包括:The new connector has features and enhancements that include:

  • 適用於 Balance SummaryMarketplace Purchases 的其他資料來源Additional data sources available for Balance Summary and Marketplace Purchases
  • 新參數和進階參數,例如 startBillingDataWindowendBillingDataWindowNew and advanced parameters, such as startBillingDataWindow and endBillingDataWindow
  • 較佳的效能和回應Better performance and responsiveness

接下來的步驟會示範如何轉換到 Azure 使用量見解 連接器。The next steps show how to transition to the Azure Consumption Insights connector. 這些步驟可以保留您在建立自訂儀表板或報表時已完成的工作。These steps preserve the work you've already done in creating custom dashboards or reports.

步驟 1:使用新的連接器連線到 AzureStep 1: Connect to Azure using the new connector

第一個步驟是使用本文稍早所詳述的 Azure 使用量見解The first step is use the Azure Consumption Insights connector described in detail earlier in this article. 在此步驟中,從 Power BI Desktop 的 [首頁] 功能區選取 [取得資料] > [空的查詢]In this step, select Get Data > Blank Query from the Home ribbon in Power BI Desktop.

步驟 2:在進階查詢器中建立查詢Step 2: Create a query in Advanced Editor

在 [查詢編輯器] 中,從 [常用] 功能區的 [查詢] 區段選取 [進階編輯器]。In Query Editor, select Advanced Editor from the Home ribbon's Query section. 在出現的 [進階編輯器] 視窗中,輸入此查詢:In the Advanced Editor window that appears, enter this query:

    enrollmentNumber = "100",
    optionalParameters = [ numberOfMonth = 6, dataType="DetailCharges" ],
    data = MicrosoftAzureConsumptionInsights.Contents(enrollmentNumber, optionalParameters)   

在 [進階編輯器] 中建立查詢對話方塊的螢幕擷取畫面。

您需要將 enrollmentNumber 值替換成您的註冊號碼。You'll need to replace the enrollmentNumber value with your enrollment number. 您可以從 Azure 企業版入口網站取得您的號碼。You can get your number from the Azure Enterprise Portal. numberOfMonth 參數是您要傳回幾個月的資料,從目前的日期起算。The numberOfMonth parameter is how many months of data you want going back, from the current dat. 使用零 (0) 代表目前的月份。Use zero (0) for the current month.

在 [進階編輯器] 視窗中選取 [完成] 之後,預覽會重新整理,且資料表中會出現指定月份範圍的資料。Once you select Done in the Advanced Editor window, the preview refreshes and data from the specified month range appears in the table. 選取 [關閉並套用] 然後返回。Select Close & Apply and return.

步驟 3:將量值和自訂資料行移至新的報表Step 3: Move measures and custom columns to the new report

接下來,您必須將任何自訂資料行或您所建立量值移至新的詳細資料資料表。Next, you'll need to move any custom columns or measures you created into the new details table. 以下是步驟。Here are the steps.

  1. 開啟 [記事本] (或其他文字編輯器)。Open Notepad (or another text editor).

  2. 選取您想要移動的量值,並從 [公式] 欄位複製文字且放在 [記事本] 中。Select the measure you want to move, copy the text from the Formula field, and place it in Notepad.


  3. Query1 重新命名為原始的詳細資料資料表名稱。Rename Query1 to the original details table name.

  4. 若要建立新的資料表量值和自訂資料行,請以滑鼠右鍵按一下資料表,然後選擇 [新量值]。To create new table measures and custom columns, right-click on your table, and choose New Measure. 然後,請剪下並貼上您儲存的量值和資料行,直到全部完成為止。Then, cut and paste your stored measures and columns until they're all done.

許多儀表板有其他用來查閱或篩選的資料表,例如日期資料表或用於自訂專案的資料表。Many dashboards have additional tables that are used for lookup or filtering, such as date tables or tables used for custom projects. 重新建立這些關聯性,可以解決大部分剩餘的問題。Reestablishing those relationships resolves most remaining issues. 以下說明如何執行這項作業。Here's how to do it.

  • Power BI Desktop 的 [模型] 索引標籤中,選取 [管理關聯性],以顯示視窗讓您管理模型內的關聯性。In the Modeling tab in Power BI Desktop, select Manage Relationships to bring up a window that lets you manage relationships within the model. 視需要重新連結您的資料表。Relink your tables, as needed.

    [建立關聯性] 對話方塊的螢幕擷取畫面。

步驟 5:驗證視覺效果,然後視需要調整欄位格式設定Step 5: Verify your visuals, and adjust field formatting as needed

此時,大部分的原始視覺效果、資料表和向下切入動作都應該如預期般運作。At this point, most of your original visuals, tables, and drill-down actions should be working as expected. 但是您可能需要進行一些小幅度的調校,來精確地設定外觀及操作的格式。Some minor tweaks may be necessary, however, to precisely format the look and feel. 請花費一些時間查看每個儀表板和視覺效果,確保它們看起來與您想要的外觀一致。Take a bit of time to look over each of your dashboards and visuals to ensure they look how you want them.

使用 Azure 使用深入解析 (ACI) API 來取得使用資料Using the Azure Consumption and Insights (ACI) API to get consumption data

Azure 也提供 Azure 使用深入解析 (ACI) APIAzure also provides the Azure Consumption and Insights (ACI) API. 您可以建立自己的自訂解決方案,來使用 ACI API 收集、報告和視覺化 Azure 使用資訊。You can create your own custom solutions to gathering, reporting, and visualizing Azure consumption information using the ACI API.

在入口網站、連接器和 API 之間對應名稱和使用詳細資料Mapping names and usage details between the portal, the connector, and the API

Azure 入口網站資料行和詳細資料名稱在 API 和連接器中非常相似,雖然並非完全相同。The Azure portal columns and details names are similar in the API and the connector, though not always identical. 為了協助您進行釐清,下表提供對應。To help clarify, the following table provides a mapping. 同時也指出資料行是否已經淘汰。Also indicated is whether the column is obsolete. 如需詳細資訊和字詞定義,請參閱 Azure 計費資料字典For more information, and term definitions, see the Azure billing data dictionary.

ACI 連接器 / ContentPack ColumnNameACI Connector / ContentPack ColumnName ACI API 資料行名稱ACI API Column Name EA 資料行名稱EA Column Name 已淘汰/為了回溯相容性而存在Obsolete / Present for backward compatibility
AccountNameAccountName accountNameaccountName 帳戶名稱Account Name No
AccountIdAccountId accountIdaccountId Yes
AccountOwnerIdAccountOwnerId accountOwnerEmailaccountOwnerEmail AccountOwnerIdAccountOwnerId No
AdditionalInfoAdditionalInfo additionalInfoadditionalInfo AdditionalInfoAdditionalInfo No
AdditionalInfoldAdditionalInfold Yes
Consumed QuantityConsumed Quantity consumedQuantityconsumedQuantity Consumed QuantityConsumed Quantity No
Consumed ServiceConsumed Service consumedServiceconsumedService Consumed ServiceConsumed Service No
ConsumedServiceIdConsumedServiceId consumedServiceIdconsumedServiceId Yes
成本Cost costcost ExtendedCostExtendedCost No
Cost CenterCost Center costCentercostCenter Cost CenterCost Center No
日期Date datedate 日期Date No
Day Day No
DepartmentNameDepartmentName departmentNamedepartmentName 部門名稱Department Name No
DepartmentIDDepartmentID departmentIddepartmentId Yes
Instance IDInstance ID Yes
InstanceIdInstanceId instanceIdinstanceId Instance IDInstance ID No
位置Location Yes
Meter CategoryMeter Category meterCategorymeterCategory Meter CategoryMeter Category No
Meter IDMeter ID Yes
計量名稱Meter Name meterNamemeterName 計量名稱Meter Name No
Meter RegionMeter Region meterRegionmeterRegion Meter RegionMeter Region No
Meter Sub-CategoryMeter Sub-Category meterSubCategorymeterSubCategory Meter Sub-CategoryMeter Sub-Category No
MeterIdMeterId meterIdmeterId Meter IDMeter ID No
MonthMonth MonthMonth No
產品Product productproduct 產品Product No
ProductIdProductId productIdproductId Yes
資源群組Resource Group resourceGroupresourceGroup 資源群組Resource Group No
Resource LocationResource Location resourceLocationresourceLocation Resource LocationResource Location No
ResourceGroupIdResourceGroupId Yes
ResourceLocationIdResourceLocationId resourceLocationIdresourceLocationId Yes
ResourceRateResourceRate resourceRateresourceRate ResourceRateResourceRate No
ServiceAdministratorIdServiceAdministratorId serviceAdministratorIdserviceAdministratorId ServiceAdministratorIdServiceAdministratorId No
ServiceInfo1ServiceInfo1 serviceInfo1serviceInfo1 ServiceInfo1ServiceInfo1 No
ServiceInfo1IdServiceInfo1Id Yes
ServiceInfo2ServiceInfo2 serviceInfo2serviceInfo2 ServiceInfo2ServiceInfo2 No
ServiceInfo2IdServiceInfo2Id Yes
Store Service IdentifierStore Service Identifier storeServiceIdentifierstoreServiceIdentifier Store Service IdentifierStore Service Identifier No
StoreServiceIdentifierIdStoreServiceIdentifierId Yes
訂用帳戶名稱Subscription Name subscriptionNamesubscriptionName 訂用帳戶名稱Subscription Name No
標籤Tags 標籤tags 標籤Tags No
TagsIdTagsId Yes
Unit Of MeasureUnit Of Measure unitOfMeasureunitOfMeasure Unit Of MeasureUnit Of Measure No
Year Year No
SubscriptionIdSubscriptionId subscriptionIdsubscriptionId SubscriptionIdSubscriptionId Yes
SubscriptionGuidSubscriptionGuid subscriptionGuidsubscriptionGuid SubscriptionGuidSubscriptionGuid No

後續步驟Next steps

您可以使用 Power BI Desktop 連線到許多不同的資料來源。You can connect to many different data sources using Power BI Desktop. 如需詳細資訊,請參閱下列文章:For more information, see the following articles: