Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
应用场景: Power BI
自 2019 年 10 月起,Power BI 为企业内部数据网关引入了 PowerShell Cmdlets。通过这组 cmdlet,我们可以在 PowerShell 中获取网关信息并完成一些网关管理任务。在本篇博客中,我将介绍如何使用它们获取网关相关信息。
准备工作:
目前,根据官方文档 —— 用于本地数据网关管理的 PowerShell Cmdlet , 运行这些 Cmdlet 的支持环境为 PowerShell 7.0.6 或更高版本。
如果您没有合适版本的 PowerShell,可以从以下地址安装—— Releases · PowerShell/PowerShell (github.com)。
PowerShell Gallery 的数据网关模块中提供了与网关相关的 Cmdlets,因此我们需要在 PowerShell 中使用此命令安装它:
Install-Module –Name DataGateway
通过 PowerShell 获取网关信息:
在使用特定 cmdlet 获取网关信息之前,我们需要使用以下命令以适当的作用域连接到数据网关服务。cmdlet 支持两种作用域--个人和组织。使用个人范围,只能访问与当前用户相关的实体。组织范围只能由全局管理员和 Power BI 服务管理员使用,以访问整个租户的实体。
Connect-DataGatewayServiceAccount
现在,我们可以使用该模块中的 cmdlets 获取网关信息。例如,我们可以获取所有 Azure 区域和租户的默认 Power BI 区域列表。
Get-DataGatewayRegion
此外,我们还可以获取添加到一个群集的所有网关群集和数据源,或当前用户是管理员的所有网关群集。
Get-DataGatewayCluster
Get-DataGatewayCluster | Get-DataGatewayClusterDatasource
作为管理员,如果想获取组织内的所有网关群集,请在组织范围内运行此 cmdlet。
此外,我们还可以使用该模块中的 cmdlets 获取其他网关信息,如数据源状态、数据源用户等。通过执行下面的命令,我们可以获得该模块中包含的所有 cmdlets 列表,并清楚地知道可以用它获取哪些信息。
Get-Command -Module DataGateway*
希望本文能帮助您了解如何通过 PowerShell 获取网关信息。
作者: Yingying Ruan
审稿人:Kerry Wang & Ula Huang
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.