将 AzureADPreview (2.0.1.18) 用于 Powershell 我正在尝试向应用程序添加策略:
Add-AzureADApplicationPolicy -Id dc1b1cbf-356a-4d0a-a3b2-e7a0e3125aa2 -RefObjectId 36e8328a-17b5-4d64-a12f-dfac959c3b8b
但我得到:
Add-AzureADApplicationPolicy : Error occurred while executing AddApplicationPolicy
Code: Request_ResourceNotFound
Message: Resource 'dc1b1cbf-356a-4d0a-a3b2-e7a0e3125aa2' does not exist or one of its queried reference-property objects are not present.
InnerError:
RequestId: 0663394a-b556-4bb6-a3c1-96a8fac3e5ec
DateTimeStamp: Wed, 12 Sep 2018 09:04:58 GMT
HttpStatusCode: NotFound
HttpStatusDescription: Not Found
HttpResponseStatus: Completed
At line:1 char:1
+ Add-AzureADApplicationPolicy -Id dc1b1cbf-356a-4d0a-a3b2-e7a0e3125aa2 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-AzureADApplicationPolicy], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.MSGraphBeta.Client.ApiException,Microsoft.Open.MSGraphBeta.PowerShell.AddApplicationPolicy
所以它似乎找不到应用程序。但是我能够找到这样的应用程序:
Get-AzureADApplication -Filter "AppId eq 'dc1b1cbf-356a-4d0a-a3b2-e7a0e3125aa2'"
ObjectId AppId DisplayName
-------- ----- -----------
9125a684-e262-4215-8e35-5d3d628d27f2 dc1b1cbf-356a-4d0a-a3b2-e7a0e3125aa2 MyAppname
我之前已经能够使用相同的策略对同一个租户执行此操作。所以发生了一些导致这种情况的事情。我已经为租户尝试了其他应用程序,但得到了同样的错误。