-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microsoft.PowerApps.AuthModule.psm1
842 lines (766 loc) · 37.3 KB
/
Microsoft.PowerApps.AuthModule.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
$local:ErrorActionPreference = "Stop"
Add-Type -AssemblyName (Join-Path (Split-Path $script:MyInvocation.MyCommand.Path) "Microsoft.PowerPlatform.Samples.Authentication.dll") -PassThru
function Get-JwtTokenClaims
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[string]$JwtToken
)
$tokenSplit = $JwtToken.Split(".")
$claimsSegment = $tokenSplit[1].Replace(" ", "+").Replace("-", "+").Replace('_', '/');
$mod = $claimsSegment.Length % 4
if ($mod -gt 0)
{
$paddingCount = 4 - $mod;
for ($i = 0; $i -lt $paddingCount; $i++)
{
$claimsSegment += "="
}
}
$decodedClaimsSegment = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($claimsSegment))
return ConvertFrom-Json $decodedClaimsSegment
}
function Add-PowerAppsAccount
{
<#
.SYNOPSIS
Add PowerApps account.
.DESCRIPTION
The Add-PowerAppsAccount cmdlet logins the user or application account and save login information to cache.
Use Get-Help Add-PowerAppsAccount -Examples for more detail.
.PARAMETER Audience
The service audience which is used for login.
.PARAMETER Endpoint
The serivce endpoint which to call. The value can be "prod","preview","tip1", "tip2", "usgov", "dod", or "usgovhigh".
.PARAMETER Username
The user name used for login.
.PARAMETER Password
The password for the user.
.PARAMETER TenantID
The tenant Id of the user or application.
.PARAMETER CertificateThumbprint
The certificate thumbprint of the application.
.PARAMETER ClientSecret
The client secret of the application.
.PARAMETER SecureClientSecret
The secure client secret of the application.
.PARAMETER ApplicationId
The application Id.
.EXAMPLE
Add-PowerAppsAccount
Login to "prod" endpoint.
.EXAMPLE
Add-PowerAppsAccount -Endpoint "prod" -Username "[email protected]" -Password "password"
Login to "prod" for user "[email protected]" by using password "password"
.EXAMPLE
Add-PowerAppsAccount `
-Endpoint "tip1" `
-TenantID 1a1fbe33-1ff4-45b2-90e8-4628a5112345 `
-ClientSecret ABCDE]NO_8:YDLp0J4o-:?=K9cmipuF@ `
-ApplicationId abcdebd6-e62c-4f68-ab74-b046579473ad
Login to "tip1" for application abcdebd6-e62c-4f68-ab74-b046579473ad in tenant 1a1fbe33-1ff4-45b2-90e8-4628a5112345 by using client secret.
.EXAMPLE
Add-PowerAppsAccount `
-Endpoint "tip1" `
-TenantID 1a1fbe33-1ff4-45b2-90e8-4628a5112345 `
-CertificateThumbprint 12345137C1B2D4FED804DB353D9A8A18465C8027 `
-ApplicationId 08627eb8-8eba-4a9a-8c49-548266012345
Login to "tip1" for application 08627eb8-8eba-4a9a-8c49-548266012345 in tenant 1a1fbe33-1ff4-45b2-90e8-4628a5112345 by using certificate.
#>
[CmdletBinding()]
param
(
[string] $Audience = "https://management.azure.com/",
[Parameter(Mandatory = $false)]
[ValidateSet("prod","preview","tip1", "tip2", "usgov", "usgovhigh", "dod")]
[string]$Endpoint = "prod",
[string]$Username = $null,
[SecureString]$Password = $null,
[string]$TenantID = $null,
[string]$CertificateThumbprint = $null,
[string]$ClientSecret = $null,
[SecureString]$SecureClientSecret = $null,
[string]$ApplicationId = "1950a258-227b-4e31-a9cf-717495945fc2"
)
$authBaseUri =
switch ($Endpoint)
{
"usgovhigh" { "https://login.microsoftonline.us" }
"dod" { "https://login.microsoftonline.us" }
default { "https://login.windows.net" }
};
$scopes = @("$Audience/user_impersonation", "https://service.powerapps.com/user_impersonation")
$authResult = [Microsoft.PowerPlatform.CenterOfExcellence.Authentication.ActiveDirectoryAuth]::GetDeviceCodeAccessToken($ApplicationId, "$authBaseUri/common", @("$Audience/user_impersonation"))
$claims = Get-JwtTokenClaims -JwtToken $authResult.AccessToken
#$authContext = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext("$authBaseUri/common");
#$redirectUri = New-Object System.Uri("urn:ietf:wg:oauth:2.0:oob");
<#
if (![string]::IsNullOrWhiteSpace($TenantID) -and ![string]::IsNullOrWhiteSpace($CertificateThumbprint))
{
$AuthUri = "$authBaseUri/$TenantID/oauth2/authorize"
$clientCertificate = Get-Item -Path Cert:\CurrentUser\My\$CertificateThumbprint
$authenticationContext = New-Object -TypeName Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext -ArgumentList $AuthUri
$certificateCredential = New-Object -TypeName Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertionCertificate -ArgumentList ($ApplicationId, $clientCertificate)
$authResult = $authenticationContext.AcquireToken($Audience, $certificateCredential)
$claims = Get-JwtTokenClaims -JwtToken $authResult.AccessToken
}
elseif (![string]::IsNullOrWhiteSpace($ClientSecret) -or $SecureClientSecret -ne $null)
{
$AuthUri = "$authBaseUri/$TenantID/oauth2/authorize"
$authContext = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext($AuthUri)
if ($SecureClientSecret -ne $null)
{
$credential = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential($ApplicationId, $SecureClientSecret)
}
else
{
$credential = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential($ApplicationId, $ClientSecret)
}
$authResult = $authContext.AcquireToken($Audience, $credential)
$claims = Get-JwtTokenClaims -JwtToken $authResult.AccessToken
}
elseif ($Username -ne $null -and $Password -ne $null)
{
$credential = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential($Username, $Password)
$authResult = $authContext.AcquireToken($Audience, $ApplicationId, $credential);
$claims = Get-JwtTokenClaims -JwtToken $authResult.IdToken
}
else {
$authResult = $authContext.AcquireToken($Audience, $ApplicationId, $redirectUri, 1);
$claims = Get-JwtTokenClaims -JwtToken $authResult.IdToken
}
#>
$global:currentSession = @{
loggedIn = $true;
idToken = $authResult.IdToken;
upn = $claims.upn;
tenantId = $claims.tid;
userId = $claims.oid;
applicationId = $claims.appid;
certificateThumbprint = $CertificateThumbprint;
clientSecret = $ClientSecret;
secureClientSecret = $SecureClientSecret;
refreshToken = $authResult.RefreshToken;
expiresOn = (Get-Date).AddHours(8);
resourceTokens = @{
$Audience = @{
accessToken = $authResult.AccessToken;
expiresOn = $authResult.ExpiresOn;
}
"https://service.powerapps.com/" = @{
accessToken = $authResult.AccessToken;
expiresOn = $authResult.ExpiresOn;
}
};
selectedEnvironment = "~default";
authBaseUri = $authBaseUri;
flowEndpoint =
switch ($Endpoint)
{
"prod" { "api.flow.microsoft.com" }
"usgov" { "gov.api.flow.microsoft.us" }
"usgovhigh" { "high.api.flow.microsoft.us" }
"dod" { "api.flow.appsplatform.us" }
"china" { "api.powerautomate.cn" }
"preview" { "preview.api.flow.microsoft.com" }
"tip1" { "tip1.api.flow.microsoft.com"}
"tip2" { "tip2.api.flow.microsoft.com" }
default { throw "Unsupported endpoint '$Endpoint'"}
};
powerAppsEndpoint =
switch ($Endpoint)
{
"prod" { "api.powerapps.com" }
"usgov" { "gov.api.powerapps.us" }
"usgovhigh" { "high.api.powerapps.us" }
"dod" { "api.apps.appsplatform.us" }
"china" { "api.powerapps.cn" }
"preview" { "preview.api.powerapps.com" }
"tip1" { "tip1.api.powerapps.com"}
"tip2" { "tip2.api.powerapps.com" }
default { throw "Unsupported endpoint '$Endpoint'"}
};
bapEndpoint =
switch ($Endpoint)
{
"prod" { "api.bap.microsoft.com" }
"usgov" { "gov.api.bap.microsoft.us" }
"usgovhigh" { "high.api.bap.microsoft.us" }
"dod" { "api.bap.appsplatform.us" }
"china" { "api.bap.partner.microsoftonline.cn" }
"preview" { "preview.api.bap.microsoft.com" }
"tip1" { "tip1.api.bap.microsoft.com"}
"tip2" { "tip2.api.bap.microsoft.com" }
default { throw "Unsupported endpoint '$Endpoint'"}
};
graphEndpoint =
switch ($Endpoint)
{
"prod" { "graph.windows.net" }
"usgov" { "graph.windows.net" }
"usgovhigh" { "graph.windows.net" }
"dod" { "graph.windows.net" }
"china" { "graph.windows.net" }
"preview" { "graph.windows.net" }
"tip1" { "graph.windows.net"}
"tip2" { "graph.windows.net" }
default { throw "Unsupported endpoint '$Endpoint'"}
};
cdsOneEndpoint =
switch ($Endpoint)
{
"prod" { "api.cds.microsoft.com" }
"usgov" { "gov.api.cds.microsoft.us" }
"usgovhigh" { "high.api.cds.microsoft.us" }
"dod" { "dod.gov.api.cds.microsoft.us" }
"preview" { "preview.api.cds.microsoft.com" }
"tip1" { "tip1.api.cds.microsoft.com"}
"tip2" { "tip2.api.cds.microsoft.com" }
default { throw "Unsupported endpoint '$Endpoint'"}
};
};
}
function Test-PowerAppsAccount
{
<#
.SYNOPSIS
Test PowerApps account.
.DESCRIPTION
The Test-PowerAppsAccount cmdlet checks cache and calls Add-PowerAppsAccount if user account is not in cache.
Use Get-Help Test-PowerAppsAccount -Examples for more detail.
.EXAMPLE
Test-PowerAppsAccount
Check if user account is cached.
#>
[CmdletBinding()]
param
(
)
if (-not $global:currentSession)
{
Add-PowerAppsAccount
}
}
function Remove-PowerAppsAccount
{
<#
.SYNOPSIS
Remove PowerApps account.
.DESCRIPTION
The Remove-PowerAppsAccount cmdlet removes the user or application login information from cache.
Use Get-Help Remove-PowerAppsAccount -Examples for more detail.
.EXAMPLE
Remove-PowerAppsAccount
Removes the login information from cache.
#>
[CmdletBinding()]
param
(
)
if ($global:currentSession -ne $null -and $global:currentSession.upn -ne $null)
{
Write-Verbose "Logging out $($global:currentSession.upn)"
}
else
{
Write-Verbose "No user logged in"
}
$global:currentSession = @{
loggedIn = $false;
};
}
function Get-JwtToken
{
<#
.SYNOPSIS
Get user login token.
.DESCRIPTION
The Get-JwtToken cmdlet get the user or application login information from cache. It will call Add-PowerAppsAccount if login token expired.
Use Get-Help Get-JwtToken -Examples for more detail.
.EXAMPLE
Get-JwtToken "https://service.powerapps.com/"
Get login token for PowerApps "prod".
#>
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[string] $Audience
)
if ($global:currentSession -eq $null)
{
$global:currentSession = @{
loggedIn = $false;
};
}
if ($global:currentSession.loggedIn -eq $false -or $global:currentSession.expiresOn -lt (Get-Date))
{
Write-Verbose "No user logged in. Signing the user in before acquiring token."
if (![string]::IsNullOrWhiteSpace($($global:currentSession.certificateThumbprint)))
{
Add-PowerAppsAccount `
-Audience $Audience `
-TenantID $global:currentSession.tenantId `
-CertificateThumbprint $global:currentSession.certificateThumbprint `
-ApplicationId $global:currentSession.applicationId
}
else
{
Add-PowerAppsAccount -Audience $Audience
}
}
if ($global:currentSession.resourceTokens[$Audience] -eq $null -or `
$global:currentSession.resourceTokens[$Audience].accessToken -eq $null -or `
$global:currentSession.resourceTokens[$Audience].expiresOn -eq $null -or `
$global:currentSession.resourceTokens[$Audience].expiresOn -lt (Get-Date))
{
Write-Verbose "Token for $Audience is either missing or expired. Acquiring a new one."
$authBaseUri = $global:currentSession.authBaseUri
$tenantId = $global:currentSession.tenantId
if (![string]::IsNullOrWhiteSpace($global:currentSession.certificateThumbprint))
{
$AuthUri = "$authBaseUri/$tenantId/oauth2/authorize"
$clientCertificate = Get-Item -Path Cert:\CurrentUser\My\$($global:currentSession.certificateThumbprint)
$authenticationContext = New-Object -TypeName Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext -ArgumentList $AuthUri
$certificateCredential = New-Object -TypeName Microsoft.IdentityModel.Clients.ActiveDirectory.ClientAssertionCertificate -ArgumentList ($global:currentSession.applicationId, $clientCertificate)
$authResult = $authenticationContext.AcquireToken($Audience, $certificateCredential)
$global:currentSession.resourceTokens[$Audience] = @{
accessToken = $authResult.AccessToken;
expiresOn = $authResult.ExpiresOn;
}
}
elseif (![string]::IsNullOrWhiteSpace($global:currentSession.clientSecret) -or $global:currentSession.secureClientSecret -ne $null)
{
$AuthUri = "$authBaseUri/$TenantID/oauth2/authorize"
$authContext = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext($AuthUri)
if ($global:currentSession.secureClientSecret -ne $null)
{
$credential = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential($global:currentSession.applicationId, $global:currentSession.secureClientSecret)
}
else
{
$credential = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential($global:currentSession.applicationId, $global:currentSession.clientSecret)
}
$authResult = $authContext.AcquireToken($Audience, $credential)
$global:currentSession.resourceTokens[$Audience] = @{
accessToken = $authResult.AccessToken;
expiresOn = $authResult.ExpiresOn;
}
}
else
{
try
{
$refreshTokenResult = [Microsoft.PowerPlatform.CenterOfExcellence.Authentication.ActiveDirectoryAuth]::GetDeviceCodeAccessToken("1950a258-227b-4e31-a9cf-717495945fc2","$authBaseUri/$tenantId", @("$Audience/user_impersonation"), $Audience)
$global:currentSession.resourceTokens[$Audience] = @{
accessToken = $refreshTokenResult.AccessToken;
expiresOn = $refreshTokenResult.ExpiresOn;
}
}
catch
{
if ($_.Exception.InnerException -and $_.Exception.InnerException.ErrorCode -eq "interaction_required")
{
Write-Verbose "Token for $Audience requires additional claims."
$redirectUri = New-Object System.Uri("urn:ietf:wg:oauth:2.0:oob")
$authResult = $authContext.AcquireToken($Audience, "1950a258-227b-4e31-a9cf-717495945fc2", $redirectUri, 1);
$global:currentSession.resourceTokens[$Audience] = @{
accessToken = $authResult.AccessToken;
expiresOn = $authResult.ExpiresOn;
}
}
else
{
throw
}
}
}
}
return $global:currentSession.resourceTokens[$Audience].accessToken;
}
function Invoke-OAuthDialog
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[string] $ConsentLinkUri
)
Add-Type -AssemblyName System.Windows.Forms
$form = New-Object -TypeName System.Windows.Forms.Form -Property @{ Width=440; Height=640 }
$web = New-Object -TypeName System.Windows.Forms.WebBrowser -Property @{ Width=420; Height=600; Url=$ConsentLinkUri }
$DocComp = {
$Global:uri = $web.Url.AbsoluteUri
if ($Global:uri -match "error=[^&]*|code=[^&]*")
{
$form.Close()
}
}
$web.ScriptErrorsSuppressed = $true
$web.Add_DocumentCompleted($DocComp)
$form.Controls.Add($web)
$form.Add_Shown({$form.Activate()})
$form.ShowDialog() | Out-Null
$queryOutput = [System.Web.HttpUtility]::ParseQueryString($web.Url.Query)
$output = @{}
foreach($key in $queryOutput.Keys)
{
$output["$key"] = $queryOutput[$key]
}
return $output
}
function Get-TenantDetailsFromGraph
{
<#
.SYNOPSIS
Get my organization tenant details from graph.
.DESCRIPTION
The Get-TenantDetailsFromGraph function calls graph and gets my organization tenant details.
Use Get-Help Get-TenantDetailsFromGraph -Examples for more detail.
.PARAMETER GraphApiVersion
Graph version to call. The default version is "1.6".
.EXAMPLE
Get-TenantDetailsFromGraph
Get my organization tenant details from graph by calling graph service in version 1.6.
#>
param
(
[string]$GraphApiVersion = "1.6"
)
process
{
$TenantIdentifier = "myorganization"
$route = "https://{graphEndpoint}/{tenantIdentifier}/tenantDetails`?api-version={graphApiVersion}" `
| ReplaceMacro -Macro "{tenantIdentifier}" -Value $TenantIdentifier `
| ReplaceMacro -Macro "{graphApiVersion}" -Value $GraphApiVersion;
$graphResponse = InvokeApi -Method GET -Route $route
if ($graphResponse.value -ne $null)
{
CreateTenantObject -TenantObj $graphResponse.value
}
else
{
return $graphResponse
}
}
}
#Returns users or groups from Graph
#wrapper on top of https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations & https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/groups-operations
function Get-UsersOrGroupsFromGraph(
)
{
<#
.SYNOPSIS
Returns users or groups from Graph.
.DESCRIPTION
The Get-UsersOrGroupsFromGraph function calls graph and gets users or groups from Graph.
Use Get-Help Get-UsersOrGroupsFromGraph -Examples for more detail.
.PARAMETER ObjectId
User objec Id.
.PARAMETER SearchString
Search string.
.PARAMETER GraphApiVersion
Graph version to call. The default version is "1.6".
.EXAMPLE
Get-UsersOrGroupsFromGraph -ObjectId "12345ba9-805f-43f8-98f7-34fa34aa51a7"
Get user with user object Id "12345ba9-805f-43f8-98f7-34fa34aa51a7" from graph by calling graph service in version 1.6.
.EXAMPLE
Get-UsersOrGroupsFromGraph -SearchString "gfd"
Get users who's UserPrincipalName starting with "gfd" from graph by calling graph service in version 1.6.
#>
[CmdletBinding(DefaultParameterSetName="Id")]
param
(
[Parameter(Mandatory = $true, ParameterSetName = "Id")]
[string]$ObjectId,
[Parameter(Mandatory = $true, ParameterSetName = "Search")]
[string]$SearchString,
[Parameter(Mandatory = $false, ParameterSetName = "Search")]
[Parameter(Mandatory = $false, ParameterSetName = "Id")]
[string]$GraphApiVersion = "1.6"
)
Process
{
if (-not [string]::IsNullOrWhiteSpace($ObjectId))
{
$userGraphUri = "https://graph.windows.net/myorganization/users/{userId}`?&api-version={graphApiVersion}" `
| ReplaceMacro -Macro "{userId}" -Value $ObjectId `
| ReplaceMacro -Macro "{graphApiVersion}" -Value $GraphApiVersion;
$userGraphResponse = InvokeApi -Route $userGraphUri -Method GET
If($userGraphResponse.StatusCode -eq $null)
{
CreateUserObject -UserObj $userGraphResponse
}
$groupsGraphUri = "https://graph.windows.net/myorganization/groups/{groupId}`?api-version={graphApiVersion}" `
| ReplaceMacro -Macro "{groupId}" -Value $ObjectId `
| ReplaceMacro -Macro "{graphApiVersion}" -Value $GraphApiVersion;
$groupGraphResponse = InvokeApi -Route $groupsGraphUri -Method GET
If($groupGraphResponse.StatusCode -eq $null)
{
CreateGroupObject -GroupObj $groupGraphResponse
}
}
else
{
$userFilter = "startswith(userPrincipalName,'$SearchString') or startswith(displayName,'$SearchString')"
$userGraphUri = "https://graph.windows.net/myorganization/users`?`$filter={filter}&api-version={graphApiVersion}" `
| ReplaceMacro -Macro "{filter}" -Value $userFilter `
| ReplaceMacro -Macro "{graphApiVersion}" -Value $GraphApiVersion;
$userGraphResponse = InvokeApi -Route $userGraphUri -Method GET
foreach($user in $userGraphResponse.value)
{
CreateUserObject -UserObj $user
}
$groupFilter = "startswith(displayName,'$SearchString')"
$groupsGraphUri = "https://graph.windows.net/myorganization/groups`?`$filter={filter}&api-version={graphApiVersion}" `
| ReplaceMacro -Macro "{filter}" -Value $groupFilter `
| ReplaceMacro -Macro "{graphApiVersion}" -Value $GraphApiVersion;
$groupsGraphResponse = InvokeApi -Route $groupsGraphUri -Method GET
foreach($group in $groupsGraphResponse.value)
{
CreateGroupObject -GroupObj $group
}
}
}
}
function CreateUserObject
{
param
(
[Parameter(Mandatory = $true)]
[object]$UserObj
)
return New-Object -TypeName PSObject `
| Add-Member -PassThru -MemberType NoteProperty -Name ObjectType -Value $UserObj.objectType `
| Add-Member -PassThru -MemberType NoteProperty -Name ObjectId -Value $UserObj.objectId `
| Add-Member -PassThru -MemberType NoteProperty -Name UserPrincipalName -Value $UserObj.userPrincipalName `
| Add-Member -PassThru -MemberType NoteProperty -Name Mail -Value $UserObj.mail `
| Add-Member -PassThru -MemberType NoteProperty -Name DisplayName -Value $UserObj.displayName `
| Add-Member -PassThru -MemberType NoteProperty -Name AssignedLicenses -Value $UserObj.assignedLicenses `
| Add-Member -PassThru -MemberType NoteProperty -Name AssignedPlans -Value $UserObj.assignedLicenses `
| Add-Member -PassThru -MemberType NoteProperty -Name Internal -Value $UserObj;
}
function CreateGroupObject
{
param
(
[Parameter(Mandatory = $true)]
[object]$GroupObj
)
return New-Object -TypeName PSObject `
| Add-Member -PassThru -MemberType NoteProperty -Name ObjectType -Value $GroupObj.objectType `
| Add-Member -PassThru -MemberType NoteProperty -Name Objectd -Value $GroupObj.objectId `
| Add-Member -PassThru -MemberType NoteProperty -Name Mail -Value $GroupObj.mail `
| Add-Member -PassThru -MemberType NoteProperty -Name DisplayName -Value $GroupObj.displayName `
| Add-Member -PassThru -MemberType NoteProperty -Name Internal -Value $GroupObj;
}
function CreateTenantObject
{
param
(
[Parameter(Mandatory = $true)]
[object]$TenantObj
)
return New-Object -TypeName PSObject `
| Add-Member -PassThru -MemberType NoteProperty -Name ObjectType -Value $TenantObj.objectType `
| Add-Member -PassThru -MemberType NoteProperty -Name TenantId -Value $TenantObj.objectId `
| Add-Member -PassThru -MemberType NoteProperty -Name Country -Value $TenantObj.countryLetterCode `
| Add-Member -PassThru -MemberType NoteProperty -Name Language -Value $TenantObj.preferredLanguage `
| Add-Member -PassThru -MemberType NoteProperty -Name DisplayName -Value $TenantObj.displayName `
| Add-Member -PassThru -MemberType NoteProperty -Name Domains -Value $TenantObj.verifiedDomains `
| Add-Member -PassThru -MemberType NoteProperty -Name Internal -Value $TenantObj;
}
# SIG # Begin signature block
# MIIjeAYJKoZIhvcNAQcCoIIjaTCCI2UCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDGYaVH7ncQCwtw
# 422DBXzEK246pI1AXPYOKzl0kSq2B6CCDYEwggX/MIID56ADAgECAhMzAAAB32vw
# LpKnSrTQAAAAAAHfMA0GCSqGSIb3DQEBCwUAMH4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