您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

使用 Power BI 连接知识存储Connect a knowledge store with Power BI

重要

知识存储目前以公开预览版提供。Knowledge store is currently in public preview. 提供的预览版功能不附带服务级别协议,我们不建议将其用于生产工作负荷。Preview functionality is provided without a service level agreement, and is not recommended for production workloads. 有关详细信息,请参阅 Microsoft Azure 预览版补充使用条款For more information, see Supplemental Terms of Use for Microsoft Azure Previews. REST API 版本 2019-05-06-Preview 提供预览版功能。The REST API version 2019-05-06-Preview provides preview features. 目前提供有限的门户支持,不提供 .NET SDK 支持。There is currently limited portal support, and no .NET SDK support.

本文介绍如何使用 Power BI Desktop 应用中的 Power Query 来连接和浏览知识存储。In this article, learn how to connect to and explore a knowledge store using Power Query in the Power BI Desktop app. 使用模板可以更快地开始操作,也可以从头开始构建自定义仪表板。You can get started faster with templates, or build a custom dashboard from scratch.

示例 Power BI 模板 - 仅限 Azure 门户Sample Power BI template - Azure portal only

创建使用 Azure 门户的知识存储时,可以选择在“导入数据” 向导的第二页下载 Power BI 模板When creating a knowledge store using the Azure portal, you have the option of downloading a Power BI template on the second page of the Import data wizard. 此模板包含多种适用于基于文本的内容的可视化效果,如 WordCloud 和网络导航器。This template gives you several visualizations, such as WordCloud and Network Navigator, for text-based content.

在“添加认知技能”页面单击“获取 Power BI 模板”,从其公共 GitHub 位置检索并下载模板 。Click Get Power BI Template on the Add cognitive skills page to retrieve and download the template from its public GitHub location. 向导会修改模板,以适应数据形状,如在向导中指定的知识存储投影中所捕获的一样。The wizard modifies the template to accommodate the shape of your data, as captured in the knowledge store projections specified in the wizard. 因此,每次运行该向导时,下载的模板会有所不同(假设数据输入和技能选择不同)。For this reason, the template you download will vary each time you run the wizard, assuming different data inputs and skill selections.

示例 Azure 认知搜索 Power BI 模板Sample Azure Cognitive Search Power BI Template

备注

尽管该模板是在向导运行到中途时下载的,但必须等到 Azure 表存储中实际创建了知识存储后,才能使用它。Although the template is downloaded while the wizard is in mid-flight, you'll have to wait until the knowledge store is actually created in Azure Table storage before you can use it.

使用 Power BI 进行连接Connect with Power BI

  1. 启动 Power BI Desktop 并单击“获取数据”。 Start Power BI Desktop and click Get data.

  2. 在“获取数据”窗口中,依次选择“Azure”、“Azure 表存储”。 In the Get Data window, select Azure, and then select Azure Table Storage.

  3. 单击“连接” 。Click Connect.

  4. 对于“帐户名称或 URL”,请输入你的 Azure 存储帐户名称(系统将为你创建完整 URL)。 For Account Name or URL, enter in your Azure Storage account name (the full URL will be created for you).

  5. 如果有提示,请输入存储帐户密钥。If prompted, enter the storage account key.

  6. 选择包含前面演练创建的酒店审核数据的表。Select the tables containing the hotel reviews data created by the previous walkthroughs.

    • 对于门户演练,表名为 hotelReviewsSsDocument 、hotelReviewsSsEntities 、hotelReviewsSsKeyPhrases 和 hotelReviewsSsPages 。For the portal walkthrough, table names are hotelReviewsSsDocument, hotelReviewsSsEntities, hotelReviewsSsKeyPhrases, and hotelReviewsSsPages.

    • 对于 REST 演练,表名为 hotelReviewsDocument 、hotelReviewsPages 、hotelReviewsKeyPhrases 和 hotelReviewsSentiment 。For the REST walkthrough, table names are hotelReviewsDocument, hotelReviewsPages, hotelReviewsKeyPhrases, and hotelReviewsSentiment.

  7. 单击“加载”。 Click Load.

  8. 在顶部功能区中,单击“编辑查询”打开“Power Query 编辑器”。 On the top ribbon, click Edit Queries to open the Power Query Editor.

    打开 Power QueryOpen Power Query

  9. 选择“hotelReviewsSsDocument”,然后删除“PartitionKey”、“RowKey”和“Timestamp”列。 Select hotelReviewsSsDocument, and then remove the PartitionKey, RowKey, and Timestamp columns. 编辑表Edit tables

  10. 单击表右上方带有反向箭头的图标,以展开“内容”。 Click the icon with opposing arrows at the upper right side of the table to expand the Content. 显示列的列表后,选择所有列,并取消选择以“metadata”开头的列。When the list of columns appears, select all columns, and then deselect columns that start with 'metadata'. 单击“确定”显示所选列。 Click OK to show the selected columns.

    编辑表Edit tables

  11. 单击列左上方的 ABC-123 图标,更改以下列的数据类型。Change the data type for the following columns by clicking the ABC-123 icon at the top left of the column.

    • 对于“content.latitude”和“Content.longitude”,请选择“十进制数”。 For content.latitude and Content.longitude, select Decimal Number.
    • 对于“Content.reviews_date”和“Content.reviews_dateAdded”,请选择“日期/时间”。 For Content.reviews_date and Content.reviews_dateAdded, select Date/Time.

    更改数据类型Change data types

  12. 选择“hotelReviewsSsPages”,然后重复步骤 9 和 10 删除列并展开“内容”。 Select hotelReviewsSsPages, and then repeat steps 9 and 10 to delete the columns and expand the Content.

  13. 将“Content.SentimentScore”的数据类型更改为“十进制数”。 Change the data type for Content.SentimentScore to Decimal Number.

  14. 选择“hotelReviewsSsKeyPhrases”,然后重复步骤 9 和 10 删除列并展开“内容”。 Select hotelReviewsSsKeyPhrases and repeat steps 9 and 10 to delete the columns and expand the Content. 对于此表,无需修改数据类型。There are no data type modifications for this table.

  15. 在命令栏上,单击“关闭并应用”。 On the command bar, click Close and Apply.

  16. 单击左侧导航窗格中的“模型”磁贴,验证 Power BI 是否显示了所有三个表之间的关系。Click on the Model tile on the left navigation pane and validate that Power BI shows relationships between all three tables.

    验证关系Validate relationships

  17. 双击每个关系,确保“交叉筛选方向”设置为“双向”。 Double-click each relationship and make sure that the Cross-filter direction is set to Both. 这样,在应用筛选器时,视觉对象将会刷新。This enables your visuals to refresh when a filter is applied.

  18. 单击左侧导航窗格上的“报表”磁贴,以通过可视化浏览数据。Click on the Report tile on the left navigation pane to explore data through visualizations. 对于文本字段,表和卡是有用的可视化效果。For text fields, tables and cards are useful visualizations. 可以从三个表中的每个表中选择字段,以填充表或卡。You can choose fields from each of the three tables to fill in the table or card.

清除Clean up

在自己的订阅中操作时,最好在项目结束时确定是否仍需要已创建的资源。When you're working in your own subscription, it's a good idea at the end of a project to identify whether you still need the resources you created. 持续运行资源可能会产生费用。Resources left running can cost you money. 可以逐个删除资源,也可以删除资源组以删除整个资源集。You can delete resources individually or delete the resource group to delete the entire set of resources.

可以使用左侧导航窗格中的“所有资源”或“资源组”链接 ,在门户中查找和管理资源。You can find and manage resources in the portal, using the All resources or Resource groups link in the left-navigation pane.

如果使用的是免费服务,请记住只能设置三个索引、索引器和数据源。If you are using a free service, remember that you are limited to three indexes, indexers, and data sources. 可以在门户中删除单个项目,以不超出此限制。You can delete individual items in the portal to stay under the limit.

后续步骤Next steps

若要了解如何使用存储资源管理器浏览此知识存储,请参阅以下文章。To learn how to explore this knowledge store using Storage Explorer, see the following article.