Skip to content

Error removing or setting additional AAD Grants with objectId containing leading dash '-' #606

Description

@pkskelly

When assigning an OAuth2 grant using the following:

o365 aad oauth2grant add --clientId 253597f9-3c16-4744-8bc6-65f3e4ab62c4 --resourceId 0edd1406-a0a7-4f20-961c-06897ee9c665 --scope Calendars.Read

and then checking the objectId to add additional permissions the objectId contained a dash ('-') prefix.

$ o365 aad oauth2grant list --clientId 253597f9-3c16-4744-8bc6-65f3e4ab62c4
objectId  : -Zc1JRY8REeLxmXz5KtixAYU3Q6noCBPlhwGiX7pxmU
resourceId: 0edd1406-a0a7-4f20-961c-06897ee9c665
scope     : Calendars.Read

When attempting to call o365 aad oauth2grant set or o365 aad oauth2grant remove with this objectId, you simply receive the help message indicating the --grantId is missing.

This is easily fixed with escaping the objectId with a \\ prefix, e.g. \\-Zc1JRY8REeLxmXz5KtixAYU3Q6noCBPlhwGiX7pxmU.

Since this is an unlikley case, just wanted to document for others. A fix (IMO) is not necessarily needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions