|
1 | 1 | # kalypso-cli |
2 | 2 |
|
3 | | -## Overview |
4 | | -kalypso-cli is a command line tool to crawl resources in your Azure subscription and store it as local JSON file. |
5 | | -This output can be used to visualise your resources in the [Kalypso UI](https://kalypso.tools/). |
6 | | -The UI is running locally in your browser. There is no backend or other service and thus no data transfer whatsoever happening with your data. Everything stays on your local computer. |
7 | | -Kalypso-cli is designed to crawl all kinds of resources from your subscription(s). As of 2024 the main focus of development lies on discovery of Azure Data Explorer (ADX) resources like tables, functions and policies. |
| 3 | +Discover Azure resources [querying](https://aka.ms/AzureResourceGraph-QueryLanguage) Azure Resource Graph, crawl additional info and store everything into a local JSON file, which can be used with https://kalypso.tools |
8 | 4 |
|
9 | | -## Installation |
| 5 | +Support currently limited to resource type `microsoft.kusto/clusters` |
10 | 6 |
|
11 | | -### Prerequisites |
| 7 | +The CLI expects you to be authenticated in Azure already. This typically achieved with running `az login` before. |
12 | 8 |
|
13 | | -- [npm and node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) are installed |
14 | | -- [azure cli](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) is installed |
15 | 9 |
|
| 10 | +## Install the latest precompiled binary |
16 | 11 |
|
17 | | - you just clone the repo and run: |
| 12 | +```sh |
| 13 | +curl -fsSL https://raw.githubusercontent.com/functional-team/kalypso-cli/refs/heads/main/dist/install.sh | sh |
| 14 | +``` |
18 | 15 |
|
19 | | - ```shell |
20 | | - npm install |
21 | | - ``` |
22 | | - |
| 16 | +## Usage |
23 | 17 |
|
24 | | -## Documentation |
| 18 | +### Command line utility |
25 | 19 |
|
26 | | -### Quickstart |
27 | | -Starting a crawl run is as simple as: |
| 20 | +```sh |
| 21 | +Usage: kalypso-cli crawl [options] |
28 | 22 |
|
29 | | - ```shell |
30 | | - #authenticate to your azure subscription(s) |
31 | | - az login |
| 23 | +Crawl Azure Resources |
32 | 24 |
|
33 | | - #run crawler |
34 | | - npm run crawl |
35 | | - ``` |
| 25 | +Options: |
| 26 | + -o|--output-path [string] path to output file, default is set in configuration (default: "crawled.json") |
| 27 | + -q|--az-graph-query [string] Use Resource Graph Query to specify scope of the crawl |
| 28 | + -k|--az-kusto-uri [string] Use Kusto Cluster URI to crawl specific Cluster only |
| 29 | + -h, --help display help for command |
| 30 | +``` |
36 | 31 |
|
37 | | -The crawl command supports two parameters: |
| 32 | +### Examples |
38 | 33 |
|
39 | | -* `--output-path`: file path for where the output JSON is getting stored. Defaults to ./crawled.json |
40 | | -* `--azure-query`: A KQL query that narrows down what resources should be crawled. Please refer to https://aka.ms/AzureResourceGraph-QueryLanguage for a reference. |
| 34 | +Using the precompiled binaries: |
41 | 35 |
|
42 | | -### Example |
| 36 | +```sh |
| 37 | +az login |
| 38 | +kalypso-cli crawl --output-path "resources.json" --az-graph-query "type == 'microsoft.kusto/clusters' and resourceGroup contains 'dev'" |
| 39 | +``` |
43 | 40 |
|
44 | | - ```shell |
45 | | - az login |
46 | | - ``` |
47 | | -This command opens a browser window to authenticate with your Azure subscription. After sucessful authentication, you should be seeing details about your Azure subscription starting with: |
48 | | - ```shell |
49 | | - [ |
50 | | - { |
51 | | - "cloudName": "AzureCloud", |
52 | | - "homeTenantId": ... |
53 | | - ``` |
| 41 | +Cloning the repo and using an existing node.js installation |
54 | 42 |
|
| 43 | +```sh |
| 44 | +npm install |
| 45 | +az login |
| 46 | +npx ts-node ./src/index.ts crawl --output-path "resources.json" --az-graph-query "type == 'microsoft.kusto/clusters' and resourceGroup contains 'dev'" |
| 47 | +``` |
55 | 48 |
|
56 | | -Now, crawling can be initiated by |
| 49 | +## Developer guide |
57 | 50 |
|
58 | | - ```shell |
59 | | - npm run crawl |
60 | | - ``` |
61 | | -The command output should now look like this: |
62 | | - ```shell |
63 | | -SCAN KUSTO CLUSTER : https://myawesomecluster.westeurope.kusto.windows.net |
64 | | -SCAN KUSTO DATABASE: myawesomedatabase: 45 Schemas. 63 Update Policies. 45 Tables. 143 Functions. 20 Materialized Views. 1 External Tables. |
65 | | -... |
66 | | - ``` |
| 51 | +### Build precompiled binaries (experimental) |
67 | 52 |
|
| 53 | + We use https://github.com/james-pre/xsea to ease the creation of single executable apps for all major platforms: |
68 | 54 |
|
| 55 | + ```shell |
| 56 | + npm install --global xsea |
| 57 | + sudo npm run build && sudo npm run package |
| 58 | + ``` |
0 commit comments