Commit 72d0a47
authored
Idempotent setup: blueprint/infrastructure discovery (#144)
* Idempotent setup: blueprint/infrastructure discovery
Implement complete idempotency for a365 setup commands to handle
repeated executions gracefully and provide accurate user feedback.
Changes:
- Add BlueprintLookupService for dual-path blueprint discovery (objectId
primary, displayName fallback for migration scenarios)
- Add FederatedCredentialService for FIC existence checks and creation
- Persist blueprint objectIds (app + service principal) to config for
authoritative future lookups
- Track idempotency flags: InfrastructureAlreadyExisted,
BlueprintAlreadyExisted, EndpointAlreadyExisted
- Update setup summary to display "configured (already exists)" vs "created"
Fixes:
- Move endpoint error log after idempotency check (no more false ERR)
- Convert verbose internal logs to LogDebug ("Saved dynamic state", auth checks)
- Fix SaveStateAsync usage to prevent service principal ID overwrites
Testing:
- Add BlueprintLookupServiceTests (8 tests)
- Add FederatedCredentialServiceTests (11 tests)
- All 777/777 tests passing
Wire new services through DI container and all setup subcommands.
* Improve federated credential and consent handling in CLI
- Cleanup now deletes federated credentials before blueprint removal, using new FederatedCredentialService methods with endpoint fallback.
- FederatedCredentialService enhanced for robust listing, creation, deletion, and error handling; skips malformed entries and supports propagation retries.
- Blueprint setup refactored to consistently handle federated credential creation/validation and admin consent, with consent checked before prompting.
- Added AdminConsentHelper.CheckConsentExistsAsync to verify existing grants.
- Improved idempotency tracking and summary logging for permissions.
- Updated CleanupCommand and tests to require/use FederatedCredentialService.
- Expanded tests for federated credential and consent logic.
- Refined bot endpoint deletion to avoid false positives.
- Improved logging and user feedback throughout blueprint and cleanup flows.
* Refactor: move model classes to dedicated files
Moved blueprint, federated credential, and password credential model classes from service classes to new files in the Models namespace for better organization. Updated services to use the new models. Improved logging for messaging endpoint setup and Azure CLI Python bitness detection.
* Refactor FIC naming and logging; clean up retry logic
- Update FIC naming to use display name only (no objectId), as uniqueness is per app, not tenant-wide.
- Improve error logging for missing blueprint identifiers by removing null-coalescing fallback.
- Remove unused variable assignment from federated credential retry logic.1 parent 13a720f commit 72d0a47
File tree
29 files changed
+2786
-297
lines changed- src
- Microsoft.Agents.A365.DevTools.Cli
- Commands
- SetupSubcommands
- Models
- Services
- Helpers
- Tests/Microsoft.Agents.A365.DevTools.Cli.Tests
- Commands
- Services
29 files changed
+2786
-297
lines changedLines changed: 64 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
127 | 153 | | |
| 154 | + | |
128 | 155 | | |
129 | 156 | | |
130 | 157 | | |
| |||
395 | 422 | | |
396 | 423 | | |
397 | 424 | | |
| 425 | + | |
398 | 426 | | |
399 | 427 | | |
400 | 428 | | |
| |||
447 | 475 | | |
448 | 476 | | |
449 | 477 | | |
450 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
451 | 506 | | |
452 | 507 | | |
453 | 508 | | |
| |||
467 | 522 | | |
468 | 523 | | |
469 | 524 | | |
470 | | - | |
| 525 | + | |
471 | 526 | | |
472 | 527 | | |
473 | 528 | | |
| |||
488 | 543 | | |
489 | 544 | | |
490 | 545 | | |
491 | | - | |
| 546 | + | |
492 | 547 | | |
493 | 548 | | |
494 | 549 | | |
495 | 550 | | |
496 | 551 | | |
497 | 552 | | |
498 | 553 | | |
499 | | - | |
| 554 | + | |
500 | 555 | | |
501 | 556 | | |
502 | 557 | | |
| |||
506 | 561 | | |
507 | 562 | | |
508 | 563 | | |
509 | | - | |
| 564 | + | |
510 | 565 | | |
511 | 566 | | |
512 | 567 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | | - | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
Lines changed: 20 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
137 | | - | |
138 | | - | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
| 167 | + | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
172 | | - | |
173 | | - | |
| 171 | + | |
174 | 172 | | |
175 | 173 | | |
176 | 174 | | |
177 | 175 | | |
178 | | - | |
| 176 | + | |
179 | 177 | | |
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
183 | 181 | | |
184 | 182 | | |
185 | 183 | | |
186 | | - | |
| 184 | + | |
187 | 185 | | |
188 | 186 | | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
192 | | - | |
| 190 | + | |
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
196 | 194 | | |
197 | 195 | | |
198 | 196 | | |
199 | 197 | | |
200 | | - | |
| 198 | + | |
201 | 199 | | |
202 | 200 | | |
203 | 201 | | |
204 | 202 | | |
205 | | - | |
| 203 | + | |
206 | 204 | | |
207 | 205 | | |
208 | 206 | | |
209 | 207 | | |
210 | 208 | | |
211 | 209 | | |
212 | 210 | | |
213 | | - | |
| 211 | + | |
214 | 212 | | |
215 | 213 | | |
216 | 214 | | |
| |||
229 | 227 | | |
230 | 228 | | |
231 | 229 | | |
232 | | - | |
233 | | - | |
234 | | - | |
| 230 | + | |
235 | 231 | | |
236 | 232 | | |
237 | 233 | | |
| |||
240 | 236 | | |
241 | 237 | | |
242 | 238 | | |
243 | | - | |
244 | | - | |
245 | 239 | | |
246 | | - | |
| 240 | + | |
247 | 241 | | |
248 | 242 | | |
249 | 243 | | |
| |||
254 | 248 | | |
255 | 249 | | |
256 | 250 | | |
| 251 | + | |
257 | 252 | | |
258 | 253 | | |
259 | 254 | | |
| |||
270 | 265 | | |
271 | 266 | | |
272 | 267 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | 268 | | |
278 | 269 | | |
279 | 270 | | |
| |||
288 | 279 | | |
289 | 280 | | |
290 | 281 | | |
291 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
292 | 285 | | |
293 | 286 | | |
294 | 287 | | |
| 288 | + | |
295 | 289 | | |
| 290 | + | |
296 | 291 | | |
297 | 292 | | |
298 | 293 | | |
| |||
350 | 345 | | |
351 | 346 | | |
352 | 347 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | 348 | | |
358 | 349 | | |
359 | 350 | | |
| |||
381 | 372 | | |
382 | 373 | | |
383 | 374 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | 375 | | |
390 | 376 | | |
391 | 377 | | |
| |||
0 commit comments