Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Remove-MgBetaSecurityAuditLogQuery Does Not Work

オープン
#3,421 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
powershell
領域
api, tooling

調査の方向性

まず New-MgBetaSecurityAuditLogQuery、Get-MgBetaSecurityAuditLogQuery、Remove-MgBetaSecurityAuditLogQuery で失敗を再現し、その後、記録された DELETE /beta/security/auditLog/queries/{auditLogQuery-id} リクエストを調査します。404 の原因が SDK と Microsoft Graph API のどちらにあるかを特定します。既存の監査ログ クエリを正常に削除できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

type:bug
Describe the bug

Using New-MgBetaSecurityAuditLogQuery I can successfully create a query and using Get-MgBetaSecurityAuditLogQuery I can successfully retrieve a query. However, I am unable to Remove this query (or any other query) using Remove-MgBetaSecurityAuditLogQuery.

$query = Get-MgBetaSecurityAuditLogQuery -AuditLogQueryID $Identifier
# this succeeds, and the query object is viewable

Remove-MgBetaSecurityAuditLogQuery, however, fails, when called in any of the following ways:

Remove-MgBetaSecurityAuditLogQuery -AuditLogQueryID $Identifier
Remove-MgBetaSecurityAuditLogQuery -AuditLogQueryID $query.Id

Failure:

Remove-MgBetaSecurityAuditLogQuery_DeleteViaIdentity: {"Message":"No HTTP resource was found that matches the request URI 'https://o365adtsearchapi-na003-aks.eastus.cloudapp.azure.com/security/auditLog/queries('')'.","MessageDetail":"No type was found that matches the controller named 'queries'."}

Status: 404 (NotFound)
ErrorCode: UnknownError
Date: 2025-10-16T16:54:09

Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id :
client-request-id :
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US","Slice":"E","Ring":"5","ScaleUnit":"008","RoleInstance":"BL02EPF0001B4C8"}}
Date : Thu, 16 Oct 2025 16:54:09 GMT

Expected behavior

Remove-MgBetaSecurityAuditLogQuery should be able to be used to remove an existing query.
This seems to be an underlying problem with the API, see https://github.com/microsoftgraph/msgraph-beta-sdk-java/issues/1162

How to reproduce

$NewQuery = New-MgBetaSecurityAuditLogQuery -DisplayName 'Repro' -FilterStartDateTime $(get-date).AddDays(-1) -FilterEndDateTime $(get-date)
$RetrievedQuery = Get-MGBetaSecurityAuditLogQuery -AuditLogQueryID $NewQuery.Id
#attempt to delete the query
Remove-MgBetaSecurityAuditLogQuery -AuditLogQueryID $RetrievedQuery.Id

SDK Version

2.31.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```

$myhash | Remove-MgBetaSecurityAuditLogQuery -Debug
DEBUG: [CmdletBeginProcessing]: - Remove-MgBetaSecurityAuditLogQuery begin processing with parameterSet 'DeleteViaIdentity'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientSecret', ContextScope: 'Process', AppName: 'M365GraphAdmin'.
DEBUG: [Authentication]: - Scopes: [Directory.ReadWrite.All, Sites.FullControl.All, TeamSettings.ReadWrite.All, AuditLogsQuery-Exchange.Read.All, AuditLogsQuery-SharePoint.Read.All, AuditLogsQuery-Entra.Read.All, Sites.ReadWrite.All, AuditLogsQuery.Read.All, AuditActivity.Write, AuditLogsQuery-OneDrive.Read.All, Files.ReadWrite.All, AuditLog.Read.All, AuditLogsQuery-CRM.Read.All, AuditLogsQuery-Endpoint.Read.All, AuditActivity.Read].

Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-MgBetaSecurityAuditLogQuery_DeleteViaIdentity" on target "Call remote 'DELETE /security/auditLog/queries/{auditLogQuery-id}' 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:
DELETE

Absolute Uri:
https://graph.microsoft.com/beta/security/auditLog/queries/bee53e0a-2bf1-489d-bb4e-1641a31f93be

Headers:
Id : bee53e0a-2bf1-489d-bb4e-1641a31f93be
AuditLogQueryID : bee53e0a-2bf1-489d-bb4e-1641a31f93be
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-US),PowerShell/7.5.3
SdkVersion : graph-powershell-beta/2.31.0
client-request-id : e98fb6d1-4f94-4d7b-bbf0-2ab78d562d39
Accept-Encoding : gzip,deflate,br

Body:

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

Status Code:
NotFound

Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : ed53f1b5-d724-46a9-8ca8-1be2c2d47d87
client-request-id : e98fb6d1-4f94-4d7b-bbf0-2ab78d562d39
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US","Slice":"E","Ring":"5","ScaleUnit":"010","RoleInstance":"MN1PEPF0002828D"}}
Date : Thu, 16 Oct 2025 17:38:38 GMT

Body:
{
"error": {
"code": "UnknownError",
"message": "{"Message":"No HTTP resource was found that matches the request URI 'https://o365adtsearchapi-na004-aks.eastus.cloudapp.azure.com/security/auditLog/queries('')'.","MessageDetail":"No type was found that matches the controller named 'queries'."}",
"innerError": {
"date": "2025-10-16T17:38:38",
"request-id": ",
"client-request-id": ""
}
}
}

Remove-MgBetaSecurityAuditLogQuery_DeleteViaIdentity: {"Message":"No HTTP resource was found that matches the request URI 'https://o365adtsearchapi-na004-aks.eastus.cloudapp.azure.com/security/auditLog/queries('')'.","MessageDetail":"No type was found that matches the controller named 'queries'."}

Status: 404 (NotFound)
ErrorCode: UnknownError
Date: 2025-10-16T17:38:38

Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id :
client-request-id :
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US","Slice":"E","Ring":"5","ScaleUnit":"010","RoleInstance":""}}
Date : Thu, 16 Oct 2025 17:38:38 GMT

Recommendation: See service error codes: https://learn.microsoft.com/graph/errors
DEBUG: [CmdletEndProcessing]: - Remove-MgBetaSecurityAuditLogQuery end processing.

</details>


### Configuration

_No response_

### Other information

_No response_
主要言語
C#
スター
902
フォーク
233
平均マージ
1日 22時間
マージ済み PR(30日)
29

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoftgraph/msgraph-sdk-powershell のほかの issue

microsoftgraph/msgraph-sdk-powershell の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。