Remove-MgServicePrincipalTokenLifetimePolicyByRef is not using the correct underlying HTTP Graph endpoint
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start at the Remove-MgServicePrincipalTokenLifetimePolicyByRef cmdlet entry point and compare its generated DELETE URI with the Microsoft Graph token lifetime policy documentation linked in the issue. Verify that the policy ID is placed in the path before /$ref, then run the relevant cmdlet or request-generation tests if available; done means the command sends the documented endpoint.
Written by the indexing model from the issue text.
Description
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_
- Dominant language
- C#
- Stars
- 898
- Forks
- 230
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 23
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoftgraph/msgraph-sdk-powershell
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoftgraph/msgraph-sdk-powershell#3752 ·
Maintainers usually reply within 2 days
-
status:waiting-for-triage type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoftgraph/msgraph-sdk-powershell#3751 ·
Maintainers usually reply within 2 days
-
status:waiting-for-triage type:bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
microsoftgraph/msgraph-sdk-powershell#3772 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoftgraph/msgraph-sdk-powershell#3749 ·
Maintainers usually reply within 2 days
-
status:waiting-for-triage type:bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoftgraph/msgraph-sdk-powershell#3741 ·
Maintainers usually reply within 2 days
All issues in microsoftgraph/msgraph-sdk-powershell
Similar issues
-
area-ai untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
dotnet/extensions#7790 ·
Maintainers usually reply within 1 day
-
P2 testing
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/runtime#134766 · 3 comments ·
Maintainers usually reply within 1 day
-
0 - Backlog Bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
BrighterCommand/Brighter#4444 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day