Azure-Samples / Azure-Samples/ms-identity-agent-identities

🟢 Low: Input Validation, Resiliency, and Duplication

Open
#23 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
PowerShell
Stars
7
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Medium-priority improvements for resilience, correctness, and maintainability.

#### 1. Input validation for APIs
- Controller methods accept strings (e.g., `agentIdentityName`, `agentUserIdentityUpn`) with little/no format or length checks.
- RECOMMENDATION: Add `[Required]`, `[StringLength]`, `[EmailAddress]`, and custom format checks for parameters.

#### 3. Minor logic/code duplication
- Multiple controllers/services duplicate string handling or validation patterns (e.g., extracting local-part from UPN via substring).
- RECOMMENDATION: Extract as helper methods/shared library.

#### 4. PowerShell: Hardcoded sleep delays
- `Start-Sleep` delays of "2/3 seconds" are used awaiting replication; could be too short/long, non-deterministic.
- RECOMMENDATION: Refactor to polling functions/loop with max attempts for actual resource readiness.

__Severity: low__

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by locating the controller methods, duplicated UPN string handling, and PowerShell Start-Sleep calls described in the issue; done means validated inputs, shared handling where appropriate, and readiness polling with bounded attempts.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
api, authentication, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.