Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Remove-MgServicePrincipalTokenLifetimePolicyByRef is not using the correct underlying HTTP Graph endpoint

未关闭
#3,728 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
csharp, powershell
领域
api

调研方向

从 Remove-MgServicePrincipalTokenLifetimePolicyByRef cmdlet 的入口点开始,将其生成的 DELETE URI 与 issue 中链接的 Microsoft Graph token lifetime policy 文档进行比较。确认 policy ID 放置在路径中的 /$ref 之前,然后在可用时运行相关的 cmdlet 或请求生成测试;当命令发送到文档所述的 endpoint 时即表示完成。

由索引模型根据 Issue 内容生成。

描述

status:waiting-for-triage type:bug
Describe the bug

I am using Microsoft.Graph version 2.39.0 on PowerShell 7.
The commandlet Remove-MgServicePrincipalTokenLifetimePolicyByRef is not sending out the correct MS Graph endpoint leading to error

PS C:\Users\bachoang> Remove-MgServicePrincipalTokenLifetimePolicyByRef -ServicePrincipalId xyz -Id abc -Debug
DEBUG: [CmdletBeginProcessing]: - Remove-MgServicePrincipalTokenLifetimePolicyByRef begin processing with parameterSet 'Delete'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, DelegatedPermissionGrant.ReadWrite.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, GroupMember.Read.All, openid, Policy.Read.All, Policy.ReadWrite.ApplicationConfiguration, profile, User.Read, UserAuthenticationMethod.ReadWrite.All, email].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
DELETE

Absolute Uri:
https://graph.microsoft.com/v1.0/servicePrincipals/xyz/tokenLifetimePolicies/$ref?@id=abc

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26200; en-US),PowerShell/7.6.5
SdkVersion : graph-powershell/2.38.0
client-request-id : 2671f48e-a8bf-4694-80a2-b3f3997eb73f
Accept-Encoding : gzip,deflate

Body:

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

Status Code:
BadRequest

Headers:
Date : Tue, 18 Aug 2026 22:53:04 GMT
Transfer-Encoding : chunked
Connection : keep-alive
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 0981e110-77aa-4c52-8fba-8ad957a58dd2
client-request-id : 2671f48e-a8bf-4694-80a2-b3f3997eb73f
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"South Central US","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"SN4PEPF00000013"}}

The MS Graph URL the commandlet https://graph.microsoft.com/v1.0/servicePrincipals/xyz/tokenLifetimePolicies/$ref?@id=abc sends out is wrong.

The correct MS Graph URL is https://graph.microsoft.com/v1.0/servicePrincipals/xyz/tokenLifetimePolicies/abc/$ref per https://learn.microsoft.com/en-us/entra/identity-platform/configure-token-lifetimes?source=recommendations#create-a-policy-and-assign-it-to-a-service-principal (step 4)

Expected behavior

It should make this correct request:
DELETE https://graph.microsoft.com/v1.0/servicePrincipals/xyz/tokenLifetimePolicies/abc/$re

How to reproduce

see above

SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
主要语言
C#
星标
901
派生
232
平均合并
1 天 9 小时
30 天内合并 PR
22

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoftgraph/msgraph-sdk-powershell 的其他 Issue

查看 microsoftgraph/msgraph-sdk-powershell 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。