Recently, with the new release of Data Gateway Automation, we can now install and configure the gateway using PowerShell itself.
In this blog, we are going to see how to use the new PowerShell scripts to install and configure the data gateway and some best practices.
Note: This feature is still in public preview.
The below is the simple script used to install and configure the data gateway.
$Psversion = (Get-Host).Version
if($Psversion.Major -ge 7)
{
if (!(Get-Module "DataGateway")) {
Install-Module -Name DataGateway
}
$securePassword = "" | ConvertTo-SecureString -AsPlainText -Force;
$ApplicationId ="";
$Tenant = "";
$GatewayName = "MyGateway";
$RecoverKey = "Demo@123" | ConvertTo-SecureString -AsPlainText -Force;
$userIDToAddasAdmin = ""
#Gateway Login
Connect-DataGatewayServiceAccount -ApplicationId $ApplicationId -ClientSecret $securePassword -Tenant $Tenant
#Installing Gateway
Install-DataGateway -AcceptConditions
#Configuring Gateway
$GatewayDetails = Add-DataGatewayCluster -Name $GatewayName -RecoveryKey $RecoverKey
#Add User as Admin
Add-DataGatewayClusterUser -GatewayClusterId $GatewayDetails.GatewayObjectId -PrincipalObjectId $userIDToAddasAdmin -AllowedDataSourceTypes $null -Role Admin
}
else{
exit 1
}
Output:
You can also find the above script on GitHub.
You can find the Official PowerShell script here.
- Only PowerShell version 7 and above is supported.
- You can’t create a new data source .
- You can’t restore an existing gateway.
- You can’t upgrade a gateway with this feature, right now the PowerShell script is only applicable for installing DataGateway.
- Adding Gateway Members to newly created cluster is not supported yet.
- The “Add-DataGatewayCluster” script will install the gateway cluster that must be `3000.37.35` (April 2020) or higher gateway version.
- Make sure you have the PowerShell version 7 because these scripts only work with version 7 and above.
- You have to run the script in the PowerShell in Admin mode.
- If you want to overwrite the existing gateway configuration on the local machine and configure a new one, use -OverwriteExistingGateway in “Add-DataGatewayCluster” script.
- By default, the “Add-DataGatewayCluster” script will install the gateway in Power BI default tenant region, if you want to change the region then you have to provide the correct region which you can get from the “Get-DataGatewayRegion” module.
Be the first to comment