Skip to main content

A package dedicated to creating new users in o365

Project description

M365 User Manager

A robust Python package for automating Microsoft 365 user management operations through Microsoft Graph API, with support for both local execution and Asio RPA integration.

Features

  • User Creation & Management

    • Create new M365 users with comprehensive profile details
    • Copy properties, groups, and roles from template users
    • Manage group memberships and license assignments
    • Handle phone number formatting and validation
  • License Management

    • Automatic license availability checking
    • Smart license name matching and resolution
    • Batch license assignment with detailed reporting
    • Support for all major Microsoft 365 license types
  • Security & Authentication

    • Secure password generation and sharing
    • Integration with Password Pusher and fallback services
    • Token management for Microsoft Graph API
    • Comprehensive error handling and logging
  • Environment Flexibility

    • Supports both local execution and Asio RPA environment
    • Environment-aware configuration loading
    • Unified logging across environments

Installation

# Clone the repository
gh repo clone VinnyVanGogh/m365_user_manager
cd m365-user-manager

# Install dependencies
pip install -r requirements.txt

Configuration

  1. Create a configuration file at environments/asio_365_config.json:
{
    "client_id": "your_client_id",
    "client_secret": "your_client_secret",
    "tenant_id": "your_tenant_id"
}

(Optional) Set up Discord webhook for logging:

  • Configure webhook URL through the input form or environment configuration

Usage

Basic Usage

from m365_user_manager import UserManagementOrchestrator

# Initialize and run the orchestrator
orchestrator = UserManagementOrchestrator()
orchestrator.run()

Creating a New User

from m365_user_manager import M365UserManager

# Initialize the manager
user_manager = M365UserManager(access_token, logger)

# Create a new user
result = user_manager.create_user(
    display_name="John Doe",
    email_address="john.doe@example.com",
    job_title="Software Engineer",
    department="Engineering",
    license_skus=["Microsoft 365 E3", "Power BI Pro"],
    groups=["Engineering Team", "All Company"]
)

Copying User Properties

# Create user by copying from template
result = user_manager.create_user(
    display_name="Jane Smith",
    email_address="jane.smith@example.com",
    user_to_copy="template@example.com",
    copy_licenses=True
)

Input Parameters

Parameter Description Required
display_name User's full name Yes
email_address User's email address Yes
password Initial password (generated if not provided) No
job_title User's job title No
department User's department No
office_location Office location No
city City No
state State/Province No
business_phone Business phone number No
mobile_phone Mobile phone number No
groups List or comma-separated string of groups No
license_skus List or comma-separated string of licenses No
user_to_copy Template user's email to copy from No
copy_licenses Whether to copy licenses from template user No

Error Handling

The package includes comprehensive error handling with custom exceptions:

  • GraphAPIError: Microsoft Graph API operation failures
  • TokenManagerError: Authentication and token-related issues
  • PasswordManagerError: Password management operation failures
  • InsufficientPermissionsError: Permission-related failures

Logging

The package uses a unified logging system supporting:

  • Local file logging
  • Discord webhook integration
  • ASIO logging integration

Configure logging through the logging_config function in config/default_config.py.

Dependencies

  • Microsoft Graph API
  • Password Pusher API (for secure password sharing)
  • Discord Webhook (optional, for logging)
  • Asio RPA Framework (optional)

License

MIT License

Contributing

Please read the CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

m365_user_manager-0.1.1rc2.tar.gz (94.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

m365_user_manager-0.1.1rc2-py3-none-any.whl (114.3 kB view details)

Uploaded Python 3

File details

Details for the file m365_user_manager-0.1.1rc2.tar.gz.

File metadata

  • Download URL: m365_user_manager-0.1.1rc2.tar.gz
  • Upload date:
  • Size: 94.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for m365_user_manager-0.1.1rc2.tar.gz
Algorithm Hash digest
SHA256 4adac8cac6d1b134080c8365865bd7f718123092fec7020679398240b7344aa8
MD5 0895539663ff91d1d271fc3dd2784d8f
BLAKE2b-256 cdd5ef856b1c65d7d8c0228c72ec8968296b0ffd9bc3116dbbe0f0fa0fd364b3

See more details on using hashes here.

File details

Details for the file m365_user_manager-0.1.1rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for m365_user_manager-0.1.1rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 20b63268acd0996b36725fea95980f6f80bafc9b0388ce82b79a19ffc271ba94
MD5 02273395e2e85d996c3b0b44f7060714
BLAKE2b-256 acf0bcc603279f318c1bfd7bdbae6d7a08ebac2e5ce724471867cfa19a7e0249

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page