Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions en/asgardeo/docs/asgardeo-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
---
template: templates/quick-start.html
---
<script>
const meta = {
what_you_will_learn: [

Check warning on line 6 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / Vale style check

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'what_you_will_learn'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'what_you_will_learn'?", "location": {"path": "en/asgardeo/docs/asgardeo-cli.md", "range": {"start": {"line": 6, "column": 5}}}, "severity": "WARNING"}
"Build and install the Asgardeo CLI",
"Configure your Asgardeo organization"
],
prerequisites: [
"About 15 minutes",
"<a href='{{ base_path }}/get-started/create-asgardeo-account/'>Asgardeo account</a>",
"Install <a href='https://go.dev/doc/install' target='_blank' rel='noopener noreferrer'>Go</a> on your system.",
],
};
</script>

# Asgardeo CLI <div class="md-chip md-chip--preview"><span class="md-chip__label">Preview</span></div>

The **Asgardeo CLI** helps you manage identity and access management tasks using terminal commands. It connects your terminal or AI tool to Asgardeo's Management APIs, automating common identity management operations such as creating applications, updating API resources, and managing users, groups, and roles without using the Asgardeo Console UI or writing API calls.

Check warning on line 20 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / Vale style check

[vale] reported by reviewdog 🐶 [WSO2-IAM.SentenceLength] Try to keep sentences short (< 30 words). Raw Output: {"message": "[WSO2-IAM.SentenceLength] Try to keep sentences short (\u003c 30 words).", "location": {"path": "en/asgardeo/docs/asgardeo-cli.md", "range": {"start": {"line": 20, "column": 101}}}, "severity": "INFO"}

The Asgardeo CLI acts as a bridge between your terminal and Asgardeo, handling authentication and API requests. This guide explains how to set up the CLI, connect it to your Asgardeo organization, and verify your setup.

!!! Note

The Asgardeo CLI is currently in **Preview**. Some features may be subject to changes in future releases.

## Configure Asgardeo

The Asgardeo CLI communicates with the Asgardeo Management APIs to perform the actions required by each command. To make this work, it must first get an access token with the appropriate scopes. This requires configuring access to your Asgardeo organization by creating a Machine-to-Machine (M2M) application and authorizing API Resources and Scopes to access the necessary APIs.

1. Sign into [Asgardeo console](https://console.asgardeo.io) and navigate to **Applications > New Application**. Then, select **M2M Application** and complete the wizard popup by providing a suitable name.
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated

!!! Example
**name:** asgardeo-cli

Note down the following values from the **Protocol** tab of the registered application. You will need them to authenticate the CLI.

- **`client-id`** from the **Protocol** tab.
- **`client-secret`** from the **Protocol** tab.
- **The name of your Asgardeo organization**

![Asgardeo M2M app]({{base_path}}/assets/img/quick-starts/cli-tool/credentials.png){: width="800" style="display: block; margin: 0;"}

!!! Note
It is recommended to set the `Token type` of the Access Token of this application to `Opaque`, and `Application access token expiry time` of the application to a preferred value. These configurations can be done in the **Protocol** tab.

Check warning on line 46 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / Vale style check

[vale] reported by reviewdog 🐶 [WSO2-IAM.TooWordy] 'It is' is too wordy. Raw Output: {"message": "[WSO2-IAM.TooWordy] 'It is' is too wordy.", "location": {"path": "en/asgardeo/docs/asgardeo-cli.md", "range": {"start": {"line": 46, "column": 9}}}, "severity": "WARNING"}

2. Authorize the API resources and corresponding scopes required for the actions performed by the CLI. The following table includes the required API resources and scopes for the currently supported CLI commands.

| **Asgardeo Management API** | **Required scopes** |
|--------|---------|
| **SCIM2 Agents API** (`/scim2/Agents`) | `internal_agent_mgt_list`, `internal_agent_mgt_create`, `internal_agent_mgt_view`, `internal_agent_mgt_update`, `internal_agent_mgt_delete`|
| **Application Management API** (`/api/server/v1/applications`) | `internal_application_mgt_view`, `internal_application_mgt_update`, `internal_application_mgt_create`, `internal_application_mgt_delete` |
| **API Resource Management API** (`/api/server/v1/api-resources`) | `internal_api_resource_create`, `internal_api_resource_view`, `internal_api_resource_delete`, `internal_api_resource_update` |
| **Branding Preference Management API** (`/api/server/v1/branding-preference`) |`internal_branding_preference_update`|
| **Identity Provider Management API** (`/api/server/v1/identity-providers`) | `internal_idp_view`, `internal_idp_create`, `internal_idp_update`, `internal_idp_delete` |
| **Organization Management API** (`/api/server/v1/organizations`) |`internal_organization_create`, `internal_organization_view`, `internal_organization_update`, `internal_organization_delete`|
| **SCIM2 Users API** (`/scim2/Users`) | `internal_user_mgt_create`, `internal_user_mgt_list`, `internal_user_mgt_view`, `internal_user_mgt_update`, `internal_user_mgt_delete` |
| **SCIM2 Groups API** (`/scim2/Groups`) | `internal_group_mgt_create`, `internal_group_mgt_view`, `internal_group_mgt_update`, `internal_group_mgt_delete` |
| **SCIM2 Roles V3 API** (`/scim2/v3/Roles`) | `internal_role_mgt_view`, `internal_role_mgt_meta_create`, `internal_role_mgt_meta_update`, `internal_role_mgt_delete`, `internal_role_mgt_users_update`, `internal_role_mgt_groups_update` |

!!! Note

You can selectively authorize API Resources and scopes based on the specific commands you plan to use.
If you plan to use the `asg api` command, ensure you have authorized the corresponding API resource and scopes.

## Installation

### Building the Asgardeo CLI locally

Check failure on line 69 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Disallow consecutive headings

en/asgardeo/docs/asgardeo-cli.md:69 no-consecutive-headings Disallow consecutive headings [Consecutive headings are not allowed.] [Context: "### Building the Asgardeo CLI locally"]

1. Clone the repository

```bash
git clone https://github.com/wso2-enterprise/asgardeo-cli.git
```

2. Build and install the CLI

Check failure on line 77 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Spaces after list markers

en/asgardeo/docs/asgardeo-cli.md:77:1 MD030/list-marker-space Spaces after list markers [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md030.md

Check failure on line 77 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Ordered list item prefix

en/asgardeo/docs/asgardeo-cli.md:77:1 MD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 2; Style: 1/1/1] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md029.md

```bash
cd asgardeo-cli/cmd/asg
go install .
```
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated

!!! Note
Ensure your Go binary directory is included in your `PATH`.

Example:
```bash
export PATH=$PATH:$(go env GOPATH)/bin
```

3. Verify the installation

```bash
asg --help
```
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated

If the command displays the help message, the installation was successful.

## Authenticating the CLI

Before using the CLI, you must authenticate it.

### Authenticating via an application

Check failure on line 104 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Headings should be surrounded by blank lines

en/asgardeo/docs/asgardeo-cli.md:104 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Authenticating via an application"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
The credentials of the application created [earlier](#configure-asgardeo) will be used in this step.

1. Run the login command

```bash
asg login
```
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated

2. Select `Login using an application`

Check failure on line 113 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Ordered list item prefix

en/asgardeo/docs/asgardeo-cli.md:113:1 MD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 2; Style: 1/2/3] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md029.md

3. Provide the credentials (`client-id`, `client-secret`, `organization-name`) when prompted.

Check failure on line 115 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Ordered list item prefix

en/asgardeo/docs/asgardeo-cli.md:115:1 MD029/ol-prefix Ordered list item prefix [Expected: 2; Actual: 3; Style: 1/2/3] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md029.md

!!! Note
Authentication can be done in one step by providing the credentials as flags.
```bash
asg login --client-id <client_id> --client-secret <client_secret> --org-name <organization_name>
```

!!! Warning
Do not expose your `client-secret` in shared terminals, shell history, or source control repositories.

4. Verify authentication status

Check failure on line 126 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Ordered list item prefix

en/asgardeo/docs/asgardeo-cli.md:126:1 MD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 4; Style: 1/1/1] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md029.md

```bash
asg status
```
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated

!!! Note
Use the `asg logout` commnd to clear the authentication data of the CLI.

Check warning on line 133 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / Vale style check

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'commnd'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'commnd'?", "location": {"path": "en/asgardeo/docs/asgardeo-cli.md", "range": {"start": {"line": 133, "column": 26}}}, "severity": "WARNING"}
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated

The current authentication status will be displayed in the terminal.

## Command Line Interface

Check warning on line 137 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / Vale style check

[vale] reported by reviewdog 🐶 [WSO2-IAM.SentenceStyleTitles] 'Command Line Interface' should use sentence-style capitalization. Raw Output: {"message": "[WSO2-IAM.SentenceStyleTitles] 'Command Line Interface' should use sentence-style capitalization.", "location": {"path": "en/asgardeo/docs/asgardeo-cli.md", "range": {"start": {"line": 137, "column": 4}}}, "severity": "INFO"}

Once the CLI is authenticated, commands can be executed.
Commands follow the `<root> <resource_type> <action> --<flags>` pattern.

For example:
```bash

Check failure on line 143 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Fenced code blocks should be surrounded by blank lines

en/asgardeo/docs/asgardeo-cli.md:143 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md
asg apps list
asg apis create
asg users delete --id <user_id>
```

!!! Note
Adding the `--help` flag displays the detailed help message for any command.
```bash
asg apps delete --help
asg groups members add --help
```

## Text User Interface

Check warning on line 156 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / Vale style check

[vale] reported by reviewdog 🐶 [WSO2-IAM.SentenceStyleTitles] 'Text User Interface' should use sentence-style capitalization. Raw Output: {"message": "[WSO2-IAM.SentenceStyleTitles] 'Text User Interface' should use sentence-style capitalization.", "location": {"path": "en/asgardeo/docs/asgardeo-cli.md", "range": {"start": {"line": 156, "column": 4}}}, "severity": "INFO"}

The Asgardeo CLI provides a Text User Interface (TUI) for interactive navigation and command execution without manually typing commands.
```bash

Check failure on line 159 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Fenced code blocks should be surrounded by blank lines

en/asgardeo/docs/asgardeo-cli.md:159 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```bash"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md
asg tui
```

Check failure on line 161 in en/asgardeo/docs/asgardeo-cli.md

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces

en/asgardeo/docs/asgardeo-cli.md:161:4 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md009.md
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated

## Next steps

After setting up the CLI, you can start managing:

- Applications
- Users
- Groups
- Roles
- API resources

Use the `--help` flag with any command to explore available operations.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions en/asgardeo/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,8 @@ nav:
- Accessing Protected APIs: sdks/nextjs/guides/accessing-protected-apis.md
- Protecting Routes: sdks/nextjs/guides/protecting-routes.md
- Asgardeo MCP Server: sdks/asgardeo-mcp-server.md
# uncomment after relasing the CLI.
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated
Comment thread
Pratheep-Srikones marked this conversation as resolved.
Outdated
# - Asgardeo CLI: asgardeo-cli.md
- APIs:
- APIs - Overview: apis/index.md
- Management APIs:
Expand Down
4 changes: 4 additions & 0 deletions en/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ extra:
Asgardeo MCP Server:
icon: assets/libs/custom-icons/mcp.svg
level: 1
# Uncomment after releasing the CLI.
# Asgardeo CLI:
# icon: octicons/terminal-16
# level: 1
React SDK:
icon: fontawesome/brands/react
level: 2
Expand Down
Loading