Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear-MgSecurityCaseEdiscoveryCaseSearchData returning "Token is not a Bearer token" error #3042

Closed
aaronmi opened this issue Nov 28, 2024 · 2 comments
Labels
no-recent-activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close

Comments

@aaronmi
Copy link

aaronmi commented Nov 28, 2024

Describe the bug

Invalid token is generated for USGov environment.

Expected behavior

Performing the operation "Clear-MgSecurityCaseEdiscoveryCaseSearchData_PurgeExpanded" without error.

How to reproduce

  1. Execute "Connect-MgGraph -Scopes "ediscovery.ReadWrite.All" -Environment USGov" and sign in with a user who is a ediscovery case admin.
  2. Execute "Clear-MgSecurityCaseEdiscoveryCaseSearchData -EdiscoveryCaseId "95b08e2e-xxxx-4808-9128-757f2bd38565" -EdiscoverySearchId "b90a7dd8-7935-xxxx-a86a-8603206b82cb"

SDK Version

2.24.0

Latest version known to work for scenario above?

2.24.0

Known Workarounds

No response

Debug output

Click to expand log ```

PS >Connect-MgGraph -Scopes "ediscovery.ReadWrite.All" -Environment USGov
Welcome to Microsoft Graph!

PS > Clear-MgSecurityCaseEdiscoveryCaseSearchData -EdiscoveryCaseId "95b08e2e-xxxx-4808-9128-757f2bd38565" -EdiscoverySearchId "b90a7dd8-7935-xxxx-a86a-8603206b82cb" -Debug

DEBUG: [CmdletBeginProcessing]: - Clear-MgSecurityCaseEdiscoveryCaseSearchData begin processing with parameterSet
'PurgeExpanded'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a

DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope:
'CurrentUser', AppName: 'Microsoft Graph PowerShell'.
DEBUG: [Authentication]: - Scopes: [Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All,
AuditLog.Read.All, Chat.ReadBasic, Chat.ReadWrite, DeviceManagementConfiguration.Read.All,
DeviceManagementManagedDevices.PrivilegedOperations.All, DeviceManagementManagedDevices.Read.All,
DeviceManagementManagedDevices.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All, eDiscovery.ReadWrite.All,
Group.Read.All, Group.ReadWrite.All, GroupMember.Read.All, GroupMember.ReadWrite.All, Mail.ReadWrite, openid,
People.Read, Policy.Read.All, Presence.Read.All, profile, Reports.Read.All, ReportSettings.ReadWrite.All,
RoleManagement.ReadWrite.Directory, Sites.Manage.All, Tasks.ReadWrite, User.Read, User.Read.All, User.ReadWrite.All,
email].

Confirm
Are you sure you want to perform this action?
Performing the operation "Clear-MgSecurityCaseEdiscoveryCaseSearchData_PurgeExpanded" on target "Call remote 'POST
/security/cases/ediscoveryCases/{ediscoveryCase-id}/searches/{ediscoverySearch-id}/microsoft.graph.security.purgeData'
operation".

[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:

POST

Absolute Uri:
https://graph.microsoft.us/v1.0/security/cases/ediscoveryCases/95b08e2e-xxxx-4808-9128-757f2bd38565/searches/b90a7dd8-7935-xxxx-a86a-8603206b82cb/microsoft.graph.security.purgeData

Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache

User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.17763;
en-US),PowerShell/5.1.17763.6530

Accept-Encoding : gzip

SdkVersion : graph-powershell/2.24.0

client-request-id : ea45ce45-ca9b-4c77-9d05-7617f8af9394

Body:
{}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:Unauthorized

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : d3a662b0-9b84-422c-b8f5-e706eb3df63d
client-request-id : 6741a0f9-9811-4604-89ce-931e5bbae444
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"USGov
Texas","Slice":"E","Ring":"4","ScaleUnit":"000","RoleInstance":"SN5NEPFxxxx1Fxx"}}
Cache-Control : no-store, must-revalidate, no-cache, max-age=0
Date : Thu, 28 Nov 2024 01:34:48 GMT

Body:
{
"error": {
"code": "Unauthorized",
"message": "Token is not a Bearer token",
"innerError": {
"date": "2024-11-28T01:34:49",
"request-id": "d3a662b0-9b84-422c-b8f5-e706eb3df63d",
"client-request-id": "6741a0f9-9811-4604-89ce-931e5bbae444"
}
}
}

Confirm
Token is not a Bearer token

Status: 401 (Unauthorized)
ErrorCode: Unauthorized
Date: 2024-11-28T01:34:49

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : d3a662b0-9b84-422c-b8f5-e706eb3df63d
client-request-id : 6741a0f9-9811-4604-89ce-931e5bbae444
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"USGov
Texas","Slice":"E","Ring":"4","ScaleUnit":"000","RoleInstance":"SN5NEPFxxxx1Fxx"}}
Cache-Control : no-store, must-revalidate, no-cache, max-age=0
Date : Thu, 28 Nov 2024 01:34:48 GMT

[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a
Clear-MgSecurityCaseEdiscoveryCaseSearchData : Token is not a Bearer token

Status: 401 (Unauthorized)
ErrorCode: Unauthorized
Date: 2024-11-28T01:34:49

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : d3a662b0-9b84-422c-b8f5-e706eb3df63d
client-request-id : 6741a0f9-9811-4604-89ce-931e5bbae444
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"USGov
Texas","Slice":"E","Ring":"4","ScaleUnit":"000","RoleInstance":"SN5NEPFxxxx1Fxx"}}
Cache-Control : no-store, must-revalidate, no-cache, max-age=0
Date : Thu, 28 Nov 2024 01:34:48 GMT

At line:1 char:1
Clear-MgSecurityCaseEdiscoveryCaseSearchData -EdiscoveryCaseId "95b08 ...
...
CategoryInfo : InvalidOperation: ({ EdiscoveryCas...ionJsonSchema }:<>f__AnonymousType7`4) [Clear-MgSec
urit...a_PurgeExpanded], Exception
FullyQualifiedErrorId : Unauthorized,Microsoft.Graph.PowerShell.Cmdlets.ClearMgSecurityCaseEdiscoveryCaseSearchD
ata_PurgeExpanded
DEBUG: [CmdletEndProcessing]: - Clear-MgSecurityCaseEdiscoveryCaseSearchData end processing.

</details>


### Configuration

_No response_

### Other information

_No response_
@aaronmi aaronmi added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Nov 28, 2024
@timayabi2020 timayabi2020 added Status: Needs Investigation and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Dec 3, 2024
@timayabi2020
Copy link
Contributor

Hi @aaronmi thank you for raising this issue. From the debug information, the service is returning a 401 status code. Meaning that if you consume the API using another tool like https://developer.microsoft.com/en-us/graph/graph-explorer, you'll probably get the same result because this issue is not only unique to Microsoft Graph PowerShell SDK.

For API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it.

@timayabi2020 timayabi2020 added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Status: Needs Investigation type:bug A broken experience labels Dec 3, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-recent-activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close
Projects
None yet
Development

No branches or pull requests

2 participants