OnPremisesDataGatewayMgmt.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
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
$script:nullString = (New-Guid).Guid
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

<#
 .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 GatewayInstallDirectory
 
  The gateway install directory, default install directory will be used if this value is $null.
 
 .PARAMETER EmailAddress
 
  The email address.
#>

Function Set-OnPremisesDataGatewayUserAccount(
    [Parameter(Mandatory=$true)]
    [string]$EmailAddress) {
    $GWDir = $PSScriptRoot

    $configPath = $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:RegionSupport = ($settings | ? { $_.name -eq "RegionSupport" }).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
    }

    If ($script:RegionSupport -ne $true) {
        Write-Warning "Region isn't supported."
        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.PSObject.Properties.Remove("loadBalancingSettings")

            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) {
    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) }

    $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.PSObject.Properties.Remove("loadBalancingSettings")
        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-OnPremisesDataGatewayClusterInfo(
    [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
}

Set-Alias Login-OnPremisesDataGateway Set-OnPremisesDataGatewayUserAccount
Set-Alias Logout-OnPremisesDataGateway Remove-OnPremisesDataGatewayUserAccount
Export-ModuleMember -Function Get-OnPremisesDataGatewayClusters
Export-ModuleMember -Function Get-OnPremisesDataGatewayStatus
Export-ModuleMember -Function Set-OnPremisesDataGateway
Export-ModuleMember -Function Remove-OnPremisesDataGateway
Export-ModuleMember -Function Set-OnPremisesDataGatewayCluster
Export-modulemember -Function Get-OnPremisesDataGatewayRegions
Export-ModuleMember -Function Set-OnPremisesDataGatewayRegion
Export-ModuleMember -Function Set-OnPremisesDataGatewayUserAccount
Export-ModuleMember -Function Remove-OnPremisesDataGatewayUserAccount
Export-ModuleMember -Function Get-OnPremisesDataGatewayClusterInfo
Export-ModuleMember -Alias Login-OnPremisesDataGateway
Export-ModuleMember -Alias Logout-OnPremisesDataGateway
# SIG # Begin signature block
# MIIdeAYJKoZIhvcNAQcCoIIdaTCCHWUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUDxFJN5t8jppGn8gl/meYckIu
# nXOgghhSMIIEwTCCA6mgAwIBAgITMwAAANjkdflFb0j3rgAAAAAA2DANBgkqhkiG
# 9w0BAQUFADB3MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G
# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSEw
# HwYDVQQDExhNaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EwHhcNMTcxMDAyMjI1NzU3
# WhcNMTkwMTAyMjI1NzU3WjCBsTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hp
# bmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jw
# b3JhdGlvbjEMMAoGA1UECxMDQU9DMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEV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