ownerlens 0.1.7 → 0.1.9-preview.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/README.md +27 -99
- package/bin/ownerlens.js +6 -6
- package/contracts/entra/snapshot.v0.4.schema.json +4 -1
- package/dist/assets/index-CpgQimUK.js +12 -0
- package/dist/assets/index-CzOsq9Ac.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +2 -1
- package/powershell/OwnerLens/OwnerLens.psd1 +30 -0
- package/powershell/OwnerLens/OwnerLens.psm1 +23 -0
- package/{tools/utils.ps1 → powershell/OwnerLens/Private/ConvertTo-EntraSnapshotObjects.ps1} +8 -0
- package/{tools/azure-activity-check.ps1 → powershell/OwnerLens/Private/Get-AzureMonitorActivityLogs.ps1} +8 -0
- package/powershell/OwnerLens/Private/Get-OwnerLensFreePort.ps1 +20 -0
- package/powershell/OwnerLens/Private/Get-OwnerLensPaths.ps1 +22 -0
- package/powershell/OwnerLens/Private/Get-OwnerLensRuntime.ps1 +62 -0
- package/{tools/prepare-entra-snapshot.ps1 → powershell/OwnerLens/Private/Invoke-OwnerLensPrepareEntraSnapshot.ps1} +12 -9
- package/{tools/prepare-resource-snapshot.ps1 → powershell/OwnerLens/Private/Invoke-OwnerLensPrepareResourceSnapshot.ps1} +13 -4
- package/powershell/OwnerLens/Private/New-OwnerLensRuntimeToken.ps1 +16 -0
- package/powershell/OwnerLens/Private/New-OwnerLensStatusObject.ps1 +26 -0
- package/powershell/OwnerLens/Private/Read-OwnerLensState.ps1 +23 -0
- package/powershell/OwnerLens/Private/Remove-OwnerLensState.ps1 +17 -0
- package/powershell/OwnerLens/Private/Test-OwnerLensTrackedProcess.ps1 +39 -0
- package/powershell/OwnerLens/Private/Wait-OwnerLensServer.ps1 +35 -0
- package/powershell/OwnerLens/Private/Write-OwnerLensState.ps1 +19 -0
- package/powershell/OwnerLens/Public/Get-OwnerLensStatus.ps1 +31 -0
- package/powershell/OwnerLens/Public/Install-OwnerLensRuntime.ps1 +41 -0
- package/powershell/OwnerLens/Public/Invoke-OwnerLensCollectAzure.ps1 +132 -0
- package/powershell/OwnerLens/Public/Invoke-OwnerLensCollectEntra.ps1 +127 -0
- package/powershell/OwnerLens/Public/Open-OwnerLens.ps1 +35 -0
- package/powershell/OwnerLens/Public/Start-OwnerLens.ps1 +82 -0
- package/powershell/OwnerLens/Public/Stop-OwnerLens.ps1 +37 -0
- package/powershell/OwnerLens/README.md +52 -0
- package/src/components/azure/AzureComponent.test.tsx +286 -0
- package/src/components/azure/AzureComponent.tsx +5 -5
- package/src/components/azure/EntraUserGroupsDropdown.tsx +153 -0
- package/src/components/azure/ManagedIdentityComponent.test.tsx +28 -2
- package/src/components/azure/ManagedIdentityComponent.tsx +6 -3
- package/src/components/azure/OwnershipEvidenceComponent.tsx +65 -158
- package/src/components/azure/ResourceGroupComponent.tsx +6 -3
- package/src/components/azure/ServicePrincipalComponent.test.tsx +27 -4
- package/src/components/azure/ServicePrincipalComponent.tsx +5 -2
- package/src/components/azure/ServicePrincipalFieldRenderers.tsx +5 -1
- package/src/components/azure/TagBadges.test.tsx +19 -0
- package/src/components/azure/TagBadges.tsx +56 -0
- package/src/components/azure/api.ts +75 -13
- package/src/components/azure/ownershipEvidenceFields.ts +92 -0
- package/src/components/azure/ownershipEvidenceFormatters.ts +64 -0
- package/src/core/azure/entra/managedIdentity.ts +1 -0
- package/src/core/azure/entra/types.ts +9 -1
- package/src/core/azure/resources.ts +5 -6
- package/src/core/azure/tags.ts +22 -0
- package/src/core/runtime/rest.ts +30 -0
- package/src/core/runtime/snapshotContractValidator.test.ts +12 -0
- package/src/providers/azure/inputTransferObject/generated/EntraSnapshot.ts +1 -1
- package/src/providers/azure/ownership/principalOwnerProjection.test.ts +58 -1
- package/src/providers/azure/ownership/principalOwnerProjection.ts +92 -3
- package/src/providers/azure/ownership/resolveAzureOwner.ts +3 -2
- package/src/providers/azure/runtime/LocalReportRuntime.duckdb.test.ts +100 -0
- package/src/providers/azure/runtime/LocalReportRuntime.test.ts +113 -0
- package/src/providers/azure/runtime/LocalReportRuntime.ts +6 -0
- package/src/providers/azure/runtime/entra/EntraCollectionQueryService.ts +6 -1
- package/src/providers/azure/runtime/entra/LocalEntraReportRuntime.ts +11 -1
- package/src/providers/azure/runtime/entra/entraServicePrincipalMapper.ts +2 -1
- package/src/providers/azure/runtime/entra/groupMembersTable.ts +32 -2
- package/src/providers/azure/runtime/entra/localReportRuntimeRest.ts +4 -0
- package/src/providers/azure/runtime/localReportRuntimeRest.ts +1 -0
- package/src/providers/azure/runtime/ownership/OwnershipEvidenceQueryService.test.ts +76 -3
- package/src/providers/azure/runtime/resources/AzureResourcesCollectionQueryService.ts +2 -1
- package/src/providers/azure/runtime/resources/resourceGroupOwnership.test.ts +1 -1
- package/src/{components/azure/ClosableAzureTab.tsx → report/components/ClosableTab.tsx} +4 -4
- package/tools/README.md +25 -35
- package/dist/assets/index-BGYxOSO4.css +0 -1
- package/dist/assets/index-D7COTwVU.js +0 -11
- package/tools/collect-azure.ps1 +0 -54
- package/tools/collect-entra.ps1 +0 -52
- package/tools/collect-scripts.test.ts +0 -33
- package/tools/prepare-entra-snapshot.Tests.ps1 +0 -125
- package/tools/prepare-entra-snapshot.test.ts +0 -51
package/README.md
CHANGED
|
@@ -48,8 +48,6 @@ flowchart TD
|
|
|
48
48
|
|
|
49
49
|
## Requirements
|
|
50
50
|
|
|
51
|
-
- Node.js 20 or newer
|
|
52
|
-
- npm
|
|
53
51
|
- PowerShell 7 or Windows PowerShell for snapshot export scripts
|
|
54
52
|
- Azure PowerShell and Microsoft Graph PowerShell modules when exporting data
|
|
55
53
|
|
|
@@ -84,121 +82,51 @@ Sign in to Microsoft Graph:
|
|
|
84
82
|
Connect-MgGraph -TenantId "<tenant-id>" -Scopes "Application.Read.All","Group.Read.All","Directory.Read.All"
|
|
85
83
|
```
|
|
86
84
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npx ownerlens collect:azure -SubscriptionIds "sub-id-1,sub-id-2"
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Create the Entra snapshot:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
npx ownerlens collect:entra -TenantId "<tenant-id>"
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
More script options are documented in [tools/README.md](tools/README.md).
|
|
100
|
-
|
|
101
|
-
Snapshot files can contain tenant, subscription, resource, identity, group, and
|
|
102
|
-
activity-log metadata. Review them before sharing. Files matching
|
|
103
|
-
`data/*snapshot.json` are ignored by git.
|
|
104
|
-
|
|
105
|
-
## Local Development
|
|
106
|
-
|
|
107
|
-
Clone the repository, install dependencies, then run the development server:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
npm install
|
|
111
|
-
npm run dev
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Open the Vite URL printed by the command, usually `http://127.0.0.1:5173`.
|
|
115
|
-
|
|
116
|
-
You can also exercise the published CLI entrypoint from a repository checkout:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
npm run start
|
|
120
|
-
npm run preview
|
|
121
|
-
npm run collect:azure -- -SubscriptionIds "sub-id-1,sub-id-2"
|
|
122
|
-
npm run collect:entra -- -TenantId "<tenant-id>"
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
For a production build:
|
|
85
|
+
Import the PowerShell module:
|
|
126
86
|
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Configure Ownership Rules
|
|
132
|
-
|
|
133
|
-
Edit [src/core/config.ts](src/core/config.ts) to change ownership resolution defaults.
|
|
134
|
-
|
|
135
|
-
`ownerTags` is ordered by priority. The tag value is treated as the owner
|
|
136
|
-
identity and can be a group name, security group alias, or user email.
|
|
137
|
-
|
|
138
|
-
```ts
|
|
139
|
-
export const appConfig = {
|
|
140
|
-
azure: {
|
|
141
|
-
ownership: {
|
|
142
|
-
ownerTags: [
|
|
143
|
-
{ name: "ownerGroup", confidence: "high" },
|
|
144
|
-
{ name: "costCenter", confidence: "high" },
|
|
145
|
-
{ name: "owner", confidence: "medium" }
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Test
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
npm test
|
|
87
|
+
```powershell
|
|
88
|
+
Import-Module ./artifacts/OwnerLens/OwnerLens.psd1 -Force
|
|
156
89
|
```
|
|
157
90
|
|
|
158
|
-
|
|
91
|
+
Start OwnerLens from PowerShell on Windows:
|
|
159
92
|
|
|
160
|
-
```
|
|
161
|
-
|
|
93
|
+
```powershell
|
|
94
|
+
Start-OwnerLens
|
|
95
|
+
Open-OwnerLens
|
|
96
|
+
Get-OwnerLensStatus
|
|
97
|
+
Stop-OwnerLens
|
|
162
98
|
```
|
|
163
99
|
|
|
164
|
-
|
|
100
|
+
`Start-OwnerLens` starts the local app on `127.0.0.1` using a free port and
|
|
101
|
+
stores runtime state under `$env:LOCALAPPDATA\OwnerLens`. To use a specific data
|
|
102
|
+
directory or port, pass them explicitly:
|
|
165
103
|
|
|
166
|
-
```
|
|
167
|
-
|
|
104
|
+
```powershell
|
|
105
|
+
Start-OwnerLens -DataPath C:\OwnerLensData -Port 4174
|
|
168
106
|
```
|
|
169
107
|
|
|
170
|
-
|
|
171
|
-
enforces the current component coverage baseline so new UI changes do not
|
|
172
|
-
silently reduce coverage.
|
|
173
|
-
|
|
174
|
-
## Dependency Graph
|
|
175
|
-
|
|
176
|
-
Generate a folder-level dependency graph:
|
|
108
|
+
Create the resource snapshot:
|
|
177
109
|
|
|
178
|
-
```
|
|
179
|
-
|
|
110
|
+
```powershell
|
|
111
|
+
Invoke-OwnerLensCollectAzure -SubscriptionIds "sub-id-1,sub-id-2"
|
|
180
112
|
```
|
|
181
113
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
Generate a file-level dependency graph:
|
|
114
|
+
Create the Entra snapshot:
|
|
185
115
|
|
|
186
|
-
```
|
|
187
|
-
|
|
116
|
+
```powershell
|
|
117
|
+
Invoke-OwnerLensCollectEntra -TenantId "<tenant-id>"
|
|
188
118
|
```
|
|
189
119
|
|
|
190
|
-
|
|
120
|
+
More collector options are documented in [tools/README.md](tools/README.md).
|
|
191
121
|
|
|
192
|
-
|
|
122
|
+
Snapshot files can contain tenant, subscription, resource, identity, group, and
|
|
123
|
+
activity-log metadata. Review them before sharing. Files matching
|
|
124
|
+
`data/*snapshot.json` are ignored by git.
|
|
193
125
|
|
|
194
|
-
|
|
195
|
-
- `src/core/config.ts` contains ownership resolution configuration.
|
|
196
|
-
- `src/report` contains report UI, filtering, view helpers, and tests.
|
|
197
|
-
- `src/providers/azure` contains Azure and Entra domain models and ownership
|
|
198
|
-
analysis logic.
|
|
199
|
-
- `tools` contains PowerShell scripts for exporting local snapshot files.
|
|
126
|
+
## Development
|
|
200
127
|
|
|
201
|
-
|
|
128
|
+
See [DEVELOPMENT.md](DEVELOPMENT.md) for local development, testing, dependency
|
|
129
|
+
graph, project structure, and ownership rule configuration notes.
|
|
202
130
|
|
|
203
131
|
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for local
|
|
204
132
|
development expectations.
|
package/bin/ownerlens.js
CHANGED
|
@@ -15,10 +15,10 @@ const dataDir = ensureDataDirectory(invocationRoot);
|
|
|
15
15
|
printDataDirectorySummary(dataDir);
|
|
16
16
|
|
|
17
17
|
const commands = new Map([
|
|
18
|
-
["collect:entra", "
|
|
19
|
-
["collect-azure", "
|
|
20
|
-
["collect:azure", "
|
|
21
|
-
["collect-entra", "
|
|
18
|
+
["collect:entra", { root: "powershell", script: join("OwnerLens", "Public", "Invoke-OwnerLensCollectEntra.ps1") }],
|
|
19
|
+
["collect-azure", { root: "powershell", script: join("OwnerLens", "Public", "Invoke-OwnerLensCollectAzure.ps1") }],
|
|
20
|
+
["collect:azure", { root: "powershell", script: join("OwnerLens", "Public", "Invoke-OwnerLensCollectAzure.ps1") }],
|
|
21
|
+
["collect-entra", { root: "powershell", script: join("OwnerLens", "Public", "Invoke-OwnerLensCollectEntra.ps1") }]
|
|
22
22
|
]);
|
|
23
23
|
|
|
24
24
|
if (command === "help" || command === "--help" || command === "-h") {
|
|
@@ -36,9 +36,9 @@ if (commands.has(command)) {
|
|
|
36
36
|
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function runPowerShellScript(
|
|
39
|
+
function runPowerShellScript(script, args, options = {}) {
|
|
40
40
|
const pwsh = resolvePowerShell();
|
|
41
|
-
const scriptPath = join(packageRoot,
|
|
41
|
+
const scriptPath = join(packageRoot, script.root, script.script);
|
|
42
42
|
const psArgs = [
|
|
43
43
|
"-NoProfile",
|
|
44
44
|
"-ExecutionPolicy",
|