Skip to content

Commit

Permalink
fix email lookup when # symbol is present
Browse files Browse the repository at this point in the history
  • Loading branch information
jazuntee committed Mar 24, 2023
1 parent d1dc7a0 commit 8f41487
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/internal/Confirm-ModuleAuthentication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ function Confirm-ModuleAuthentication {
[string[]] $MsGraphScopes = $script:MsGraphScopes
)

## Throw error if no client application exists
if (!$script:ConnectState.ClientApplication) {
$Exception = New-Object System.Security.Authentication.AuthenticationException -ArgumentList ('You must call the Connect-AADAssessment cmdlet before calling any other cmdlets.')
Write-Error -Exception $Exception -Category ([System.Management.Automation.ErrorCategory]::AuthenticationError) -CategoryActivity $MyInvocation.MyCommand -ErrorId 'ConnectAADAssessmentRequired' -ErrorAction Stop
}

## Override scopes on microsoft tenant only
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' }

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

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

## Throw error if no client application exists
if (!$script:ConnectState.ClientApplication) {
$Exception = New-Object System.Security.Authentication.AuthenticationException -ArgumentList ('You must call the Connect-AADAssessment cmdlet before calling any other cmdlets.')
Write-Error -Exception $Exception -Category ([System.Management.Automation.ErrorCategory]::AuthenticationError) -CategoryActivity $MyInvocation.MyCommand -ErrorId 'ConnectAADAssessmentRequired' -ErrorAction Stop
}

## Initialize
#if (!$User) { $User = Get-MsalAccount $script:ConnectState.ClientApplication | Select-Object -First 1 -ExpandProperty Username }
if ($script:AppInsightsRuntimeState.OperationStack.Count -gt 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/Get-MsGraphResults.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ function Get-MsGraphResults {
if ($id) {
## If the URI contains '{0}', then replace it with Unique Id.
if ($uriQueryEndpoint.Uri.AbsoluteUri.Contains('%7B0%7D')) {
$uriQueryEndpointUniqueId = New-Object System.UriBuilder -ArgumentList ([System.Net.WebUtility]::UrlDecode($uriQueryEndpoint.Uri.AbsoluteUri) -f $id)
$uriQueryEndpointUniqueId = New-Object System.UriBuilder -ArgumentList ([System.Net.WebUtility]::UrlDecode($uriQueryEndpoint.Uri.AbsoluteUri) -f [System.Net.WebUtility]::UrlEncode($id))
}
else {
$uriQueryEndpointUniqueId = New-Object System.UriBuilder -ArgumentList $uriQueryEndpoint.Uri
Expand Down

0 comments on commit 8f41487

Please sign in to comment.