Skip to content

Commit 7d88add

Browse files
committed
fix confidential client auth on china cloud
1 parent c4c167e commit 7d88add

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Invoke-AADAssessmentDataCollection.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function Invoke-AADAssessmentDataCollection {
184184
Write-AppInsightsTrace ("{0} - Directory Role Assignments" -f $MyInvocation.MyCommand.Name) -SeverityLevel Verbose -IncludeProcessStatistics -OrderedProperties (Get-ReferencedIdCacheDetail $ReferencedIdCache)
185185
Write-Progress -Id 0 -Activity ('Microsoft Azure AD Assessment - {0}' -f $InitialTenantDomain) -Status 'Directory Role Assignments' -PercentComplete 30
186186

187-
if ($script:ConnectState.CloudEnvironment -in 'USGov', 'USGovDoD') {
187+
if ($script:ConnectState.CloudEnvironment -in 'USGov', 'USGovDoD', 'China') {
188188
## MS Graph endpoint roleManagement/directory/roleAssignments must still have filter on Gov tenants
189189
$roleDefinitions | Get-MsGraphResults 'roleManagement/directory/roleAssignments' -Select 'id,directoryScopeId,principalId' -Filter "roleDefinitionId eq '{0}'" -QueryParameters @{ '$expand' = 'roleDefinition($select=id,templateId,displayName)' } `
190190
| Add-AadReferencesToCache -Type roleAssignments -ReferencedIdCache $ReferencedIdCache -PassThru `

src/internal/Confirm-ModuleAuthentication.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function Confirm-ModuleAuthentication {
9393
Write-Warning 'Using a confidential client is non-interactive and requires that the necessary scopes/permissions be added to the application or have permissions on-behalf-of a user.'
9494
$Stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
9595
try {
96-
$MsGraphToken = Get-MsalToken -ConfidentialClientApplication $ClientApplication -Scopes 'https://graph.microsoft.com/.default' -CorrelationId $CorrelationId -Verbose:$false -ErrorAction Stop
96+
$MsGraphToken = Get-MsalToken -ConfidentialClientApplication $ClientApplication -Scopes ([IO.Path]::Combine($script:mapMgEnvironmentToMgEndpoint[$CloudEnvironment], '.default')) -CorrelationId $CorrelationId -Verbose:$false -ErrorAction Stop
9797
}
9898
catch { throw }
9999
finally {

0 commit comments

Comments
 (0)