Forum Discussion
Data Gateway PowerShell module issue with `Add-DataGatewayClusterMember` command `-RegionKey` param
Seems like API requests are missing "®ion=westeurope" parameter at the end of URI, or region specific API endpoint is not filtering data (gateways in that case) per region.
PS C:\Users\vagrant> add-datagatewaycluster -RecoveryKey $secureRecoveryKey -Name DataGatewayPoC -OverwriteExistingGateway -RegionKey westeurope -Verbose -Debug
DEBUG: 12:18:57 - Add-DataGatewayCluster begin processing with ParameterSet __AllParameterSets.
DEBUG: 12:18:57 - Cmdlet version: 3000.196.145
VERBOSE: Request Uri: https://api.powerbi.com/v2.0/myorg/me/gatewayRegions
VERBOSE: Status Code: OK (200)
VERBOSE: Request Uri: https://wabi-west-europe-redirect.analysis.windows.net/v2.0/myorg/me/gatewayClusters?$expand=permissions,memberGateways
VERBOSE: Status Code: OK (200)
VERBOSE: Request Uri: https://wabi-west-europe-redirect.analysis.windows.net/unifiedgateway/gateways/CreateGatewayWithApps
VERBOSE: Status Code: OK (200)
DEBUG: Microsoft.PowerBI.DataMovement.ExternalContracts.API.CreateGatewayResponse
DEBUG: 12:19:02 - Add-DataGatewayCluster end processing.
GatewayId GatewayObjectId GatewayName GatewayType
--------- --------------- ----------- -----------
xxxxxxx xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx DataGatewayPoC Resource
PS C:\> Add-DataGatewayClusterMember -RegionKey westeurope -GatewayName "DataGatewayPoC-2" -RecoveryKey $secureRecoveryKey -OverwriteExistingGateway -Debug -Verbose -GatewayClusterId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
DEBUG: 12:19:51 - Add-DataGatewayClusterMember begin processing with ParameterSet __AllParameterSets.
DEBUG: 12:19:51 - Cmdlet version: 3000.196.145
VERBOSE: Request Uri: https://api.powerbi.com/v2.0/myorg/me/gatewayRegions
VERBOSE: Status Code: OK (200)
VERBOSE: Request Uri: https://wabi-west-europe-redirect.analysis.windows.net/v2.0/myorg/me/gatewayClusters?$expand=permissions,memberGateways
VERBOSE: Status Code: OK (200)
Add-DataGatewayClusterMember: Gateway cluster xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx was not found
DEBUG: System.ArgumentException: Gateway cluster xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx was not found
at Microsoft.DataMovement.Powershell.Commands.DataGateway.AddDataGatewayClusterMember.ExecuteCmdletAsync()
at Microsoft.DataMovement.Powershell.Commands.Common.PowerBICmdlet.ProcessRecordAsync()
DEBUG: 12:19:52 - Add-DataGatewayClusterMember end processing.
PS C:\Users\vagrant> get-dataGatewayCluster -RegionKey westeurope -Verbose -Debug
DEBUG: 12:29:37 - Get-DataGatewayCluster begin processing with ParameterSet __AllParameterSets.
DEBUG: 12:29:37 - Cmdlet version: 3000.196.145
VERBOSE: Request Uri: https://api.powerbi.com/v2.0/myorg/me/gatewayClusters?$expand=permissions,memberGateways®ion=westeurope
VERBOSE: Status Code: OK (200)
Id : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Name : DataGatewayPoC
Description :
Permissions : {app-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, app-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
Type : Resource
MemberGateways : {DataGatewayPoC}
Datasources : {}
LoadBalancingSettings :
AllowableOptions : Microsoft.PowerBI.ServiceContracts.Api.ODataDictionary`1[System.Boolean]
StaticCapabilities : 0
MaxPermission : Microsoft.PowerBI.ServiceContracts.Api.Permission
DEBUG: 12:29:38 - Get-DataGatewayCluster end processing.
Hi, mikeeq
Debug logs indicate that the Add-DataGatewayClusterMember command does not region to include this parameter in its API request URI, while the Get-DataGatewayCluster command does.
RegionKey As a temporary workaround, you might consider deploying the gateway in a default region that doesn't require the parameter, as you mentioned, it works fine in this case. Since this Get-DataGatewayCluster command region correctly includes the parameter, you can use it to verify the gateway cluster and its region. Then, try adding cluster members without specifying a region.
This is a potential scripted workaround:
# Get Gateway Cluster Details with RegionKey
$gatewayClusterId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$gatewayCluster = Get-DataGatewayCluster -RegionKey "westeurope" -Verbose -Debug
if ($gatewayCluster) {
Write-Output "Gateway cluster found: $($gatewayCluster.Name) in region $($gatewayCluster.Region)"
} else {
Write-Output "Gateway cluster not found."
}
# Attempt to add a cluster member without RegionKey
try {
Add-DataGatewayClusterMember -GatewayClusterId $gatewayClusterId -GatewayName "DataGatewayPoC-2" -RecoveryKey $secureRecoveryKey -OverwriteExistingGateway -Verbose -Debug
} catch {
Write-Output "Error encountered: $_"
# Log error details for further analysis
}If this workaround doesn't work or you don't want to use it, you can just report the error. Below is a sample template you can use to report a problem:
Subject: Bug Report: Add-DataGatewayClusterMember Command Ignoring -RegionKey Parameter in DataGateway Module
Description:
I am encountering an issue with the Add-DataGatewayClusterMember command in the latest DataGateway PowerShell module (version 3000.196.145). When using the -RegionKey parameter, the command fails to find the specified GatewayClusterId in the region. The -RegionKey parameter works correctly with other commands, such as Get-DataGatewayCluster.
Steps to Reproduce:
Create a Gateway Cluster in the westeurope region.
Attempt to add a cluster member using the Add-DataGatewayClusterMember command with the -RegionKey parameter.
# Add Gateway Cluster
Add-DataGatewayCluster -RecoveryKey $secureRecoveryKey -Name DataGatewayPoC -OverwriteExistingGateway -RegionKey westeurope -Verbose -Debug
# Add Cluster Member
Add-DataGatewayClusterMember -RegionKey westeurope -GatewayName "DataGatewayPoC-2" -RecoveryKey $secureRecoveryKey -OverwriteExistingGateway -Debug -Verbose -GatewayClusterId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"Debug Logs:
# Excerpt from Add-DataGatewayClusterMember debug logs
VERBOSE: Request Uri: https://api.powerbi.com/v2.0/myorg/me/gatewayRegions
VERBOSE: Status Code: OK (200)
VERBOSE: Request Uri: https://wabi-west-europe-redirect.analysis.windows.net/v2.0/myorg/me/gatewayClusters?$expand=permissions,memberGateways
VERBOSE: Status Code: OK (200)
Add-DataGatewayClusterMember: Gateway cluster xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx was not foundExpected Behavior:
The Add-DataGatewayClusterMember command should respect the -RegionKey parameter and correctly find the GatewayClusterId in the specified region.
Actual Behavior:
The command fails with an error message indicating that the GatewayClusterId was not found.
hackcrr
If this post helps, then please consider Accept it as the solution and kudos to this post to help the other members find it more quickly