@microsoft/sentinel-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +194 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7927 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Sentinel CLI
|
|
2
|
+
|
|
3
|
+
The **Sentinel CLI** is a command-line interface for Microsoft Sentinel that supports secure authentication and deployment workflows. It enables automation of Sentinel resource management using scripts and CI/CD pipelines.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install globally using npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @microsoft/sentinel-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## CLI Usage
|
|
16
|
+
|
|
17
|
+
Basic syntax:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
sentinel [command] [options]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
View available commands:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
sentinel --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Authentication Options
|
|
32
|
+
|
|
33
|
+
Authenticate using the `login` command with one of the supported methods:
|
|
34
|
+
|
|
35
|
+
### 1. Browser Authentication (Default)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
sentinel login
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Launches an interactive browser-based authentication using the authorization code flow. This is the default method when no authentication flag is provided.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### 2. Device Code
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
sentinel login --use-device-code
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Authenticate interactively using the device code flow. Use this when you cannot open a browser directly on the machine running the CLI — you will be prompted to visit a URL and enter a code on any other browser-capable device.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### 3. Workload Identity
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
sentinel login --workload-identity
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Authenticate using Workload Identity. Use this when running inside GitHub Actions, Azure DevOps Tasks, or other Azure-integrated environments that support workload identity federation.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### 4. Managed Identity (User-Assigned)
|
|
66
|
+
|
|
67
|
+
Authenticate using a user-assigned Managed Identity. Provide exactly one of the following identity selectors:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Authenticate via Client ID
|
|
71
|
+
sentinel login --identity --client-id <client-id>
|
|
72
|
+
|
|
73
|
+
# Authenticate via Object ID
|
|
74
|
+
sentinel login --identity --object-id <object-id>
|
|
75
|
+
|
|
76
|
+
# Authenticate via Resource ID
|
|
77
|
+
sentinel login --identity --resource-id <resource-id>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use this when running inside an Azure VM or other Azure resource with a user-assigned managed identity.
|
|
81
|
+
|
|
82
|
+
**Parameters:**
|
|
83
|
+
|
|
84
|
+
- `--client-id <clientId>`: User-assigned Managed Identity client ID
|
|
85
|
+
- `--object-id <objectId>`: User-assigned Managed Identity object ID
|
|
86
|
+
- `--resource-id <resourceId>`: User-assigned Managed Identity resource ID
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
#### Logout
|
|
91
|
+
|
|
92
|
+
Clear stored credentials and log out:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
sentinel logout
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Get Token
|
|
99
|
+
|
|
100
|
+
Get an access token for the current authentication:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Get token using current authentication
|
|
104
|
+
sentinel token
|
|
105
|
+
|
|
106
|
+
# Get token using managed identity
|
|
107
|
+
sentinel token --client-id <client-id>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Resource Management Commands
|
|
113
|
+
|
|
114
|
+
#### Publish Job
|
|
115
|
+
|
|
116
|
+
Publish a Sentinel notebook using a deployment config:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
sentinel job publish <notebookPath> --config <packagePath> --region <azureRegion>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Example:**
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
sentinel job publish ./notebooks/example.ipynb --config ./configs/jobConfig.yaml --region eastus2euap
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Parameters:**
|
|
129
|
+
|
|
130
|
+
- `<notebookPath>`: Path to the Jupyter notebook file (.ipynb)
|
|
131
|
+
- `--config, -c`: Path to job configuration file (JSON or YAML)
|
|
132
|
+
- `--region, -r`: Target Azure region (default: Global)
|
|
133
|
+
|
|
134
|
+
#### Create Zip
|
|
135
|
+
|
|
136
|
+
Create a deployment package from a manifest file:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
sentinel package create-zip <manifestPath>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Example:**
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
sentinel package create-zip ./manifest.json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Parameters:**
|
|
149
|
+
|
|
150
|
+
- `<manifestPath>`: Path to the manifest file that describes the package contents
|
|
151
|
+
|
|
152
|
+
#### Validate
|
|
153
|
+
|
|
154
|
+
Validate a YAML configuration file against the schema:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
sentinel validate --file <yamlPath>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Example:**
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
sentinel validate --file ./configs/jobConfig.yaml
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Parameters:**
|
|
167
|
+
|
|
168
|
+
- `--file, -f`: Path to the YAML file to validate
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Permissions
|
|
173
|
+
|
|
174
|
+
Grant the appropriate **Azure RBAC** permissions following the [Sentinel onboarding][sentinelonboarding].
|
|
175
|
+
|
|
176
|
+
## Contributing
|
|
177
|
+
|
|
178
|
+
The project is released under the [MIT License][license].
|
|
179
|
+
|
|
180
|
+
## Data and Telemetry
|
|
181
|
+
|
|
182
|
+
The Microsoft Sentinel CLI does not collect usage data. Read our [privacy statement][microsoftprivacy] to learn more.
|
|
183
|
+
|
|
184
|
+
## Code of Conduct
|
|
185
|
+
|
|
186
|
+
This project has adopted the [Microsoft Open Source Code of Conduct][codeofconduct]. For more information, see the [FAQ][codeofconductfaq] or contact [opencode@microsoft.com][opencodeemail].
|
|
187
|
+
|
|
188
|
+
[license]: LICENSE
|
|
189
|
+
[codeofconduct]: https://opensource.microsoft.com/codeofconduct/
|
|
190
|
+
[codeofconductfaq]: https://opensource.microsoft.com/codeofconduct/faq/
|
|
191
|
+
[opencodeemail]: mailto:opencode@microsoft.com
|
|
192
|
+
[microsoftprivacy]: https://privacy.microsoft.com/privacystatement
|
|
193
|
+
[defaultazurecredential]: https://learn.microsoft.com/en-us/javascript/api/@azure/identity/defaultazurecredential
|
|
194
|
+
[sentinelonboarding]: https://learn.microsoft.com/en-us/microsoft-sentinel-onboard#microsoft-sentinel-prerequisites
|
package/dist/index.d.ts
ADDED