Skip to content

Commit

Permalink
Added the 'aad oauth2grant list' command solving pnp#159
Browse files Browse the repository at this point in the history
  • Loading branch information
waldekmastykarz committed Dec 24, 2017
1 parent 35058db commit 77f24ef
Show file tree
Hide file tree
Showing 6 changed files with 560 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docs/manual/docs/cmd/aad/oauth2grant/oauth2grant-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# aad oauth2grant list

Lists OAuth2 permission grants for the specified service principal

## Usage

```sh
aad oauth2grant list [options]
```

## Options

Option|Description
------|-----------
`--help`|output usage information
`-i, --clientId <clientId>`|objectId of the service principal for which the configured OAuth2 permission grants should be retrieved
`-o, --output <output>`|Output type. `json|text`. Default `text`
`--verbose`|Runs command with verbose logging
`--debug`|Runs command with debug logging

!!! important
Before using this command, connect to Azure Active Directory Graph, using the [aad connect](../connect.md) command.

## Remarks

To get information about service principal OAuth2 permission grants, you have to first connect to Azure Active Directory Graph using the [aad connect](../connect.md) command, eg. `aad connect`.

In order to list existing OAuth2 permissions granted to a service principal, you need its `objectId`. You can retrieve it using the [aad sp get](../sp/sp-get.md) command.

## Examples

List OAuth2 permissions granted to service principal with `objectId` _b2307a39-e878-458b-bc90-03bc578531d6_.

```sh
aad oauth2grant list --clientId b2307a39-e878-458b-bc90-03bc578531d6
```

## More information

- Application and service principal objects in Azure Active Directory (Azure AD): [https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-application-objects](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-application-objects)
2 changes: 2 additions & 0 deletions docs/manual/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pages:
- connect: 'cmd/aad/connect.md'
- disconnect: 'cmd/aad/disconnect.md'
- status: 'cmd/aad/status.md'
- oauth2grant:
- oauth2grant list: 'cmd/aad/oauth2grant/oauth2grant-list.md'
- service principal (sp):
- sp get: 'cmd/aad/sp/sp-get.md'
- Concepts:
Expand Down
1 change: 1 addition & 0 deletions src/o365/aad/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const prefix: string = 'aad';
export default {
CONNECT: `${prefix} connect`,
DISCONNECT: `${prefix} disconnect`,
OAUTH2GRANT_LIST: `${prefix} oauth2grant list`,
SP_GET: `${prefix} sp get`,
STATUS: `${prefix} status`
};
10 changes: 10 additions & 0 deletions src/o365/aad/commands/oauth2grant/OAuth2PermissionGrant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface OAuth2PermissionGrant {
clientId: string;
consentType: string;
expiryTime: string;
objectId: string;
principalId: string;
resourceId: string;
scope: string;
startTime: string;
}

0 comments on commit 77f24ef

Please sign in to comment.