When we retrieve an app by its object Id, for example like this:
m365 entra app get --objectId "bc928a0a-a9f3-474e-9119-2b05fed29ac3"
and the object ID is wrong, the following error is returned:
Error: Resource 'bc928a0a-a9f3-474e-9119-2b05fed29ac3' does not exist or one of its queried reference-property objects are not present.
This is a quite unclear error message as opposed to when we retrieve by a faulty appId:
Error: App with appId 'bc928a0a-a9f3-474e-9119-2b05fed29ac3' not found in Microsoft Entra ID
This is because we increasingly use the entraApp util file. And in there we have implemented returning errors for getAppRegistrationByAppId and getAppRegistrationByAppName, but not for getAppRegistrationByObjectId.
This issue can occur in quite some commands that use this util, returning unclear errors to the user.
I propose we update the getAppRegistrationByObjectId util function so that it returns the error App with objectId '${objectId}' not found in Microsoft Entra ID when a 404 HTTP statuscode is returned.
When we retrieve an app by its object Id, for example like this:
m365 entra app get --objectId "bc928a0a-a9f3-474e-9119-2b05fed29ac3"and the object ID is wrong, the following error is returned:
This is a quite unclear error message as opposed to when we retrieve by a faulty appId:
This is because we increasingly use the
entraApputil file. And in there we have implemented returning errors forgetAppRegistrationByAppIdandgetAppRegistrationByAppName, but not forgetAppRegistrationByObjectId.This issue can occur in quite some commands that use this util, returning unclear errors to the user.
I propose we update the
getAppRegistrationByObjectIdutil function so that it returns the errorApp with objectId '${objectId}' not found in Microsoft Entra IDwhen a 404 HTTP statuscode is returned.