Skip to content

Commit 8f41487

Browse files
committed
fix email lookup when # symbol is present
1 parent d1dc7a0 commit 8f41487

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/internal/Confirm-ModuleAuthentication.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ function Confirm-ModuleAuthentication {
2525
[string[]] $MsGraphScopes = $script:MsGraphScopes
2626
)
2727

28+
## Throw error if no client application exists
29+
if (!$script:ConnectState.ClientApplication) {
30+
$Exception = New-Object System.Security.Authentication.AuthenticationException -ArgumentList ('You must call the Connect-AADAssessment cmdlet before calling any other cmdlets.')
31+
Write-Error -Exception $Exception -Category ([System.Management.Automation.ErrorCategory]::AuthenticationError) -CategoryActivity $MyInvocation.MyCommand -ErrorId 'ConnectAADAssessmentRequired' -ErrorAction Stop
32+
}
33+
2834
## Override scopes on microsoft tenant only
2935
if ($ClientApplication.AppConfig.TenantId -in ('72f988bf-86f1-41af-91ab-2d7cd011db47', 'microsoft.onmicrosoft.com', 'microsoft.com') -and $ClientApplication.ClientId -in ('1b730954-1685-4b74-9bfd-dac224a7b894', '1950a258-227b-4e31-a9cf-717495945fc2', '65df9042-2439-4b70-94ac-6cc892f61d85')) { $MsGraphScopes = '.default' }
3036

@@ -37,12 +43,6 @@ function Confirm-ModuleAuthentication {
3743

3844
if (!$MsGraphScopes.Contains('openid')) { $MsGraphScopes += 'openid' }
3945

40-
## Throw error if no client application exists
41-
if (!$script:ConnectState.ClientApplication) {
42-
$Exception = New-Object System.Security.Authentication.AuthenticationException -ArgumentList ('You must call the Connect-AADAssessment cmdlet before calling any other cmdlets.')
43-
Write-Error -Exception $Exception -Category ([System.Management.Automation.ErrorCategory]::AuthenticationError) -CategoryActivity $MyInvocation.MyCommand -ErrorId 'ConnectAADAssessmentRequired' -ErrorAction Stop
44-
}
45-
4646
## Initialize
4747
#if (!$User) { $User = Get-MsalAccount $script:ConnectState.ClientApplication | Select-Object -First 1 -ExpandProperty Username }
4848
if ($script:AppInsightsRuntimeState.OperationStack.Count -gt 0) {

src/internal/Get-MsGraphResults.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ function Get-MsGraphResults {
545545
if ($id) {
546546
## If the URI contains '{0}', then replace it with Unique Id.
547547
if ($uriQueryEndpoint.Uri.AbsoluteUri.Contains('%7B0%7D')) {
548-
$uriQueryEndpointUniqueId = New-Object System.UriBuilder -ArgumentList ([System.Net.WebUtility]::UrlDecode($uriQueryEndpoint.Uri.AbsoluteUri) -f $id)
548+
$uriQueryEndpointUniqueId = New-Object System.UriBuilder -ArgumentList ([System.Net.WebUtility]::UrlDecode($uriQueryEndpoint.Uri.AbsoluteUri) -f [System.Net.WebUtility]::UrlEncode($id))
549549
}
550550
else {
551551
$uriQueryEndpointUniqueId = New-Object System.UriBuilder -ArgumentList $uriQueryEndpoint.Uri

0 commit comments

Comments
 (0)