Skip to content

Inconsistent and unclear errors when retrieving an app by object ID #6884

@martinlingstuyl

Description

@martinlingstuyl

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions