Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jamilbk
Copy link
Member

@jamilbk jamilbk commented Sep 14, 2025

As part of testing the new Entra sync implementation, it would be helpful to have a larger directory to build against. Since the Entra free plan allows unlimited users, groups, and members, this PR introduces a script that create create (and teardown) an arbitrary amount of test data in a given Entra directory.

Related: #6294
Related: #10324

Copilot AI review requested due to automatic review settings September 14, 2025 23:01
@vercel
Copy link

vercel bot commented Sep 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
firezone Ready Ready Preview Comment Sep 15, 2025 0:24am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive script for generating realistic test data in Microsoft Entra ID directories to support testing of the new Entra sync implementation. The script can create users, groups with hierarchical structures, and group memberships at scale while providing robust cleanup capabilities.

Key changes:

  • Added a Python script that creates fake Entra ID test data with configurable parameters
  • Implemented proper rate limiting, error handling, and retry mechanisms for Microsoft Graph API interactions
  • Added comprehensive cleanup functionality using unique tags to identify test data

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
scripts/generators/requirements.txt Dependencies for the Entra test data generation script
scripts/generators/entra.py Main Python script for creating and managing Entra ID test data
scripts/generators/README.md Basic documentation for the generators directory
.tool-versions Updated Python version from 3.11.9 to 3.11.13

jamilbk and others added 2 commits September 14, 2025 16:03
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Jamil <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Jamil <[email protected]>
@jamilbk jamilbk requested a review from Copilot September 14, 2025 23:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

"mailNickname": unique_username,
"userPrincipalName": f"{unique_username}@{self.entra_config.tenant_domain}",
"passwordProfile": {
"password": "TempPassword123!",
Copy link

Copilot AI Sep 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded password poses a security risk. Consider generating random passwords or making the password configurable through environment variables.

Copilot uses AI. Check for mistakes.
for resp in error_json["responses"][:3]: # Log first 3 errors
if resp.get("status") != 201:
logger.error(f"Individual error: {resp}")
except:
Copy link

Copilot AI Sep 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause catches all exceptions including system exceptions. Use a specific exception type like Exception or ValueError for better error handling.

Suggested change
except:
except Exception:

Copilot uses AI. Check for mistakes.
Comment on lines +417 to +418
# The message typically says "try after X seconds"
self.rate_limit_until = time.time() + 150 # Default 150 seconds
Copy link

Copilot AI Sep 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 150 should be defined as a named constant at the class level for better maintainability and configurability.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants