Power BI 网关入门Getting started with Power BI gateways

欢迎使用 Power BI Gateway 入门指南。Welcome to the Getting started with Power BI gateways guide. 本文中简短的分步过程可帮助你熟悉网关概念、它的工作原理,以及如何安装、配置和运行你自己的网关。This short walk-through gets you acquainted with what a gateway does, how it works, and how to get your own gateway installed, configured, and running.

网关可以说是一个技术性课题,并且由于每个网络和企业各不相同,因此网关的复杂性较为显著。Gateways can be a technical subject, and since every network and enterprise is different, the complexity of gateways can be significant. 要攻克这种复杂性,我们可以从基础知识开始入手。To keep that complexity at bay, let’s start with the basics.

Power BI 网关的工作原理How Power BI gateways work

网关是一种便于访问驻留在本地专用网络上的数据的软件,方便后续在 Power BI 等云服务中使用这些数据。A gateway is software that facilitates access to data that resides on a private, on-premises network, for subsequent use in a cloud service like Power BI. 这类似于网关守卫侦听连接请求,并仅在用户请求满足特定条件(如是否允许他们使用网关)时才授权访问。It’s like a gatekeeper that listens for connection requests, and grants them only when a users’ requests meet certain criteria (such as whether they’re allowed to use the gateway). 这允许组织将数据库和仓库保留在本地网络,并安全地使用该数据的子集在 Power BI 中创建引人注目的报表和仪表板。This lets organizations leave databases and warehouses on their on-premises networks, yet securely use subsets of that data to create compelling reports and dashboards in Power BI.

此外,网关还能通过加密和压缩经过网关的所有数据,以及用于连接数据源的任何密码来保护访问权限和数据的安全。A gateway also secures access and data by encrypting and compressing all data that passes through it, as well as any passwords used to connect to data sources. 这一切听上去非常简单,但还要考虑许多细节。All this sounds straightforward I’m sure, but there are many details to consider.

有时,你希望有一个自己专用的网关,原因是你可能有一个大型 Excel 工作簿以及三个 SQL 数据库,其中包含多年销售和市场营销运行数据,并且你想要创建一个 Power BI 仪表板以从各个角度显示这些销售情况。Sometimes you want a gateway just for you – maybe you have a big Excel workbook plus three SQL databases with years of running sales and marketing data, and you want to create a Power BI dashboard that shows those sales from every angle. 你是创建报表的唯一人员,这是你的 Excel 工作簿,并且仅由你使用这些数据库来创建 Power BI 报表。You’re the only person who creates reports, it’s your Excel workbook, and only you use those databases to create Power BI reports. 你需要一个仅供个人使用的网关,而不与其他人共享这些数据源。You just need a gateway for your personal use, not to share those data sources with everyone else.

其他情况下,你所在的组织可能具有来自不同供应商(包括 Analysis Services、SAP、Oracle、IBM)的各类数据库以及各种其他数据源,并且你需要很多人访问这些内容,方便他们创建大量报表。Other times, you might be in an organization with all sorts of databases from different vendors, including Analysis Services, SAP, Oracle, IBM, and various other data sources, and you need lots of people to access them, so they can create multitudes of reports. 在这种情况下,你需要一个可以让你配置所有这些源的访问权限的网关,然后需要与组织中的许多人共享。In this case, you need a gateway that lets you configure access to all those sources, and then you need to share it with many people in your organization. 这完全是一种不同的网关。That’s a different kind of gateway altogether.

幸运的是,Power BI 提供了两种网关,分别适用于这两种情况。Fortunately, Power BI offers two gateways, fitting each of those scenarios well. Power BI 提供的这两种网关服务如下所示:These two gateway offerings from Power BI are the following:

  • 本地数据网关(个人模式)– 允许一位用户连接到源,且无法与其他人共享。On-premises data gateway (personal mode) – allows one user to connect to sources, and can’t be shared with others. 只能与 Power BI 协同使用。Can only be used with Power BI.
  • 本地数据网关 – 允许多个用户连接到多个本地数据源,可由 Power BI、PowerApps、Flow 和 Azure 逻辑应用使用,只需安装一个网关即可实现。On-premises data gateway – allows multiple users to connect to multiple on-premises data sources, and can be used by Power BI, PowerApps, Flow, and Azure Logic apps, all with a single gateway installation.

这两种网关执行类似的功能:方便对驻留在本地专用网络上的数据进行访问,从而在 Power BI 等基于云的服务中使用该数据。Both gateways perform a similar function – they facilitate access to data residing on a private on-premises network, so that data can be used in cloud-based services like Power BI. 个人网关只能由一个人使用,并且只能由 Power BI 使用,本地数据网关可由多个用户和多个服务使用。The personal gateway can be used by one person and only by Power BI, the on-premises data gateway can be used by many users, and many services.

正常使用网关有三个步骤或阶段:There are three parts, or stages, to putting a gateway to work:

  • 安装网关Install the gateway
  • 将用户添加到网关(允许他们使用网关)Add users to the gateway (let them use the gateway)
  • 连接到数据源Connect to data sources

此外,使用网关还可以方便你执行其他重要的事项:In addition, using a gateway lets you do something else that can be important:

  • 刷新本地数据,以便使用新数据更新 Power BI 报表Refresh on-premises data, so Power BI reports can be updated with fresh data

刷新数据意味着 Power BI 仪表板和报表的外观会更新并反映最新数据。Refreshing data means your Power BI dashboards and reports look fresh, and reflect the latest data. 因此,当有人查看你使用本地数据创建的报表时,该报表可以显示最新信息,即使是不久前创建的报表也是如此。So when someone views a report you created with on-premises data, that report can use show the latest information, even if you created the report a while ago.

第一个步骤(即安装网关)很容易实现。The first part, installing a gateway, is easy. 此外,还可以很方便地允许用户访问网关,只需将其添加到 Power BI 的对话框中即可。Allowing users to access the gateway is easy too – you just add them in a dialog within Power BI and they’re good. 连接到数据源的操作比较复杂,因为数据源的数量较多,并且每个数据源都有它自己的连接要求和细微差异。Connecting to data sources can get complex, because there are so many data sources and each has its own connection requirements and nuances. 我们将在其他指南中专门介绍此过程,本文着重介绍网关相关步骤。And we’ll handle refresh in another guide, to keep things in this article focused on the gateway.

我们先执行简单的步骤,逐步完成网关安装。So let’s take the easy thing first, and walk through installing a gateway.

安装网关Install the gateway

要安装网关,请打开 Power BI 服务(你可以使用此链接在浏览器中启动 Power BI 服务并登录),然后使用你的 Power BI 帐户登录。To install a gateway, open the Power BI service (you can use this link to launch the Power BI service in your browser, and log on) and log in with your Power BI account. 在 Power BI 服务中,选择右上角的“下载图标”,如下图所示,然后选择“数据网关”。In the Power BI service, select the download icon in the upper right corner, as shown in the following image, and select Data Gateway.

将转到下载页,在该页上单击“下载网关”按钮开始下载。That takes you to a download page, where you click the Download gateway button to initiate the download.

此屏幕简要介绍了网关概念。This screen gives you the ultra-condensed explanation of what a gateway does. 它还提供了几条重要的警告:当你安装网关时,它实际上在你执行安装的计算机上运行。It also provides a couple important warnings – when you install a gateway, it actually runs on the computer on which you perform the installation. 如果该计算机关闭,那么网关也会关闭(因此它在未运行不会工作)。And if that computer is turned off, so is the gateway (so it won’t work when it’s not running). 此外,不推荐在使用无线网络的计算机上安装,而应使用连接到有线网络的计算机进行安装。Also, installing on a computer using a wireless network is not best, so you should use a computer connected to a wired network.

准备就绪后,选择“下一步”继续进行设置。When you’re ready, select Next to continue with the setup.

此处需要决定要安装的网关,是本地网关还是个人网关。Here’s where you decide which gateway you’ll install – on-premises gateway, or a personal gateway. 在本指南中,我们将安装本地数据网关。In this guide, we’ll install the On-premises data gateway.

做决定时请注意以下几点:There are a few things to note at this decision point:

  • 两个网关都需要 64 位 Windows 操作系统。Both gateways require 64-bit Windows operating systems.
  • 网关不能安装在域控制器上。Gateways can’t be installed on a domain controller.
  • 同一台计算机上最多可以安装两个本地数据网关,分别在两个模式(个人和标准)下运行。You can install up to two on-premises data gateways on the same computer, one running in each mode (personal and standard).
  • 在同一台计算机上,不能有多个网关在相同模式下运行。You cannot have more than one gateway running in the same mode on the same computer.
  • 可以在不同计算机上安装多个本地数据网关,并通过同一 Power BI 网关管理界面管理所有这些网关(个人网关除外,见下一注意点)。You can install multiple on-premises data gateways on different computers, and manage them all from the same Power BI gateway management interface (excluding personal, see the following bullet point).
  • 只能为每个 Power BI 用户运行一个个人模式网关。You can only have one personal mode gateway running for each Power BI user. 如果为同一用户安装另一个人模式网关,即使是在其他计算机上,最新安装也会替换现有旧安装。If you install another personal mode gateway for the same user, even on a different computer, the most recent installation replaces the existing previous installation.

选择“下一步”后,将开始安装网关。When we select Next, the gateway installation begins. 你需要指定它的安装位置,通常推荐默认位置。You need to specify where it will be installed, and the default location is usually best.

安装过程很快,过程中会显示一个状态栏。The installation process goes quickly, and you’re provided with a status bar.

即将完成时,你需要确定用于网关的帐户。Once you’re almost complete, you need to identify the account to use with the gateway. 这应该是用于登录 Power BI 的帐户(用户名和密码);网关与你的 Power BI 帐户关联,你可以从 Power BI 服务配置网关。This should be the account (the username and password) you use to log on to Power BI; the gateway is associated with your Power BI account, and you configure gateways from within the Power BI service.

按下图所示登录。You’ll be signed in, as shown in the following image.

登录后,需要创建“恢复密钥”。Once you’re signed in, you need to create a Recovery key. 我们将在另一篇文章中深入讨论这些信息,现在只需要知道你将需要它来恢复或移动网关。We’ll discuss those more in depth in another article, but for now, know that you’ll need it to recover or move your gateway.

所有操作执行完毕后,你将看到一个窗口,显示网关已就绪。When all goes well, you’ll see a window that tells you that your gateway is ready.

这就是本地网关的安装过程。That’s it for the installation of an on-premises gateway. 这个过程确实非常简单。As promised, it was a pretty easy process. 然后,下一步是添加用户添加数据源;你可以在初始配置后首先添加其中一个。The next step, then, is to either add users or add data sources – you can do either first, and add either after your initial configuration.

下一节介绍如何将用户添加到网关,在此之后,我们将讨论下一步,即如何将数据源添加到网关。The next section describes adding users to the gateway, and after that, we’ll discuss where to go next to add data sources to the gateway.

将用户添加到网关Add users to a gateway

安装网关后,我们从 Power BI 服务中管理网关。Now that we have a gateway installed, we manage the gateway from the Power BI service. 若要获取网关的管理屏幕,请在 Power BI 服务中选择右上角的“齿轮”图标,然后选择“管理网关”。To get to the management screen for gateways, in the Power BI service select the Gear icon in the upper-right corner, then select Manage gateways.

在 Power BI 服务画布内将显示一个页面,你可以在其中管理网关。A page inside the Power BI service canvas appears, where you can manage your gateways. 网关设置页如下所示。The Gateway Settings page looks like the following.

如果点击或单击“管理员”,会看到以下管理员的管理页。If you tap or click on Administrators, you see the following administrators’ management page. 请注意,此页仅表示哪些用户可以管理网关,并且网关用户均使用不同页从每个各数据源中进行添加(或删除),我们会在接下来的几个章节中对此进行回顾。Note that this is just which users can administer the gateway, and that users of the gateway are added (or removed) from each individual data source, using a different page – which we review in the next few paragraphs.

在安装和验证(成功连接到)数据源后,它会显示在此“管理网关”屏幕左侧与其关联的网关下,如下图所示。Once you install and validate (successfully connect to) a data source, it shows up under its associated gateway in the left side of this Manage gateways screen, as shown in the following image. 请注意,在右侧窗格中,可以在“数据源设置”和“用户”这两个部分之间进行切换。Notice that in the right pane, there are two sections you can toggle between: Data Source Settings and Users. 紧随其后的屏幕是“数据源设置”部分。The screen directly following is the Data Source Settings section.

选择“用户”后,将显示一个文本框,可以在其中键入你想要授予其对所选数据源访问权限的组织用户。When you select Users, you get a text box into which you can type users from your organization who you want to grant access to the selected data source. 在下面的屏幕中,你可以看到我添加的 Maggie 和 Adam。In the following screen, you can see that I’ve added Maggie and Adam.

当你开始在文本框中键入电子邮件地址时,Power BI 将显示其电子邮件地址与所键入内容相匹配的用户列表,方便你单击名称并将其添加到列表。When you begin typing an email address into the text box, Power BI shows a list of users whose email matches what you’re typing, enabling you to click the name and add them to the list.

你还可以添加电子邮件组(别名),从而允许用户组或个人进行访问。You can also add email groups (aliases) to allow groups of people access, as well as individuals.

选择“添加”后,添加的成员会显示在框中,你还可以根据需要添加更多用户。Once you select Add, the added members show up in the box, and you can add more if you want. 删除用户的操作同样非常简单。Removing users is just as easy. 只需选中用户名称旁边的复选框,然后选择框下面的“删除”按钮。Simply check the checkbox next to their name, and then select the Remove button below the box.

以上就是步骤的全部内容。And that’s all there is to it. 请注意,需要将用户添加到你希望向其授予访问权限的每个数据源。Remember that you need to add users to each data source to which you want to grant access. 每个数据源具有一个单独的用户列表,必须分别将用户添加到每个数据源。Each data source has a separate list of users, and you must add users to each data source separately.

添加数据源Adding data sources

当然,需要添加数据源才能使网关发挥作用。Of course, to make your gateway useful you’ll want to add data sources. 这正是所介绍的 Power BI 网关的复杂之处:有许多不同的数据源可供使用,并且每个数据源都有其自己的要求(通常情况下,它需要有自己要求的驱动程序)。This is where some of the complexity of Power BI gateways is introduced – there are many different data sources available, and each has its own requirements (and often, its own required driver).

在向你介绍另一篇文章之前,我们先来了解如何添加数据源。But before we send you off to another article, here’s a look at how you go about adding a data source. Power BI 服务的“管理网关”页上,选择你想要添加数据源的网关,然后选择页面左上角的“添加数据源”(位于网关列表上方)。While you’re in the Manage gateways page of the Power BI service, select the gateway to which you want to add a data source, and select Add Data Source in the upper-left corner of the page, just above the list of your gateways.

执行此操作时,右侧窗格中会显示“数据源设置”面板,如下图所示。When you do, the Data Source Settings panel appears in the right pane, as shown in the following image. 你可以在此处命名你的数据源(在“数据源名称”文本框中输入),然后从“数据源类型”下拉列表中选择其类型。There, you can name your data source (entered in the Data Source Name text box), and select its type from the Data Source Type drop-down list.

好了,你已成功安装网关,并且已经准备好添加数据源。Okay, you now have a gateway installed, and you’re ready to add data sources. 太棒了!Great! 请参阅下节中的资源,了解有关数据源的信息、有关使用网关的更多详细信息以及其他有用信息。See the resources in the following section for information about data sources, more details about using gateways, and other useful information.

后续步骤Next steps

使用本地数据网关Using the on-premises data gateway
深入了解本地数据网关On-premises data gateway in-depth
本地数据网关(个人模式) 本地数据网关疑难解答On-premises data gateway (personal mode) Troubleshooting the on-premises data gateway

更多问题?More questions? 尝试参与 Power BI 社区Try the Power BI Community