未找到(404):资源“guidOfMyManagedIdentityServicePrincipal”不存在或其查询的引用属性对象之一不存在

问题描述 投票:0回答:1

我创建了一个 Azure 函数并启用了托管标识选项。它使用独特的指南创建一个新的企业应用程序。我想将此托管身份添加为特定 AAD 组的所有者。在浏览器中,当我输入托管身份 GUID 时,它可以工作,但是当我通过 PowerShell 代码尝试它时,我收到以下错误:

Add-PnPMicrosoft365GroupMember -Identity $aadGroupId -Users $guidOfMyManagedIdentityServicePrincipal

Not Found (404): Resource 'guidOfMyManagedIdentityServicePrincipal' does not exist or one of its queried reference-property objects are not present
azure-functions azure-app-registration
1个回答
0
投票

Add-PnPMicrosoft365GroupMemberAdd-PnPMicrosoft365GroupOwner 将用户添加到 Microsoft 365 组类型,但在这里您要添加应用程序。我相信它只允许添加用户。

  • 如果您尝试添加通过从管理中心手动启用托管身份创建的企业应用程序,则您的应用程序将不会在搜索结果中可见。

enter image description here

enter image description here

  • 因此,您会收到
    does not exist or one of its queried reference-property objects are not present
    错误。

传送门-

如果您直接在门户中将企业应用程序添加为所有者,它将被添加,但在管理中心中不会可见。

enter image description here

要在门户中添加所有者,您可以在 azure 函数中使用 PowerShell 脚本

Add-AzureADGroupOwner -ObjectId "e83adea" -RefObjectId "<ManagedIdentityGuid>"

AFAIK,

Add-PnPMicrosoft365GroupOwner -Identity "e83ad3a" -Users "UsersObjectId"
将为用户工作。在功能应用程序中添加用户时它可以工作。

$siteUrl = "https://******.sharepoint.com"
Connect-PnPOnline $siteUrl -ManagedIdentity

Add-PnPMicrosoft365GroupOwner -Identity "e8*****a3a" -Users "<user principal>"

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.