管理数据源 - Analysis ServicesManage your data source - Analysis Services

安装本地数据网关之后,需要添加可与该网关结合使用的数据源。Once you have installed the On-premises data gateway, you will need to add data sources that can be used with the gateway. 本文将探讨如何使用网关和数据源。This article will look at how to work with gateways and data sources. 你可以使用 Analysis Services 数据源进行计划刷新或实时连接。You can use the Analysis Services data source either for scheduled refresh or for live connections.

下载和安装网关Download and install the gateway

你可以从 Power BI 服务中下载网关。You can download the gateway from the Power BI service. 选择“下载” > “数据网关”,或转到网关下载页Select Downloads > Data Gateway, or by going to the gateway download page.

Analysis Services 实时连接限制Limitations of Analysis Services live connections

你可以使用针对表格或多维实例的实时连接。You can use a live connection against tabular or multidimensional instances.

服务器版本Server version 所需的 SKURequired SKU
2012 SP1 CU4 或更高版本2012 SP1 CU4 or later 商业智能和企业版 SKUBusiness Intelligence and Enterprise SKU
20142014 商业智能和企业版 SKUBusiness Intelligence and Enterprise SKU
20162016 标准 SKU 或更高版本Standard SKU or higher
  • 不支持单元格级别格式和转译功能。Cell level Formatting and translation features are not supported.
  • 操作和命名集不会公开到 Power BI,但你仍然可以连接到包含操作或命名集的多维数据集,并创建视觉对象和报表。Actions and Named Sets are not exposed to Power BI, but you can still connect to multidimensional cubes that also contain Actions or Named sets and create visuals and reports.

添加网关Add a gateway

若要添加网关,只需下载并在你的环境中的服务器上安装该网关即可。To add a gateway, simply download and install the gateway on a server in your environment. 安装网关后,该网关将显示在管理网关下的网关列表中。After you have installed the gateway, it will show in the lists of gateways under Manage gateways.

备注

除非你至少是一个网关的管理员,否则“管理网关”将不会显示。Manage gateways will not show up until you are the admin of at least one gateway. 作为管理员添加网关或安装和配置网关时就会出现这种情况。This can happen either by being added as an admin or you installing and configuring a gateway.

删除网关Remove a gateway

删除网关也将删除该网关下的所有数据源。Removing a gateway will also delete any data sources under that gateway. 此外,还会中断任何仪表板和依赖于这些数据源的报表。This will also break any dashboards and reports that rely on those data sources.

  1. 选择右上角的齿轮图标 > 管理网关Select the gear icon in the upper-right corner > Manage gateways.
  2. “网关”> 删除Gateway > Remove

添加数据源Add a data source

可以通过选择某个网关,然后单击添加数据源,或者转到“网关”> 添加数据源来添加数据源。You can add a data source by either selecting a gateway and click Add data source, or go to Gateway > Add data source.

然后,你可以从列表中选择数据源类型You can then select the Data Source Type from the list. 如果要连接到多维或表格服务器,请选择 Analysis Services。Select Analysis Services if you are connecting to either a Multidimensional or Tabular server.

然后需要填写数据源(包括服务器数据库)的信息。You will then want to fill in the information for the data source which includes the Server and the Database.

网关将使用你输入的用户名密码连接到 Analysis Services 实例。The Username and Password that you enter will be used by the gateway to connect to the Analysis Services instance.

备注

输入的 Windows 帐户必须具有连接到该实例的服务器管理员权限。The Windows account you enter must have Server Administrator permissions for the instance you are connecting to. 如果此帐户的密码设置为过期,且数据源未更新此密码,则用户将遇到连接错误。If this account’s password is set to expire, users could get a connection error if the password isn’t updated for the data source. 有关详细信息,请参阅主要本地数据网关文章,详细了解如何存储凭据For more information, see the main On-premises data gateway article to learn more about how credentials are stored.

所有内容填写完毕之后,可以单击添加You can click Add after you have everything filled in. 现在可以使用此数据源对本地的 Analysis Services 实例进行计划刷新或实时连接。You can now use this data source for scheduled refresh, or live connections, against an Analysis Services instance that is on premises. 如果成功,则会看到连接成功。You will see Connection Successful if it succeeded.

高级设置Advanced settings

可以为你的数据源配置隐私级别。You can configure the privacy level for your data source. 以便控制数据的混搭方式。This controls how data can be mashed up. 这仅适用于计划刷新。This is only used for scheduled refresh. 而不适用于实时连接。It does not apply to live connections. 了解详细信息Learn more

Analysis Services 的用户名Usernames with Analysis Services

每次用户与连接到 Analysis Services 的报表交互时,有效用户名将传递到网关,然后传递到你的本地 Analysis Services 服务器。Each time a user interacts with a report connected to Analysis Services, the effective username is passed to the gateway and then onto your on-premises Analysis Services server. 你用于登录 Power BI 的电子邮件地址,我们会将其作为有效用户传递到 Analysis Services。The email address, that you sign into Power BI with, is what we will pass to Analysis Services as the effective user. 在连接属性 EffectiveUserName 中传递它。This is passed in the connection property EffectiveUserName. 此电子邮件地址应与在本地 Active Directory 域内的定义的 UPN 匹配。This email address should match a defined UPN within the local Active Directory Domain. UPN 是 Active Directory 帐户的属性。The UPN is a property of an Active Directory account. 该 Windows 帐户还需位于 Analysis Services 角色中。That Windows account then needs to be present in an Analysis Services role. 如果在 Active Directory 中找不到匹配项,则登录不会成功。If a match cannot be found, in Active Directory, the login will not be successful. 了解详细信息Learn more

你还可以将 Power BI 登录名与本地目录 UPN 映射。You can also map your Power BI sign in name with a local directory UPN. 了解详细信息Learn more

如何辨别我的 UPN?How do I tell what my UPN is?

你可能不知道你的 UPN 是什么,而且你有可能不是域管理员。You may not know what your UPN is, and you may not be a domain administrator. 你可以从工作站使用以下命令找出你的帐户的 UPN。You can use the following command from your workstation to find out the UPN for your account.

whoami /upn

结果将类似于电子邮件地址,但是这是位于域帐户上的 UPN。The result will look similar to an email address, but this is the UPN that is on your domain account. 如果使用 Analysis Services 数据源进行实时连接,并且此数据源与你用于登录 Power BI 的电子邮件地址不匹配,建议了解一下如何映射用户名If you are using an Analysis Services data source for live connections, and If this doesn't match the email address you sign into Power BI with, you may want to look at how to Map user names.

映射用户名Map user names

可以通过两种不同的方式映射用于 Analysis Services 的用户名:You can map user names for Analysis Services in two different ways:

  1. 手动重映射用户Manual user re-mapping
  2. 执行本地 Active Directory 属性查找,将 AAD UPN 重映射到 Active Directory 用户(AD 查找映射)On-premises Active Directory Property Lookup to remap AAD UPNs to Active Directory users (AD Lookup mapping)

虽然可以使用第二种方法执行手动映射,但这样做既耗时又难以维护;当模式匹配不足以满足需求时(例如,当 AAD 和本地 AD 之间的域名不同时,或当 AAD 和 AD 之间的用户帐户名称不同时),尤为困难。While it's possible to perform manual mapping using the second approach, doing so would be time consuming and difficult to maintain; it's especially difficult when pattern matching doesn't suffice--such as when domain names are different between AAD and on-premises AD, or when user account names are different between AAD and AD. 因此,不建议使用第二种方法进行手动映射。As such, manual mapping with the second approach is not recommended.

我们将在接下来的两个部分中按顺序介绍这两种方法We describe these two approaches, in order, in the following two sections

手动重映射用户名Manual user name re-mapping

对于 Analysis Services 数据源,可以配置自定义用户主体名称 (UPN) 规则。For Analysis Services data sources, you can configure custom User Principal Name (UPN) rules. 当你的 Power BI 服务登录名与本地目录 UPN 不匹配时,这会很有用。This will help you if your Power BI service login names do not match your local directory UPN. 例如,如果使用 john@contoso.com 登录 Power BI,但本地目录 UPN 是 john@contoso.local,可以配置映射规则,将 john@contoso.local 传递到 Analysis Services。For example, if you sign into Power BI with john@contoso.com, but your local directory UPN is john@contoso.local, you can configure a mapping rule to have john@contoso.local passed to Analysis Services.

要访问 UPN 映射屏幕,可以执行以下操作。To get to the UPN Mapping screen, do the following.

  1. 转到齿轮图标,然后选择管理网关Go to the gear icon and select Manage Gateways.
  2. 展开包含 Analysis Services 数据源的网关。Expand the gateway that contains the Analysis Services data source. 或者,如果尚未创建 Analysis Services 数据源,可以在此时创建。Or, if you haven't created the Analysis Services data source, you can do that at this point.
  3. 选择数据源,然后选择用户选项卡。Select the data source and then select the Users tab.
  4. 选择映射用户名Select Map user names.

随即你将看到添加规则和对给定用户进行测试的选项。You will then see options to add rules as well as test for a given user.

备注

可能会无意间更改不想更改的用户。You may inadvertently change a user that you didn't intend to. 例如,如果 Replace(原始值) 是 @contoso.com 且 With(新名称) 是 @contoso.local,则登录名包含 @contoso.com 的所有用户都将被替换为 @contoso.local。For example, if your Replace (original value) is @contoso.com and your With (New name) is @contoso.local, all users with a sign in that contains @contoso.com will then be replaced with @contoso.local. 此外,如果 Replace(原始名称) 是 dave@contoso.com 且 With(新名称) 是 dave@contoso.local,则登录名为 v-dave@contoso.com 的用户将作为 v-dave@contoso.local 发送。Also, if your Replace (Original name) is dave@contoso.com and your With (New name) is dave@contoso.local, a user with the sign in of v-dave@contoso.com would be sent as v-dave@contoso.local.

AD 查找映射AD lookup mapping

若要通过执行本地 AD 属性查找来将 AAD UPN 重映射到 Active Directory 用户,请按照此部分中的步骤操作。To perform on-premises AD property lookup to re-map AAD UPNs to Active Directory users, follow the steps in this section. 首先,我们将介绍这种方法的工作原理。To begin with, let's review how this works.

Power BI 服务中将发生以下事件:In the Power BI service the following occurs:

  • 对于 Power BI AAD 用户对本地 SSAS 服务器执行的每个查询,都会同时传递 UPN 字符串(如 firstName.lastName@contoso.com)For each query by a Power BI AAD user to an on-premises SSAS server, a UPN string is passed along, such as: firstName.lastName@contoso.com

备注

仍会在将用户名字符串发送到本地数据网关之前,应用 Power BI 数据源配置中定义的任何手动 UPN 用户映射。Any manual UPN user mappings defined in the Power BI data source configuration are still applied before sending the user name string to the On-premises data gateway.

在具有可配置自定义用户映射的本地数据网关上,请执行以下操作:On the On-premises data gateway with configurable Custom User Mapping, do the following:

  1. 查找搜索 Active Directory(自动或可配置)Find Active Directory to search (automatic, or configurable)
  2. 根据 Power BI 服务中的传入 UPN 字符串(“firstName.lastName@contoso.com”),查找 AD 人员的属性(如电子邮件地址)。Look up the attribute of the AD Person (such as Email) based on incoming UPN string (“firstName.lastName@contoso.com”) from the Power BI service.
  3. 如果 AD 查找失败,尝试将同时传递的 UPN 用作传递给 SSAS 的 EffectiveUser。If the AD Lookup fails, it attempts to use the passed-along UPN as EffectiveUser to SSAS.
  4. 如果 AD 查找成功,检索相应 AD 人员的 UserPrincipalName。If the AD Lookup succeeds, it retrieves UserPrincipalName of that AD Person.
  5. 它将 UserPrincipalName 电子邮件地址作为 EffectiveUser 传递给 SSAS(如 Alias@corp.on-prem.contoso)It passes the UserPrincipalName email as EffectiveUser to SSAS, such as: Alias@corp.on-prem.contoso

如何将网关配置为执行 AD 查找:How to configure your gateway to perform the AD Lookup:

  1. 下载和安装最新网关Download and install the latest gateway
  2. 在网关中,需要将“本地数据网关服务”更改为使用域帐户(而不是本地服务帐户,否则 AD 查找将无法在运行时正常工作)运行。In the gateway, you need to change the On-premises data gateway service to run with a domain account (instead of a local service account – otherwise the AD lookup won’t work properly at runtime). 你将需要重启网关服务才能使更改生效。You'll need to restart the gateway service for the change to take effect. 转到你的计算机上的网关应用(搜索“本地数据网关”)。Go to the gateway app on your machine (search for “On-premises data gateway”). 为此,请依次转到“服务设置”>“更改服务帐户”。To do this, go to Service settings > Change service account. 请确保自己拥有此网关的恢复密钥,因为需要在同一台计算机上还原它,除非要改为新建网关。Make sure you have the recovery key for this gateway, since you'll need to restore it on the same machine unless you want to create a new gateway instead.
  3. 以管理员身份转到此网关的安装文件夹 C:\Program Files\On-premises data gateway,以确保自己拥有写入权限并编辑下列文件:Navigate to the gateway’s installation folder, C:\Program Files\On-premises data gateway as an administrator, to ensure that you have write-permissions, and edit the following file:

    Microsoft.PowerBI.DataMovement.Pipeline.GatewayCore.dll.config 
    
  4. 根据自己设定的 AD 用户 Active Directory 属性配置,编辑以下两个配置值。Edit the following two configuration values according to your Active Directory attribute configurations of your AD users. 下面显示的配置值只是示例,需要根据自己的 Active Directory 配置指定它们。The configuration values shown below are just examples – you need to specify them based on your Active Directory configuration.

  5. 重启本地数据网关服务才能使配置更改生效。Restart the On-premises data gateway service for the configuration change to take effect.

使用映射规则Working with mapping rules

若要创建映射规则,请输入原始名字新名字的值,然后选择添加To create a mapping rule, enter a value for Original name and New Name and then select Add.

字段Field 说明Description
Replace(原始名称)Replace (Original name) 用于登录 Power BI 的电子邮件地址。The email address that you signed into Power BI with.
With(新名称)With (New Name) 用其替换的值。The value you want to replace it with. 替换的结果将被传递到 Analysis Services 连接的 EffectiveUserName 属性。The result of the replacement is what will be passed to the EffectiveUserName property for the Analysis Services connection.

当在列表中选择某个项时,可以使用 v 形图标选择对其重新排序或删除该条目。When you select an item in the list, you can choose to re-order it by using the chevron icons, or Delete the entry.

使用通配符 (*)Using wildcard (*)

可以将通配符用于“Replace(原始名称)”字符串。You can use a wildcard for your Replace (Original name) string. 它只能用于自身而不能与任何其他字符串部分一起使用。It can only be used on its own and not with any other string part. 这样可以使你获取所有用户,并将单个值传递到数据源。This will allow you to take all users and pass a single value to the data source. 当你希望组织中的所有用户都能够在本地环境中使用相同的用户,那么这非常有用。This is useful when you want all users in your organization to use the same user in your local environment.

测试映射规则Test a mapping rule

通过输入原始名称的值并选择 测试规则,可以验证将被替换的原始名称的值。You can validate what an original name will be replaced with by entering a value for Original name and selecting Test rule.

备注

保存的规则将需要花费几分钟以使服务开始对其进行使用。Rules that are saved will take a few minutes for the service to start using them. 在浏览器中,该规则将立即生效。Within the browser, the rule will work immediately.

映射规则限制Limitations for mapping rules

  • 映射只适用于正在配置的特定数据源。Mapping is for the specific data source that is being configured. 它不是一种全局设置。It is not a global settings. 如果具有多个 Analysis Services 数据源,必须对每个数据源的用户进行映射。If you have multiple Analysis Services data sources, you will have to map the users for each data source.

删除数据源Remove a data source

删除数据源将中断依赖于给定的数据源的所有仪表板或报表。Removing a data source will break any dashboards or reports that rely on the given data source.

要删除数据源,请转到“数据源”>“删除”To remove a data source, go to Data Source > Remove.

管理管理员Manage administrators

在网关的“管理员”选项卡上,可以添加和删除能够管理网关的用户(或安全组)。On the Administrators tab for the gateway, you can add and remove users (or security groups) that can administer the gateway.

管理用户Manage users

在数据源的“用户”选项卡上,可以添加和删除能使用此数据源的用户或安全组。On the Users tab for the data source, you can add, and remove, users, or security groups, that can use this data source.

备注

用户列表仅控制允许发布报表的人员。The users list only controls who are allowed to publish reports. 报表所有者可以创建仪表板(或内容包),并与其他用户共享它们。The report owners can create dashboards, or content packs, and share those with other users.

使用数据源Using the data source

创建数据源后,可通过实时连接或通过计划刷新使用该数据源。After you have created the data source, it will be available to use with either live connections, or through scheduled refresh.

备注

Power BI Desktop 和本地数据网关内的数据源之间的服务器名称和数据库名称必须匹配!Server and database name have to match between Power BI Desktop and the data source within the On-premises data gateway!

数据集和网关内的数据源之间的链接取决于服务器名称和数据库名称。The link between your dataset and the data source within the gateway is based on your server name and database name. 这些名称必须匹配。These have to match. 例如,如果提供了一个服务器名称的 IP 地址,则在 Power BI Desktop 中,你将需要使用网关配置中的数据源 IP 地址。For example, if you supply an IP Address for the server name, within Power BI Desktop, you will need to use the IP Address for the data source within the gateway configuration. 如果使用 SERVER\INSTANCE,则在 Power BI Desktop 中,你将需要使用为网关配置的数据源中的同一地址。If you use SERVER\INSTANCE, in Power BI Desktop, you will need to use the same within the data source configured for the gateway.

此示例适用于实时连接和计划刷新这两种情况。This is the case for both live connections and scheduled refresh.

通过实时连接使用数据源Using the data source with live connections

你需要确保 Power BI Desktop 和为网关配置的数据源之间的服务器名称和数据库名称相互匹配。You will need to make sure the server and database name matches between Power BI Desktop and the configured data source for the gateway. 还需要确保你的用户列在数据源的用户选项卡中,以便发布实时连接数据集。You will also need to make sure your user is listed in the Users tab of the data source in order to publish live connection datasets. 首次导入数据时,需要在 Power BI Desktop 中选择实时连接。The selection, for live connections, occurs within Power BI Desktop when you first import data.

发布之后,应从 Power BI Desktop 或获取数据启动报表。After you publish, either from Power BI Desktop or Get Data, your reports should start working. 在网关中创建数据源之后,可能会花费几分钟时间连接才可用。It may take several minutes, after creating the data source within the gateway, for the connection to be usable.

通过计划刷新使用数据源Using the data source with scheduled refresh

如果你被列于网关内配置的数据源的“用户”选项卡中,并且服务器和数据库名称匹配,则你可将网关视为用于计划刷新的一个选项。If you are listed in the Users tab of the data source configured within the gateway, and the server and database name match, you will see the gateway as an option to use with scheduled refresh.

后续步骤Next steps

本地数据网关On-premises data gateway
本地数据网关 - 深入了解On-premises data gateway - in-depth
本地数据网关故障排除Troubleshooting the On-premises data gateway
更多问题?More questions? 尝试参与 Power BI 社区Try the Power BI Community