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

No New-MgInvitation errors but guest user not created

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
powershell
领域
api

调研方向

从 New-MgInvitation 入口点及其对 /v1.0/invitations 的 POST 请求开始,然后将返回的 invitedUser id 与 Get-MgUser 和 Entra ID 门户进行比较。确定差异出现在 PowerShell SDK 响应中还是 Microsoft Graph 服务中,并记录可复现的结果和下一步操作。

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

描述

Service issue type:bug
Describe the bug

I'm using Microsoft.Graph v2.30.0 module on PowerShell 7.5.3.
Following issue started to appear recently with New-MgInvitation cmdlet while inviting new Guest users.

I launch this cmdlet::

New-MgInvitation -InvitedUserEmailAddress <EmailAddress> -InviteRedirectUrl <MyCustoUrl> -InvitedUserType 'Guest'

All is working fine: the cmdlet returns Microsoft.Graph.PowerShell.Models.MicrosoftGraphInvitation object containing:

Id                      : <Guid>
InviteRedeemUrl         : https://login.microsoftonline.com/redeem?...                          
InviteRedirectUrl       : <MyCustomUrl>
InvitedUser             : Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser
InvitedUserDisplayName  :
InvitedUserEmailAddress : <EmailAddress>
InvitedUserMessageInfo  : Microsoft.Graph.PowerShell.Models.MicrosoftGraphInvitedUserMessageInfo
InvitedUserSponsors     :
InvitedUserType         : Guest
ResetRedemption         : False
SendInvitationMessage   : False
Status                  : PendingAcceptance
AdditionalProperties    : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#invitations/$entity]}

However, the user has not been created in Entra ID: it does not appear either when running Get-MgUser -Filter "UserType eq 'Guest' and Mail eq '<EmailAddress>' or in Entra ID Portal.

These are the scopes enabled in the Microsoft Graph connection (Get-MgContext).Scopes:

  • Directory.Read.All
  • Directory.ReadWrite.All
  • User.ReadWrite.All
    ...
Expected behavior

I would expect that, since the cmdlet does not return any errors but instead an object indicating it completed successfully, the user should be created in Entra ID.

How to reproduce
  1. Open PowerShell 7.5.3
  2. Import-Module Microsoft.Graph
  3. Connect-MgGraph
  4. New-MgInvitation -InvitedUserEmailAddress <EmailAddress> -InviteRedirectUrl <MyCustoUrl> -InvitedUserType 'Guest'
SDK Version

2.30.0

Latest version known to work for scenario above?

2.30.0

Known Workarounds

The creation of a new guest user from the Entra ID portal works correctly.

Debug output
Click to expand log DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/invitations

Headers:
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/2.30.0
client-request-id : eb4fc89e-6494-4106-8f0b-9ee5133c7c4c
Accept-Encoding : gzip,deflate,br

Body:
{
"invitedUserEmailAddress": "EmailAddress",
"invitedUserType": "Guest",
"inviteRedirectUrl": "MyCustomUrl"
}

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

Status Code:
Created

Headers:
Cache-Control : no-store, must-revalidate, no-cache
Location : https://graph.microsoft.com/
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : f34f78b8-7942-4018-89c6-9cce5dcd8173
client-request-id : eb4fc89e-6494-4106-8f0b-9ee5133c7c4c
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Italy North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"MI3PEPF00004A49"}}
odata-version : 4.0
Date : Fri, 19 Sep 2025 11:48:56 GMT

Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#invitations/$entity",
"id": "249c3056-3bbe-45e6-819f-b73fbed317c0",
"inviteRedeemUrl": "https://login.microsoftonline.com/redeem?...",
"invitedUserDisplayName": null,
"invitedUserType": "Guest",
"invitedUserEmailAddress": "EmailAddress",
"sendInvitationMessage": false,
"resetRedemption": false,
"inviteRedirectUrl": "MyCustomUrl",
"status": "PendingAcceptance",
"invitedUserMessageInfo": {
"messageLanguage": null,
"customizedMessageBody": null,
"ccRecipients": [
{
"emailAddress": {
"name": null,
"address": null
}
}
]
},
"invitedUser": {
"id": "a8255d08-0507-412c-a67b-19e0adcf74f6",
"userPrincipalName": "EmailPrefix_EmailSuffix#EXT#@MyTenant.onmicrosoft.com"
}
}

DEBUG: [CmdletEndProcessing]: - New-MgInvitation end processing.
Id InviteRedeemUrl


249c3056-3bbe-45e6-819f-b73fbed317c0 https://login.microsoftonline.com/redeem?...

Configuration
  • OS: Windows 11 24H2
  • Architecture: x64
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.3
PSEdition                      Core
GitCommitId                    7.5.3
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Other information

No response

主要语言
C#
星标
898
派生
230
平均合并
2 天 5 小时
30 天内合并 PR
31

贡献指南

打开贡献指南

从这里开始

  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 摘要。