我创建了一个 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
Add-PnPMicrosoft365GroupMember 和 Add-PnPMicrosoft365GroupOwner 将用户添加到 Microsoft 365 组类型,但在这里您要添加应用程序。我相信它只允许添加用户。
does not exist or one of its queried reference-property objects are not present
错误。传送门-
如果您直接在门户中将企业应用程序添加为所有者,它将被添加,但在管理中心中不会可见。
要在门户中添加所有者,您可以在 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>"