azp-cli 0.0.1
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/.vscode/extensions.json +3 -0
- package/.vscode/launch.json +25 -0
- package/.vscode/settings.json +25 -0
- package/.vscode/tasks.json +28 -0
- package/README.md +203 -0
- package/dist/auth.d.ts +11 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +52 -0
- package/dist/auth.js.map +1 -0
- package/dist/azure-pim.d.ts +44 -0
- package/dist/azure-pim.d.ts.map +1 -0
- package/dist/azure-pim.js +183 -0
- package/dist/azure-pim.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +339 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/App.d.ts +9 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +85 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/components.d.ts +18 -0
- package/dist/ui/components.d.ts.map +1 -0
- package/dist/ui/components.js +13 -0
- package/dist/ui/components.js.map +1 -0
- package/dist/ui/router.d.ts +22 -0
- package/dist/ui/router.d.ts.map +1 -0
- package/dist/ui/router.js +19 -0
- package/dist/ui/router.js.map +1 -0
- package/dist/ui/screens/ActivateFlow.d.ts +25 -0
- package/dist/ui/screens/ActivateFlow.d.ts.map +1 -0
- package/dist/ui/screens/ActivateFlow.js +195 -0
- package/dist/ui/screens/ActivateFlow.js.map +1 -0
- package/dist/ui/screens/DeactivateFlow.d.ts +22 -0
- package/dist/ui/screens/DeactivateFlow.d.ts.map +1 -0
- package/dist/ui/screens/DeactivateFlow.js +115 -0
- package/dist/ui/screens/DeactivateFlow.js.map +1 -0
- package/dist/ui/useExitConfirmation.d.ts +7 -0
- package/dist/ui/useExitConfirmation.d.ts.map +1 -0
- package/dist/ui/useExitConfirmation.js +17 -0
- package/dist/ui/useExitConfirmation.js.map +1 -0
- package/dist/ui/widgets/CheckboxList.d.ts +14 -0
- package/dist/ui/widgets/CheckboxList.d.ts.map +1 -0
- package/dist/ui/widgets/CheckboxList.js +59 -0
- package/dist/ui/widgets/CheckboxList.js.map +1 -0
- package/dist/ui/widgets/ConfirmPrompt.d.ts +8 -0
- package/dist/ui/widgets/ConfirmPrompt.d.ts.map +1 -0
- package/dist/ui/widgets/ConfirmPrompt.js +19 -0
- package/dist/ui/widgets/ConfirmPrompt.js.map +1 -0
- package/dist/ui/widgets/NumberPrompt.d.ts +10 -0
- package/dist/ui/widgets/NumberPrompt.d.ts.map +1 -0
- package/dist/ui/widgets/NumberPrompt.js +38 -0
- package/dist/ui/widgets/NumberPrompt.js.map +1 -0
- package/dist/ui/widgets/SelectList.d.ts +14 -0
- package/dist/ui/widgets/SelectList.d.ts.map +1 -0
- package/dist/ui/widgets/SelectList.js +34 -0
- package/dist/ui/widgets/SelectList.js.map +1 -0
- package/dist/ui/widgets/TextPrompt.d.ts +10 -0
- package/dist/ui/widgets/TextPrompt.d.ts.map +1 -0
- package/dist/ui/widgets/TextPrompt.js +30 -0
- package/dist/ui/widgets/TextPrompt.js.map +1 -0
- package/dist/ui.d.ts +26 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +183 -0
- package/dist/ui.js.map +1 -0
- package/package.json +47 -0
- package/pnpm-workspace.yaml +2 -0
- package/src/auth.ts +66 -0
- package/src/azure-pim.ts +262 -0
- package/src/cli.ts +401 -0
- package/src/index.ts +65 -0
- package/src/ui.ts +253 -0
- package/tsconfig.json +45 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"type": "node",
|
|
6
|
+
"request": "launch",
|
|
7
|
+
"name": "Debug CLI",
|
|
8
|
+
"program": "${workspaceFolder}/src/index.ts",
|
|
9
|
+
"preLaunchTask": "npm: build",
|
|
10
|
+
"skipFiles": ["<node_internals>/**"],
|
|
11
|
+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
|
|
12
|
+
"sourceMaps": true,
|
|
13
|
+
"console": "integratedTerminal"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"type": "node",
|
|
17
|
+
"request": "launch",
|
|
18
|
+
"name": "Debug Current TS File",
|
|
19
|
+
"program": "${file}",
|
|
20
|
+
"runtimeArgs": ["-r", "ts-node/register"],
|
|
21
|
+
"skipFiles": ["<node_internals>/**"],
|
|
22
|
+
"console": "integratedTerminal"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"editor.formatOnSave": true,
|
|
3
|
+
"editor.codeActionsOnSave": {
|
|
4
|
+
"source.fixAll.eslint": "explicit",
|
|
5
|
+
"source.organizeImports": "explicit"
|
|
6
|
+
},
|
|
7
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
8
|
+
"[typescript]": {
|
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
|
+
},
|
|
11
|
+
"[json]": {
|
|
12
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
13
|
+
},
|
|
14
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
15
|
+
"typescript.preferences.importModuleSpecifier": "non-relative",
|
|
16
|
+
"files.exclude": {
|
|
17
|
+
"**/node_modules": true,
|
|
18
|
+
"**/dist": true
|
|
19
|
+
},
|
|
20
|
+
"search.exclude": {
|
|
21
|
+
"**/node_modules": true,
|
|
22
|
+
"**/dist": true,
|
|
23
|
+
"**/pnpm-lock.yaml": true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"type": "npm",
|
|
6
|
+
"script": "build",
|
|
7
|
+
"group": {
|
|
8
|
+
"kind": "build",
|
|
9
|
+
"isDefault": true
|
|
10
|
+
},
|
|
11
|
+
"problemMatcher": ["$tsc"],
|
|
12
|
+
"label": "npm: build"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "npm",
|
|
16
|
+
"script": "dev",
|
|
17
|
+
"problemMatcher": ["$tsc"],
|
|
18
|
+
"label": "npm: dev",
|
|
19
|
+
"isBackground": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "npm",
|
|
23
|
+
"script": "lint",
|
|
24
|
+
"problemMatcher": ["$eslint-stylish"],
|
|
25
|
+
"label": "npm: lint"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Azure PIM CLI (azp-cli)
|
|
2
|
+
|
|
3
|
+
A command-line interface tool for managing Azure Privileged Identity Management (PIM) role activations directly from your terminal.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🔐 **Role Activation** - Quickly activate eligible Azure PIM roles
|
|
12
|
+
- 🔓 **Role Deactivation** - Deactivate active roles when no longer needed
|
|
13
|
+
- 📋 **Interactive Menu** - User-friendly menu-driven interface
|
|
14
|
+
- ✨ **Beautiful UI** - Polished terminal experience with spinners and colors
|
|
15
|
+
- 🔄 **Multi-role Support** - Activate or deactivate multiple roles at once
|
|
16
|
+
- 📊 **Status Tracking** - Real-time feedback on activation/deactivation status
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
Before using azp-cli, ensure you have:
|
|
21
|
+
|
|
22
|
+
1. **Node.js** (v18 or higher)
|
|
23
|
+
2. **Azure CLI** installed and configured
|
|
24
|
+
3. **Azure account** with PIM-eligible roles
|
|
25
|
+
|
|
26
|
+
### Azure CLI Setup
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Install Azure CLI (if not installed)
|
|
30
|
+
# See: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
|
|
31
|
+
|
|
32
|
+
# Login to Azure
|
|
33
|
+
az login
|
|
34
|
+
|
|
35
|
+
# Verify you're logged in
|
|
36
|
+
az account show
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
### From Source
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Clone the repository
|
|
45
|
+
git clone https://github.com/tapanmeena/azp-cli.git
|
|
46
|
+
cd azp-cli
|
|
47
|
+
|
|
48
|
+
# Install dependencies
|
|
49
|
+
pnpm install
|
|
50
|
+
# or
|
|
51
|
+
npm install
|
|
52
|
+
|
|
53
|
+
# Build the project
|
|
54
|
+
pnpm build
|
|
55
|
+
# or
|
|
56
|
+
npm run build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
### Running the CLI
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Development mode
|
|
65
|
+
pnpm dev
|
|
66
|
+
# or
|
|
67
|
+
npm run dev
|
|
68
|
+
|
|
69
|
+
# After building
|
|
70
|
+
node dist/index.js
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Commands
|
|
74
|
+
|
|
75
|
+
| Command | Alias | Description |
|
|
76
|
+
|---------|-------|-------------|
|
|
77
|
+
| `activate` | `a` | Activate a role in Azure PIM (default) |
|
|
78
|
+
| `deactivate` | `d` | Deactivate a role in Azure PIM |
|
|
79
|
+
| `help` | - | Display help information |
|
|
80
|
+
|
|
81
|
+
### Example Session
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
╔════════════════════════════════════════════════════╗
|
|
85
|
+
║ Azure PIM CLI - Role Activation Manager ║
|
|
86
|
+
╚════════════════════════════════════════════════════╝
|
|
87
|
+
|
|
88
|
+
✔ Authentication successful
|
|
89
|
+
|
|
90
|
+
┌─ User Information ──────────────────────────────────
|
|
91
|
+
│ Name: John Doe
|
|
92
|
+
│ Email: john@example.com
|
|
93
|
+
└──────────────────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
✔ Found 3 subscription(s)
|
|
96
|
+
|
|
97
|
+
? What would you like to do?
|
|
98
|
+
❯ ▶ Activate Role(s)
|
|
99
|
+
◼ Deactivate Role(s)
|
|
100
|
+
✕ Exit
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Role Activation Flow
|
|
104
|
+
|
|
105
|
+
1. Select a subscription from your available Azure subscriptions
|
|
106
|
+
2. Choose one or more eligible roles to activate
|
|
107
|
+
3. Specify activation duration (1-8 hours)
|
|
108
|
+
4. Provide a justification for the activation
|
|
109
|
+
5. Confirm and activate
|
|
110
|
+
|
|
111
|
+
### Role Deactivation Flow
|
|
112
|
+
|
|
113
|
+
1. View all currently active roles across subscriptions
|
|
114
|
+
2. Select roles to deactivate
|
|
115
|
+
3. Confirm deactivation
|
|
116
|
+
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
### Available Scripts
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Run in development mode with hot reload
|
|
123
|
+
pnpm dev
|
|
124
|
+
|
|
125
|
+
# Build the TypeScript project
|
|
126
|
+
pnpm build
|
|
127
|
+
|
|
128
|
+
# Run the built application
|
|
129
|
+
pnpm start
|
|
130
|
+
|
|
131
|
+
# Lint the codebase
|
|
132
|
+
pnpm lint
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Project Structure
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
azp-cli/
|
|
139
|
+
├── src/
|
|
140
|
+
│ ├── index.ts # CLI entry point and command definitions
|
|
141
|
+
│ ├── auth.ts # Azure authentication handling
|
|
142
|
+
│ ├── azure-pim.ts # Azure PIM API operations
|
|
143
|
+
│ ├── cli.ts # Interactive menu and user flows
|
|
144
|
+
│ └── ui.ts # Terminal UI utilities (spinners, formatting)
|
|
145
|
+
├── package.json
|
|
146
|
+
├── tsconfig.json
|
|
147
|
+
└── README.md
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Tech Stack
|
|
151
|
+
|
|
152
|
+
- **TypeScript** - Type-safe JavaScript
|
|
153
|
+
- **Commander.js** - CLI framework
|
|
154
|
+
- **Inquirer.js** - Interactive prompts
|
|
155
|
+
- **Ora** - Elegant terminal spinners
|
|
156
|
+
- **Chalk** - Terminal string styling
|
|
157
|
+
- **Azure SDK** - Azure service integration
|
|
158
|
+
|
|
159
|
+
## Troubleshooting
|
|
160
|
+
|
|
161
|
+
### "Azure CLI not found" Error
|
|
162
|
+
|
|
163
|
+
Ensure Azure CLI is installed and accessible in your PATH:
|
|
164
|
+
```bash
|
|
165
|
+
az --version
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Authentication Errors
|
|
169
|
+
|
|
170
|
+
1. Make sure you're logged in to Azure CLI:
|
|
171
|
+
```bash
|
|
172
|
+
az login
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
2. Verify your account has PIM-eligible roles:
|
|
176
|
+
```bash
|
|
177
|
+
az account show
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
3. Check if you have the necessary permissions in Azure AD
|
|
181
|
+
|
|
182
|
+
### No Subscriptions Found
|
|
183
|
+
|
|
184
|
+
- Verify your Azure account has access to subscriptions
|
|
185
|
+
- Try refreshing your Azure CLI login: `az login --refresh`
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
This project is licensed under the ISC License.
|
|
190
|
+
|
|
191
|
+
## Author
|
|
192
|
+
|
|
193
|
+
**Tapan Meena** - [tapanmeena1998@gmail.com](mailto:tapanmeena1998@gmail.com)
|
|
194
|
+
|
|
195
|
+
## Contributing
|
|
196
|
+
|
|
197
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
198
|
+
|
|
199
|
+
1. Fork the repository
|
|
200
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
201
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
202
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
203
|
+
5. Open a Pull Request
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AzureCliCredential } from "@azure/identity";
|
|
2
|
+
import { Client } from "@microsoft/microsoft-graph-client";
|
|
3
|
+
export interface AuthContext {
|
|
4
|
+
credential: AzureCliCredential;
|
|
5
|
+
graphClient: Client;
|
|
6
|
+
userId: string;
|
|
7
|
+
userPrincipalName: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const authenticate: () => Promise<AuthContext>;
|
|
10
|
+
export declare const getArmToken: (credential: AzureCliCredential) => Promise<string>;
|
|
11
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAQ3D,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAWD,eAAO,MAAM,YAAY,QAAa,OAAO,CAAC,WAAW,CAgCxD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,YAAY,kBAAkB,KAAG,OAAO,CAAC,MAAM,CAMhF,CAAC"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getArmToken = exports.authenticate = void 0;
|
|
4
|
+
const identity_1 = require("@azure/identity");
|
|
5
|
+
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
6
|
+
const azureTokenCredentials_1 = require("@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials");
|
|
7
|
+
const ui_1 = require("./ui");
|
|
8
|
+
const GRAPH_SCOPES = ["https://graph.microsoft.com/.default"];
|
|
9
|
+
const ARM_SCOPES = ["https://management.azure.com/.default"];
|
|
10
|
+
let cachedCredential = null;
|
|
11
|
+
const getCredential = () => {
|
|
12
|
+
if (!cachedCredential) {
|
|
13
|
+
cachedCredential = new identity_1.AzureCliCredential();
|
|
14
|
+
}
|
|
15
|
+
return cachedCredential;
|
|
16
|
+
};
|
|
17
|
+
const authenticate = async () => {
|
|
18
|
+
(0, ui_1.startSpinner)("Authenticating with Azure CLI...");
|
|
19
|
+
try {
|
|
20
|
+
const credential = getCredential();
|
|
21
|
+
const authProvider = new azureTokenCredentials_1.TokenCredentialAuthenticationProvider(credential, { scopes: GRAPH_SCOPES });
|
|
22
|
+
const graphClient = microsoft_graph_client_1.Client.initWithMiddleware({ authProvider, defaultVersion: "v1.0" });
|
|
23
|
+
const user = await graphClient.api("/me").header("Accept-Language", "en-US").select("id,userPrincipalName,displayName").get();
|
|
24
|
+
const userId = user.id;
|
|
25
|
+
const userPrincipalName = user.userPrincipalName;
|
|
26
|
+
(0, ui_1.succeedSpinner)("Authentication successful");
|
|
27
|
+
(0, ui_1.showSummary)("User Information", [
|
|
28
|
+
{ label: "Name", value: user.displayName },
|
|
29
|
+
{ label: "Email", value: userPrincipalName },
|
|
30
|
+
]);
|
|
31
|
+
return {
|
|
32
|
+
credential,
|
|
33
|
+
graphClient,
|
|
34
|
+
userId,
|
|
35
|
+
userPrincipalName,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
(0, ui_1.failSpinner)("Authentication failed");
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.authenticate = authenticate;
|
|
44
|
+
const getArmToken = async (credential) => {
|
|
45
|
+
const tokenResponse = await credential.getToken(ARM_SCOPES);
|
|
46
|
+
if (!tokenResponse) {
|
|
47
|
+
throw new Error("Failed to acquire ARM token");
|
|
48
|
+
}
|
|
49
|
+
return tokenResponse.token;
|
|
50
|
+
};
|
|
51
|
+
exports.getArmToken = getArmToken;
|
|
52
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;AAAA,8CAAqD;AACrD,8EAA2D;AAC3D,iHAA8H;AAC9H,6BAA8E;AAE9E,MAAM,YAAY,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAE9D,MAAM,UAAU,GAAG,CAAC,uCAAuC,CAAC,CAAC;AAS7D,IAAI,gBAAgB,GAA8B,IAAI,CAAC;AAEvD,MAAM,aAAa,GAAG,GAAuB,EAAE;IAC7C,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,gBAAgB,GAAG,IAAI,6BAAkB,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,KAAK,IAA0B,EAAE;IAC3D,IAAA,iBAAY,EAAC,kCAAkC,CAAC,CAAC;IAEjD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QAGnC,MAAM,YAAY,GAAG,IAAI,6DAAqC,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QAErG,MAAM,WAAW,GAAG,+BAAM,CAAC,kBAAkB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;QAGxF,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC,GAAG,EAAE,CAAC;QAC9H,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAEjD,IAAA,mBAAc,EAAC,2BAA2B,CAAC,CAAC;QAC5C,IAAA,gBAAW,EAAC,kBAAkB,EAAE;YAC9B,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE;YAC1C,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE;SAC7C,CAAC,CAAC;QAEH,OAAO;YACL,UAAU;YACV,WAAW;YACX,MAAM;YACN,iBAAiB;SAClB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,gBAAW,EAAC,uBAAuB,CAAC,CAAC;QACrC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAhCW,QAAA,YAAY,gBAgCvB;AAEK,MAAM,WAAW,GAAG,KAAK,EAAE,UAA8B,EAAmB,EAAE;IACnF,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5D,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,aAAa,CAAC,KAAK,CAAC;AAC7B,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AzureCliCredential } from "@azure/identity";
|
|
2
|
+
export interface AzureSubscription {
|
|
3
|
+
subscriptionId: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
tenantId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface EligibleAzureRole {
|
|
8
|
+
id: string;
|
|
9
|
+
roleEligibilityScheduleId: string;
|
|
10
|
+
roleDefinitionId: string;
|
|
11
|
+
roleName: string;
|
|
12
|
+
roleDescription: string;
|
|
13
|
+
scope: string;
|
|
14
|
+
scopeDisplayName: string;
|
|
15
|
+
principalId: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ActiveAzureRole {
|
|
18
|
+
id: string;
|
|
19
|
+
roleDefinitionId: string;
|
|
20
|
+
roleName: string;
|
|
21
|
+
scope: string;
|
|
22
|
+
scopeDisplayName: string;
|
|
23
|
+
principalId: string;
|
|
24
|
+
linkedRoleEligibilityScheduleId: string;
|
|
25
|
+
startDateTime: string;
|
|
26
|
+
endDateTime: string;
|
|
27
|
+
subscriptionId: string;
|
|
28
|
+
subscriptionName: string;
|
|
29
|
+
}
|
|
30
|
+
export interface AzureActivationRequest {
|
|
31
|
+
roleEligibilityScheduleId: string;
|
|
32
|
+
roleDefinitionId: string;
|
|
33
|
+
roleName: string;
|
|
34
|
+
scope: string;
|
|
35
|
+
principalId: string;
|
|
36
|
+
justification: string;
|
|
37
|
+
durationHours: number;
|
|
38
|
+
}
|
|
39
|
+
export declare const fetchSubscriptions: (credential: AzureCliCredential) => Promise<AzureSubscription[]>;
|
|
40
|
+
export declare const fetchEligibleRolesForSubscription: (credential: AzureCliCredential, subscriptionId: string, subscriptionName: string, principalId: string) => Promise<EligibleAzureRole[]>;
|
|
41
|
+
export declare const listActiveAzureRoles: (credential: AzureCliCredential, subscriptionId: string, subscriptionName: string, principalId: string) => Promise<ActiveAzureRole[]>;
|
|
42
|
+
export declare const activateAzureRole: (credential: AzureCliCredential, request: AzureActivationRequest, subscriptionId: string) => Promise<void>;
|
|
43
|
+
export declare const deactivateAzureRole: (credential: AzureCliCredential, scope: string, roleEligibilityScheduleId: string, subscriptionId: string, principalId: string, roleDefinitionId: string, roleName?: string) => Promise<void>;
|
|
44
|
+
//# sourceMappingURL=azure-pim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-pim.d.ts","sourceRoot":"","sources":["../src/azure-pim.ts"],"names":[],"mappings":"AAEA,OAAO,EA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kB,MAAM,EACxB,aAAa,MAAM,KAClB,OAAO,CAAC,iBAAiB,EAAE,CAqC7B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,YAAY,kBAAkB,EAC9B,gBAAgB,MAAM,EACtB,kBAAkB,MAAM,EACxB,aAAa,MAAM,KAClB,OAAO,CAAC,eAAe,EAAE,CAwC3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAU,YAAY,kBAAkB,EAAE,SAAS,sBAAsB,EAAE,gBAAgB,MAAM,KAAG,OAAO,CAAC,IAAI,CAgD7I,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,YAAY,kBAAkB,EAC9B,OAAO,MAAM,EACb,2BAA2B,MAAM,EACjC,gBAAgB,MAAM,EACtB,aAAa,MAAM,EACnB,kBAAkB,MAAM,EACxB,WAAW,MAAM,KAChB,OAAO,CAAC,IAAI,CAoBd,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deactivateAzureRole = exports.activateAzureRole = exports.listActiveAzureRoles = exports.fetchEligibleRolesForSubscription = exports.fetchSubscriptions = void 0;
|
|
4
|
+
const arm_authorization_1 = require("@azure/arm-authorization");
|
|
5
|
+
const arm_resources_subscriptions_1 = require("@azure/arm-resources-subscriptions");
|
|
6
|
+
const uuid_1 = require("uuid");
|
|
7
|
+
const ui_1 = require("./ui");
|
|
8
|
+
const fetchSubscriptions = async (credential) => {
|
|
9
|
+
(0, ui_1.startSpinner)("Fetching Azure subscriptions...");
|
|
10
|
+
const subscriptionClient = new arm_resources_subscriptions_1.SubscriptionClient(credential);
|
|
11
|
+
const subscriptions = [];
|
|
12
|
+
for await (const sub of subscriptionClient.subscriptions.list()) {
|
|
13
|
+
subscriptions.push({
|
|
14
|
+
subscriptionId: sub.subscriptionId || "",
|
|
15
|
+
displayName: sub.displayName || "N/A",
|
|
16
|
+
tenantId: sub.tenantId || "",
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
(0, ui_1.succeedSpinner)(`Found ${subscriptions.length} subscription(s)`);
|
|
20
|
+
return subscriptions;
|
|
21
|
+
};
|
|
22
|
+
exports.fetchSubscriptions = fetchSubscriptions;
|
|
23
|
+
const fetchEligibleRolesForSubscription = async (credential, subscriptionId, subscriptionName, principalId) => {
|
|
24
|
+
(0, ui_1.startSpinner)(`Fetching eligible roles for "${subscriptionName}"...`);
|
|
25
|
+
const client = new arm_authorization_1.AuthorizationManagementClient(credential, subscriptionId);
|
|
26
|
+
const scope = `/subscriptions/${subscriptionId}`;
|
|
27
|
+
const eligibleRoles = [];
|
|
28
|
+
try {
|
|
29
|
+
const schedules = client.roleEligibilitySchedules.listForScope(scope, {
|
|
30
|
+
filter: `asTarget()`,
|
|
31
|
+
});
|
|
32
|
+
for await (const schedule of schedules) {
|
|
33
|
+
if (schedule.id && schedule.roleDefinitionId) {
|
|
34
|
+
eligibleRoles.push({
|
|
35
|
+
id: schedule.id,
|
|
36
|
+
roleEligibilityScheduleId: schedule.id,
|
|
37
|
+
roleDefinitionId: schedule.roleDefinitionId,
|
|
38
|
+
roleName: schedule.expandedProperties?.roleDefinition?.displayName || "Unknown Role",
|
|
39
|
+
roleDescription: "No description available",
|
|
40
|
+
scope: schedule.scope || scope,
|
|
41
|
+
scopeDisplayName: getScopeDisplayName(schedule.scope || scope),
|
|
42
|
+
principalId: schedule.principalId || principalId,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
(0, ui_1.succeedSpinner)(`Found ${eligibleRoles.length} eligible role(s) for "${subscriptionName}"`);
|
|
47
|
+
return eligibleRoles;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error.statusCode === 403 || error.code === "AuthorizationFailed") {
|
|
51
|
+
(0, ui_1.warnSpinner)(`Insufficient permissions for subscription "${subscriptionName}"`);
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
(0, ui_1.failSpinner)(`Failed to fetch eligible roles for "${subscriptionName}"`);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.fetchEligibleRolesForSubscription = fetchEligibleRolesForSubscription;
|
|
59
|
+
const listActiveAzureRoles = async (credential, subscriptionId, subscriptionName, principalId) => {
|
|
60
|
+
(0, ui_1.startSpinner)(`Fetching active roles for "${subscriptionName}"...`);
|
|
61
|
+
const client = new arm_authorization_1.AuthorizationManagementClient(credential, subscriptionId);
|
|
62
|
+
const scope = `/subscriptions/${subscriptionId}`;
|
|
63
|
+
const activeRoles = [];
|
|
64
|
+
try {
|
|
65
|
+
const schedules = client.roleAssignmentSchedules.listForScope(scope, {
|
|
66
|
+
filter: `asTarget()`,
|
|
67
|
+
});
|
|
68
|
+
for await (const schedule of schedules) {
|
|
69
|
+
if (schedule.id && schedule.roleDefinitionId && schedule.assignmentType === "Activated") {
|
|
70
|
+
activeRoles.push({
|
|
71
|
+
id: schedule.id,
|
|
72
|
+
roleDefinitionId: schedule.roleDefinitionId,
|
|
73
|
+
roleName: schedule.expandedProperties?.roleDefinition?.displayName || "Unknown Role",
|
|
74
|
+
scope: schedule.scope || scope,
|
|
75
|
+
scopeDisplayName: getScopeDisplayName(schedule.scope || scope),
|
|
76
|
+
principalId: schedule.principalId || principalId,
|
|
77
|
+
linkedRoleEligibilityScheduleId: schedule.linkedRoleEligibilityScheduleId || "",
|
|
78
|
+
startDateTime: schedule.startDateTime?.toISOString() || "",
|
|
79
|
+
endDateTime: schedule.endDateTime?.toISOString() || "",
|
|
80
|
+
subscriptionId,
|
|
81
|
+
subscriptionName,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
(0, ui_1.succeedSpinner)(`Found ${activeRoles.length} active role(s) for "${subscriptionName}"`);
|
|
86
|
+
return activeRoles;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (error.statusCode === 403 || error.code === "AuthorizationFailed") {
|
|
90
|
+
(0, ui_1.warnSpinner)(`Insufficient permissions for subscription "${subscriptionName}"`);
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
(0, ui_1.failSpinner)(`Failed to fetch active roles for "${subscriptionName}"`);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.listActiveAzureRoles = listActiveAzureRoles;
|
|
98
|
+
const activateAzureRole = async (credential, request, subscriptionId) => {
|
|
99
|
+
const client = new arm_authorization_1.AuthorizationManagementClient(credential, subscriptionId);
|
|
100
|
+
const requestName = (0, uuid_1.v4)();
|
|
101
|
+
const now = new Date();
|
|
102
|
+
const durationISO = `PT${request.durationHours}H`;
|
|
103
|
+
const linkedScheduleId = request.roleEligibilityScheduleId.includes("/")
|
|
104
|
+
? request.roleEligibilityScheduleId
|
|
105
|
+
: `${request.scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/${request.roleEligibilityScheduleId}`;
|
|
106
|
+
const requestBody = {
|
|
107
|
+
principalId: request.principalId,
|
|
108
|
+
roleDefinitionId: request.roleDefinitionId,
|
|
109
|
+
requestType: "SelfActivate",
|
|
110
|
+
linkedRoleEligibilityScheduleId: linkedScheduleId,
|
|
111
|
+
scheduleInfo: {
|
|
112
|
+
startDateTime: now,
|
|
113
|
+
expiration: {
|
|
114
|
+
type: "AfterDuration",
|
|
115
|
+
duration: durationISO,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
justification: request.justification,
|
|
119
|
+
};
|
|
120
|
+
(0, ui_1.startSpinner)(`Activating role "${request.roleName}"...`);
|
|
121
|
+
try {
|
|
122
|
+
const response = await client.roleAssignmentScheduleRequests.create(request.scope, requestName, requestBody);
|
|
123
|
+
(0, ui_1.succeedSpinner)(`Activation request submitted for "${request.roleName}"`);
|
|
124
|
+
(0, ui_1.logBlank)();
|
|
125
|
+
if (response.status) {
|
|
126
|
+
console.log(` Status: ${(0, ui_1.formatStatus)(response.status)}`);
|
|
127
|
+
}
|
|
128
|
+
if (response.status === "Approved" || response.status === "Provisioned") {
|
|
129
|
+
(0, ui_1.logSuccess)(`Role "${request.roleName}" has been activated successfully`);
|
|
130
|
+
}
|
|
131
|
+
else if (response.status === "Denied") {
|
|
132
|
+
(0, ui_1.logError)(`Role activation for "${request.roleName}" has been denied`);
|
|
133
|
+
}
|
|
134
|
+
else if (response.status === "PendingApproval") {
|
|
135
|
+
(0, ui_1.logWarning)(`Role activation for "${request.roleName}" is pending approval`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
(0, ui_1.failSpinner)(`Failed to activate role "${request.roleName}"`);
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
exports.activateAzureRole = activateAzureRole;
|
|
144
|
+
const deactivateAzureRole = async (credential, scope, roleEligibilityScheduleId, subscriptionId, principalId, roleDefinitionId, roleName) => {
|
|
145
|
+
const client = new arm_authorization_1.AuthorizationManagementClient(credential, subscriptionId);
|
|
146
|
+
const requestName = (0, uuid_1.v4)();
|
|
147
|
+
const displayName = roleName || "role";
|
|
148
|
+
(0, ui_1.startSpinner)(`Deactivating "${displayName}"...`);
|
|
149
|
+
try {
|
|
150
|
+
await client.roleAssignmentScheduleRequests.create(scope, requestName, {
|
|
151
|
+
principalId,
|
|
152
|
+
roleDefinitionId,
|
|
153
|
+
requestType: "SelfDeactivate",
|
|
154
|
+
linkedRoleEligibilityScheduleId: roleEligibilityScheduleId,
|
|
155
|
+
});
|
|
156
|
+
(0, ui_1.succeedSpinner)(`Successfully deactivated "${displayName}"`);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
(0, ui_1.failSpinner)(`Failed to deactivate "${displayName}"`);
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
exports.deactivateAzureRole = deactivateAzureRole;
|
|
164
|
+
const getScopeDisplayName = (scope) => {
|
|
165
|
+
if (!scope)
|
|
166
|
+
return "Unknown Scope";
|
|
167
|
+
const parts = scope.split("/");
|
|
168
|
+
if (scope.includes("/managementGroups/")) {
|
|
169
|
+
const mgIndex = parts.indexOf("managementGroups");
|
|
170
|
+
return `Management Group: ${parts[mgIndex + 1]}`;
|
|
171
|
+
}
|
|
172
|
+
if (scope.includes("/resourceGroups/")) {
|
|
173
|
+
const rgIndex = parts.indexOf("resourceGroups");
|
|
174
|
+
const subIndex = parts.indexOf("subscriptions");
|
|
175
|
+
return `Resource Group: ${parts[rgIndex + 1]} (Subscription: ${parts[subIndex + 1]})`;
|
|
176
|
+
}
|
|
177
|
+
if (scope.includes("/subscriptions/")) {
|
|
178
|
+
const subIndex = parts.indexOf("subscriptions");
|
|
179
|
+
return `Subscription: ${parts[subIndex + 1]}`;
|
|
180
|
+
}
|
|
181
|
+
return scope;
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=azure-pim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-pim.js","sourceRoot":"","sources":["../src/azure-pim.ts"],"names":[],"mappings":";;;AAAA,gEAAyE;AACzE,oFAAwE;AAExE,+BAAoC;AACpC,6BAAwI;AA2CjI,MAAM,kBAAkB,GAAG,KAAK,EAAE,UAA8B,EAAgC,EAAE;IACvG,IAAA,iBAAY,EAAC,iCAAiC,CAAC,CAAC;IAEhD,MAAM,kBAAkB,GAAG,IAAI,gDAAkB,CAAC,UAAU,CAAC,CAAC;IAC9D,MAAM,aAAa,GAAwB,EAAE,CAAC;IAE9C,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,kBAAkB,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC;QAChE,aAAa,CAAC,IAAI,CAAC;YACjB,cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE;YACxC,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,KAAK;YACrC,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;SAC7B,CAAC,CAAC;I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C;IACd,CAAC;AACH,CAAC,CAAC;AA5BW,QAAA,mBAAmB,uBA4B9B;AAEF,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE;IACpD,IAAI,CAAC,KAAK;QAAE,OAAO,eAAe,CAAC;IAEnC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAG/B,IAAI,KAAK,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAClD,OAAO,qBAAqB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;IACnD,CAAC;IAGD,IAAI,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAChD,OAAO,mBAAmB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,mBAAmB,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC;IACxF,CAAC;IAGD,IAAI,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAChD,OAAO,iBAAiB,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC;IAChD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AuthContext } from "./auth";
|
|
2
|
+
export declare const showMainMenu: (authContext: AuthContext) => Promise<void>;
|
|
3
|
+
export declare const handleActivation: (authContext: AuthContext) => Promise<void>;
|
|
4
|
+
export declare const handleDeactivation: (authContext: AuthContext) => Promise<void>;
|
|
5
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AA6CrC,eAAO,MAAM,YAAY,GAAU,aAAa,WAAW,KAAG,OAAO,CAAC,IAAI,CAgCzE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,aAAa,WAAW,KAAG,OAAO,CAAC,IAAI,CAwL7E,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,aAAa,WAAW,KAAG,OAAO,CAAC,IAAI,CAqI/E,CAAC"}
|