Scenario:
Since October 2019, Power BI has introduced PowerShell Cmdlets to On-premises data gateway. With this set of cmdlets, we can acquire gateway information and complete some gateway management tasks in PowerShell. And in this blog, I will talk about how to use them to get gateway related information.
Preparation:
As of now, the supported environment of running these Cmdlets is PowerShell 7.0.6 or higher according to official document PowerShell Cmdlets for On-premises data gateway management (Public Preview). If you don’t have proper version of PowerShell, you may install it from PowerShell Github repository.
Cmdlets related to gateway are available in Data Gateway Module on PowerShell Gallery, so we need to install it with this command in PowerShell:
Install-Module –Name DataGateway |
Get gateway information via PowerShell:
Before using a specific cmdlet to get gateway information, we need to connect to Data Gateway Service by the following command with appropriate scope. There are two kinds of scopes supported by cmdlets– individual and organization. With individual scope, only entities related to current user can be accessed. Organization scope can only be used by Global admins and Power BI service admins to access entities of entire tenant.
Connect–DataGatewayServiceAccount |
Now, we can get gateway information with cmdlets in this module. For example, we can get a list of all Azure regions and the default Power BI region of our tenant.
Also, we can get all gateway cluster and data sources that is added to one cluster or all gateway clusters of which the current user is an admin.
Get-DataGatewayCluster | Get-DataGatewayClusterDatasource |
As an admin, if you would like to get all gateway cluster within the organization, run this cmdlet with organization scope.
In addition, we can use cmdlets in this module to get other gateway information such as data source status, data source users and so on. By executing the following command, we can get entire list of cmdlets contained in this module and have a clear knowledge of what kinds of information we can get with it.
Get-Command -Module DataGateway* |
Hope this article can help you understand how to get gateway information via PowerShell.
Author: Caiyun Zheng
Reviewer: Ula Huang, Kerry Wang
Be the first to comment