OnPremisesDataGatewayHAMgmt.psm1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
If ($PSVersionTable.PSVersion.Major -lt 5) { Write-Host "Current powershell Version is " + $PSVersionTable.PSVersion + ", version 5 is required for this module." return } $script:nullString = (New-Guid).Guid [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Add-Type -TypeDefinition @" public enum LoadBalancingType { Failover = 0, Random = 1 } "@ <# .SYNOPSIS Get default environment. .DESCRIPTION This function get environment from on-premises data gateway configuration. #> Function Get-DefaultEnvironment { $script:adClientId = ($settings | ? { $_.name -eq "AzureADClientID" }).value if ($script:adClientId -eq $null) { $script:adClientId = "ea0616ba-638b-4df5-95b9-636659ae5121" } $script:adAuthority = ($settings | ? { $_.name -eq "AzureADAuthorityAddress" }).value $script:adRedirect = ($settings | ? { $_.name -eq "AzureADRedirectAddress" }).value if ($script:adRedirect -eq $null) { $script:adRedirect = "urn:ietf:wg:oauth:2.0:oob" } $script:adResource = ($settings | ? { $_.name -eq "AzureADResource" }).value $script:gsEndpoint = ($settings | ? { $_.name -eq "GlobalServiceEndpoint" }).value $script:gsBackendUriOverride = ($settings | ? { $_.name -eq "BackendUriOverride" }).value } <# .SYNOPSIS Get email properties. .DESCRIPTION This function setup environment by getting email properties from global service. .PARAMETER EmailAddress The email address. #> Function Get-EmailProperties( [Parameter(Mandatory=$true)] [string]$EmailAddress) { try { $uri = $script:gsEndpoint + "/powerbi/globalservice/v201606/environments/discover?user=" + $EmailAddress $epResponse = Invoke-WebRequest -Uri $uri -Method Post $cloudEnv = $epResponse.Content | ConvertFrom-Json $gateway = $cloudEnv.clients | ? { $_.name -eq "powerbi-gateway" } $pbiBackend = $cloudEnv.services | ? { $_.name -eq "powerbi-backend" } $aadBackend = $cloudEnv.services | ? { $_.name -eq "aad" } $script:adClientId = $gateway.appId $script:adAuthority = $aadBackend.endpoint $script:adRedirect = $gateway.redirectUri $script:adResource = $pbiBackend.resourceId $script:gsEndpoint = $pbiBackend.endpoint return $true } catch { Write-WebRequestFailure return $false } } <# .SYNOPSIS Get response from web exception. .DESCRIPTION This function return response from web exception. .PARAMETER Exception The web exception. #> Function Get-ResponseFromWebException() { If ($_.Exception.Response) { $result = $_.Exception.Response.GetResponseStream() $reader = New-Object System.IO.StreamReader($result) return $reader.ReadToEnd() } } <# .SYNOPSIS Write web request failure. .DESCRIPTION This function write web request failure to host. #> Function Write-WebRequestFailure() { If ($_.ErrorDetails.Message) { try { If (($_.ErrorDetails.Message | ConvertFrom-Json).error.code -eq "TokenExpired") { Write-Warning "Token expired, please login again." return } } catch { # Ignore json convert exception } } Write-Warning $_.Exception.Message $responseBody = Get-ResponseFromWebException If ($responseBody) { Write-Warning $responseBody } } <# .SYNOPSIS Clean up user account. .DESCRIPTION This function clean up token, backend uri and gateway regions. #> Function Remove-OnPremisesDataGatewayUserAccount() { $script:token = $null $script:backendUri = $null $script:selectedBackend = $null $script:allRegions = $null } <# .SYNOPSIS Set up user account. .DESCRIPTION This function read setting from on-premises data gateway configuration, get token from active directory and get backend uri from global service. .PARAMETER EmailAddress The email address. #> Function Set-OnPremisesDataGatewayUserAccount( [Parameter(Mandatory=$true)] [string]$EmailAddress) { $GWDir = "$PSScriptRoot" $configPath = Join-Path "$GWDir" "\Microsoft.PowerBI.DataMovement.GatewayCommon.dll.config" $config = [xml](gc $configPath) $settings = $config.configuration.applicationSettings.'Microsoft.PowerBI.DataMovement.GatewayCommon.Properties.GatewayCommonSettings'.setting $EmailDiscoveryDisable = ($settings | ? { $_.name -eq "EmailDiscoveryDisable" }).value $script:gsEndpoint = ($settings | ? { $_.name -eq "GlobalServiceEndpoint" }).value # Get environment If ($EmailDiscoveryDisable) { Get-DefaultEnvironment } else { $script:gsBackendUriOverride = $null $r = Get-EmailProperties $EmailAddress if (!$r) { Write-Warning "Get email properties from global service failed, will use default environment." Get-DefaultEnvironment } } if ($script:adResource -eq $null -or $script:gsEndpoint -eq $null) { Write-Error "Read AD resource and global service endpoint failed, make sure install gateway first or provide correct install directory!" return } # Get token Add-Type -Path $( join-path $GWDir "Microsoft.IdentityModel.Clients.ActiveDirectory.dll") Add-Type -Path $( join-path $GWDir "Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll") Add-Type -Path $( join-path $GWDir "Microsoft.PowerBI.DataMovement.GatewayRegions.dll") Add-Type -Path $( join-path $GWDir "Newtonsoft.Json.dll") $script:token = Get-Token If (!$script:token) { Write-Warning "Acquire token failed." return } # Get backend uri If ($script:gsBackendUriOverride -ne $null) { $script:backendUri = $script:gsBackendUriOverride } else { $clusterUri = $script:gsEndpoint + "/spglobalservice/GetOrInsertClusterUrisByTenantLocation" $gsResponse = Invoke-Webrequest -Uri $clusterUri -Headers @{Authorization = "Bearer " + $token.AccessToken} -Method Put $gsResponse = $gsResponse.Content | ConvertFrom-Json $script:backendUri = $gsResponse.FixedClusterUri } $script:selectedBackend = $script:backendUri Write-Host -ForegroundColor Green "Current backend is: " $script:selectedBackend } <# .SYNOPSIS Get token from AD. .DESCRIPTION Get token from AD. #> Function Get-Token(){ $context=[Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext]::new($script:adAuthority); $queryParams = "prompt=select_account&msafed=0&login_hint=" + $script:emailAddress $userId = [Microsoft.IdentityModel.Clients.ActiveDirectory.UserIdentifier]::AnyUser return $context.AcquireToken($script:adResource, $script:adClientId, $script:adRedirect, 0, $userId, $queryParams) } <# .SYNOPSIS Get gateway regions from CDN. .DESCRIPTION Get gateway regions from CDN. #> Function Get-Regions() { $script:allRegions = [Microsoft.PowerBI.DataMovement.GatewayRegions.GatewayRegionConfiguration]::GetRegionsAllowedForTenant($script:backendUri) } <# .SYNOPSIS Get gateway regions. .DESCRIPTION Get gateway regions allowed for tenant. #> Function Get-OnPremisesDataGatewayRegions() { If (!$script:selectedBackend) { Write-Warning "Please log in first." return } Get-Regions If ($script:allRegions.Count) { Write-Host -ForegroundColor Green "Available regions:" ForEach ($region in $script:allRegions) { Write-Host $region.Region } } Else { Write-Host -ForegroundColor Green "No region available." } } <# .SYNOPSIS Set gateway region. .DESCRIPTION Set gateway region, will set to default region if this value is $null. .PARAMETER Region The gateway region. #> Function Set-OnPremisesDataGatewayRegion([string]$Region) { If (!$script:selectedBackend) { Write-Warning "Please log in first." return } If ($Region) { $selectedRegion = $script:allRegions | ? { $_.Region -eq $Region } If (!$selectedRegion) { Write-Warning "Invalid region." return } $script:selectedBackend = $selectedRegion.BackendUri.ToString() } Else { $script:selectedBackend = $script:backendUri } Write-Host -ForegroundColor Green "Current backend is: " $script:selectedBackend } <# .SYNOPSIS Get gateway clusters. .DESCRIPTION This function read all gateway clusters owned by the user. #> Function Get-OnPremisesDataGatewayClusters(){ If (!$script:selectedBackend) { Write-Warning "Please log in first." return } try { $gatewayclusters = Invoke-Webrequest -Uri ($script:selectedBackend + "/unifiedgateway/gatewayclusters") -Headers @{Authorization = "Bearer " + $script:token.AccessToken} $gatewayclusters = $gatewayclusters.Content | ConvertFrom-Json ForEach ($cluster in $gatewayclusters) { $cluster.PSObject.Properties.Remove("annotation") $cluster.PSObject.Properties.Remove("publickey") $cluster.PSObject.Properties.Remove("keyword") $cluster.PSObject.Properties.Remove("metadata") $cluster.PSObject.Properties.Remove("gatewayId") $cluster = Set-ClusterLoadBalancingType -ClusterObject $cluster ForEach ($gw in $cluster.gateways) { $gwAnnotation = $gw.gatewayAnnotation | ConvertFrom-Json $gw | Add-Member -MemberType NoteProperty -Name gatewayContactInformation -Value ([System.String]::Join(" ", $gwAnnotation.gatewayContactInformation)) $gw | Add-Member -MemberType NoteProperty -Name gatewayMachine -Value $gwAnnotation.gatewayMachine $gw.PSObject.Properties.Remove("gatewayAnnotation") $gw.PSObject.Properties.Remove("gatewayStaticCapabilities") $gw.PSObject.Properties.Remove("gatewayLoadBalancingSettings") } $cluster.gateways = $cluster.gateways | ConvertTo-Json $cluster.permission = $cluster.permission | ConvertTo-Json } return $gatewayclusters } catch { Write-WebRequestFailure } } <# .SYNOPSIS Get gateway clusters without skipping annotation and static capabilities. .DESCRIPTION This function read all gateway clusters owned by the user. #> Function Get-OnPremisesDataGatewayClustersInternal(){ If (!$script:selectedBackend) { Write-Warning "Please log in first." return } try { $gatewayclusters = Invoke-Webrequest -Uri ($script:selectedBackend + "/unifiedgateway/gatewayclusters") -Headers @{Authorization = "Bearer " + $script:token.AccessToken} $gatewayclusters = $gatewayclusters.Content | ConvertFrom-Json return $gatewayclusters } catch { Write-WebRequestFailure } } <# .SYNOPSIS Get gateway status. .DESCRIPTION This function get gateway status. .PARAMETER ClusterObjectId The cluster object Id. .PARAMETER GatewayObjectId The gateway objectId. #> Function Get-OnPremisesDataGatewayStatus( [Parameter(Mandatory=$true)] [Guid] $ClusterObjectId, [Parameter(Mandatory=$true)] [Guid] $GatewayObjectId){ If (!$script:selectedBackend) { Write-Warning "Please log in first." return } try { $gatewayStatus = Invoke-Webrequest -Uri ($script:selectedBackend + "/unifiedgateway/gatewayclusters/" + $ClusterObjectId + "/gateways/" + $GatewayObjectId + "/status") -Headers @{Authorization = "Bearer " + $script:token.AccessToken} $gatewayStatus = $gatewayStatus.Content | ConvertFrom-Json return $gatewayStatus } catch { $response = Get-ResponseFromWebException $_.Exception | ConvertFrom-Json If ($response.error.code -eq "DM_GWPipeline_Client_GatewayUnreachable") { $gwObj = New-Object -TypeName PSObject -Property ([ordered]@{gatewayStatus = "Unreachable"; gatewayVersion = "Unknown"; gatewayUpgradeState = "Unknown"}) return $gwObj } Else { Write-Warning $_.Exception.Message If ($responseBody) { Write-Warning $responseBody } } } } <# .SYNOPSIS Set gateway info. .DESCRIPTION This function set gateway info and return the updated info, note it won't update the field if it's value is null. .PARAMETER ClusterObjectId The cluster object Id. .PARAMETER GatewayObjectId The gateway objectId. .PARAMETER MemberStatus The cluster member status. .PARAMETER GatewayContactInformation The gateway contact information. .PARAMETER Name The gateway name. #> Function Set-OnPremisesDataGateway( [Parameter(Mandatory=$true)] [Guid] $ClusterObjectId, [Parameter(Mandatory=$true)] [Guid] $GatewayObjectId, [ValidateSet("None","Enabled")] [string] $MemberStatus = $script:nullString, [string] $GatewayContactInformation = $script:nullString, [string] $Name = $script:nullString) { If (!$script:selectedBackend) { Write-Warning "Please log in first." return } $request = @{} If ($MemberStatus -ne $script:nullString) { $request.Add("clusterMemberStatus", $MemberStatus)} If ($Name -ne $script:nullString) { If ($Name.Trim() -eq '') { Write-Warning 'Gateway name cannot be empty.' return } $request.Add("gatewayName",$Name) } If ($GatewayContactInformation -ne $script:nullString) { $annotation = Create-GatewayAnnotation $ClusterObjectId $GatewayObjectId $GatewayContactInformation If ($annotation) { $request.Add("gatewayAnnotation",$annotation) } Else { return } } $json = $request | ConvertTo-Json $uri = $script:selectedBackend + "/unifiedgateway/gatewayclusters/" + $ClusterObjectId + "/gateways/" + $GatewayObjectId try { $response = Invoke-Webrequest -Uri $uri -Headers @{Authorization = "Bearer " + $script:token.AccessToken} -Method Patch -Body $json -ContentType 'application/json' $response = $response.Content | ConvertFrom-Json $response.PSObject.Properties.Remove("gatewayStaticCapabilities") $response.PSObject.Properties.Remove("gatewayStatus") #Extract contact info and machine from annotation $gwAnnotation = $response.gatewayAnnotation | ConvertFrom-Json $response | Add-Member -MemberType NoteProperty -Name gatewayContactInformation -Value ([System.String]::Join(" ", $gwAnnotation.gatewayContactInformation)) $response | Add-Member -MemberType NoteProperty -Name gatewayMachine -Value $gwAnnotation.gatewayMachine $response.PSObject.Properties.Remove("gatewayAnnotation") $response.PSObject.Properties.Remove("gatewayLoadBalancingSettings") return $response } catch { Write-WebRequestFailure } } <# .SYNOPSIS Get gateway. .DESCRIPTION This function get gateway by searching cluster and gateway in all clusters. .PARAMETER ClusterObjectId The cluster object Id. .PARAMETER GatewayObjectId The gateway objectId. #> Function Get-OnPremisesDataGateway( [Parameter(Mandatory=$true)] [Guid] $ClusterObjectId, [Parameter(Mandatory=$true)] [Guid] $GatewayObjectId) { If (!$script:selectedBackend) { Write-Warning "Please log in first." return } $clusters = Get-OnPremisesDataGatewayClustersInternal $cluster = $clusters | Where-Object { $_.objectId -eq $ClusterObjectId } If (!$cluster) { Write-Host -ForegroundColor Red "Invalid cluster object Id" return } $gateway = $cluster.gateways | Where-Object { $_.gatewayObjectId -eq $GatewayObjectId } If (!$gateway) { Write-Host -ForegroundColor Red "Invalid gateway object Id" return } return $gateway } <# .SYNOPSIS Create gateway annotation. .DESCRIPTION This function get gateway annotation then fill with given contact information and machine name. .PARAMETER ClusterObjectId The cluster object Id. .PARAMETER GatewayObjectId The gateway objectId. .PARAMETER GatewayContactInformation The gateway contact information. #> Function Create-GatewayAnnotation( [Parameter(Mandatory=$true)] [Guid] $ClusterObjectId, [Parameter(Mandatory=$true)] [Guid] $GatewayObjectId, [string] $GatewayContactInformation = $script:nullString) { $gateway = Get-OnPremisesDataGateway $ClusterObjectId $GatewayObjectId If ($gateway) { $gwAnnotation = $gateway.gatewayAnnotation | ConvertFrom-Json If ($GatewayContactInformation -ne $script:nullString) { $gwAnnotation.gatewayContactInformation = @($GatewayContactInformation) } return $gwAnnotation | ConvertTo-Json } } <# .SYNOPSIS Delete gateway. .DESCRIPTION This function delete gateway, note it will return success for nonexistent gateway. .PARAMETER ClusterObjectId The cluster object Id. .PARAMETER GatewayObjectId The gateway objectId. #> Function Remove-OnPremisesDataGateway( [Parameter(Mandatory=$true)] [Guid] $ClusterObjectId, [Parameter(Mandatory=$true)] [Guid] $GatewayObjectId) { If (!$script:selectedBackend) { Write-Warning "Please log in first." return } try { $uri = $script:selectedBackend + "/unifiedgateway/gatewayclusters/" + $ClusterObjectId + "/gateways/" + $GatewayObjectId $response = Invoke-Webrequest -Uri $uri -Headers @{Authorization = "Bearer " + $script:token.AccessToken} -Method Delete $response = $response.Content | ConvertFrom-Json return $response } catch { Write-WebRequestFailure } } <# .SYNOPSIS Set gateway cluster info. .DESCRIPTION This function set gateway cluster info and return the updated info, note it won't update the field if it's value is null. .PARAMETER ClusterObjectId The cluster object Id. .PARAMETER Name The cluster name. .PARAMETER Description The cluster description. #> Function Set-OnPremisesDataGatewayCluster( [Parameter(Mandatory=$true)] [Guid] $ClusterObjectId, [string] $Name = $script:nullString, [string] $Description = $script:nullString, [ValidateSet("Failover","Random")] [string] $LoadBalancingType = $script:nullString) { If (!$script:selectedBackend) { Write-Warning "Please log in first." return } $request = @{} If ($Name -ne $script:nullString) { If ($Name.Trim() -eq '') { Write-Warning 'Cluster name cannot be empty.' return } $request.Add("name",$Name) } If ($Description -ne $script:nullString) { $request.Add("description",$Description) } If ($LoadBalancingType -ne $script:nullString) { $loadBalancingClusterSettings = @{} $type = $LoadBalancingType -as [LoadBalancingType] $loadBalancingClusterSettings.Add("selector", [int]$type) $loadBalancingClusterSettingsJson = $loadBalancingClusterSettings | ConvertTo-Json -Compress $request.Add("loadBalancingSettings", $loadBalancingClusterSettingsJson) } $json = $request | ConvertTo-Json $uri = $script:selectedBackend + "/unifiedgateway/gatewayclusters/" + $ClusterObjectId try { $response = Invoke-Webrequest -Uri $uri -Headers @{Authorization = "Bearer " + $script:token.AccessToken} -Method Patch -Body $json -ContentType 'application/json' $response = $response.Content | ConvertFrom-Json $response.PSObject.Properties.Remove("annotation") $response = Set-ClusterLoadBalancingType -ClusterObject $response return $response } catch { Write-WebRequestFailure } } <# .SYNOPSIS Get all gateway info in cluster. .DESCRIPTION This function list all gateways in cluster. .PARAMETER ClusterObjectId The cluster object Id. #> Function Get-OnPremisesDataClusterGateways( [Parameter(Mandatory=$true)][Guid] $ClusterObjectId) { $clusters = Get-OnPremisesDataGatewayClustersInternal If ($clusters -eq $null) { return } $cluster = $clusters | Where-Object { $_.objectId -eq $ClusterObjectId } $gateways = New-Object System.Collections.ArrayList If ($cluster -eq $null) { Write-Host -ForegroundColor Red "Invalid cluster object Id" return } ForEach ($gateway in $cluster.gateways) { $gwStatus = Get-OnPremisesDataGatewayStatus $cluster.objectId $gateway.gatewayObjectId $gwAnnotation = $gateway.gatewayAnnotation | ConvertFrom-Json $gwObj = New-Object PSObject -Property ( [ordered]@{ gatewayId = $gateway.gatewayId; gatewayObjectId = $gateway.gatewayObjectId; gatewayName = $gateway.gatewayName; isAnchorGateway = $gateway.isAnchorGateway; gatewayStatus = $gwStatus.gatewayStatus; gatewayVersion = $gwStatus.gatewayVersion; gatewayUpgradeState = $gwStatus.gatewayUpgradeState; gatewayClusterStatus = $gateway.gatewayClusterStatus; gatewayMachine = $gwAnnotation.gatewayMachine; }) $gateways.Add($gwObj) > $null } return $gateways } <# .SYNOPSIS Set load balancing type for cluster object. .DESCRIPTION This function sets load balancing type for cluster object. .PARAMETER ClusterObject The cluster object. #> Function Set-ClusterLoadBalancingType( [Parameter(Mandatory=$true)][PSObject] $ClusterObject) { $loadBalancingType = [LoadBalancingType]::Failover If ($ClusterObject.loadBalancingSettings) { $loadBalancingSettings = $ClusterObject.loadBalancingSettings | ConvertFrom-Json $type = $loadBalancingSettings.selector -as [LoadBalancingType] If ($type -is [LoadBalancingType]) { $loadBalancingType = $type } } $ClusterObject | Add-Member -Name loadBalancingType -Value $loadBalancingType -MemberType NoteProperty $ClusterObject.PSObject.Properties.Remove("loadBalancingSettings") return $ClusterObject } Set-Alias Login-OnPremisesDataGateway Set-OnPremisesDataGatewayUserAccount Set-Alias Logout-OnPremisesDataGateway Remove-OnPremisesDataGatewayUserAccount |