ms365-tenant-manager
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMicrosoft 365 Tenant Manager
Microsoft 365 租户管理器
Expert guidance and automation for Microsoft 365 Global Administrators managing tenant setup, user lifecycle, security policies, and organizational optimization.
为管理租户设置、用户生命周期、安全策略和组织优化的Microsoft 365全局管理员提供专业指导与自动化方案。
Table of Contents
目录
Trigger Phrases
触发短语
Use this skill when you hear:
- "set up Microsoft 365 tenant"
- "create Office 365 users"
- "configure Azure AD"
- "generate PowerShell script for M365"
- "set up Conditional Access"
- "bulk user provisioning"
- "M365 security audit"
- "license management"
- "Exchange Online configuration"
- "Teams administration"
当您听到以下需求时可使用本技能:
- "set up Microsoft 365 tenant"(设置Microsoft 365租户)
- "create Office 365 users"(创建Office 365用户)
- "configure Azure AD"(配置Azure AD)
- "generate PowerShell script for M365"(生成M365的PowerShell脚本)
- "set up Conditional Access"(配置Conditional Access)
- "bulk user provisioning"(批量用户配置)
- "M365 security audit"(M365安全审计)
- "license management"(许可证管理)
- "Exchange Online configuration"(Exchange Online配置)
- "Teams administration"(Teams管理)
Quick Start
快速开始
Generate Security Audit Script
生成安全审计脚本
bash
python scripts/powershell_generator.py --action audit --output audit_script.ps1bash
python scripts/powershell_generator.py --action audit --output audit_script.ps1Create Bulk User Provisioning Script
创建批量用户配置脚本
bash
python scripts/user_management.py --action provision --csv users.csv --license E3bash
python scripts/user_management.py --action provision --csv users.csv --license E3Configure Conditional Access Policy
配置Conditional Access策略
bash
python scripts/powershell_generator.py --action conditional-access --require-mfa --include-adminsbash
python scripts/powershell_generator.py --action conditional-access --require-mfa --include-adminsTools
工具
powershell_generator.py
powershell_generator.py
Generates ready-to-use PowerShell scripts for Microsoft 365 administration.
Usage:
bash
undefined生成可直接用于Microsoft 365管理的PowerShell脚本。
使用方法:
bash
undefinedGenerate security audit script
生成安全审计脚本
python scripts/powershell_generator.py --action audit
python scripts/powershell_generator.py --action audit
Generate Conditional Access policy script
生成Conditional Access策略脚本
python scripts/powershell_generator.py --action conditional-access
--policy-name "Require MFA for Admins"
--require-mfa
--include-users "All"
--policy-name "Require MFA for Admins"
--require-mfa
--include-users "All"
python scripts/powershell_generator.py --action conditional-access
--policy-name "Require MFA for Admins"
--require-mfa
--include-users "All"
--policy-name "Require MFA for Admins"
--require-mfa
--include-users "All"
Generate bulk license assignment script
生成批量许可证分配脚本
python scripts/powershell_generator.py --action license
--csv users.csv
--sku "ENTERPRISEPACK"
--csv users.csv
--sku "ENTERPRISEPACK"
**Parameters:**
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--action` | Yes | Script type: `audit`, `conditional-access`, `license`, `users` |
| `--policy-name` | No | Name for Conditional Access policy |
| `--require-mfa` | No | Require MFA in policy |
| `--include-users` | No | Users to include: `All` or specific UPNs |
| `--csv` | No | CSV file path for bulk operations |
| `--sku` | No | License SKU for assignment |
| `--output` | No | Output file path (default: stdout) |
**Output:** Complete PowerShell scripts with error handling, logging, and best practices.python scripts/powershell_generator.py --action license
--csv users.csv
--sku "ENTERPRISEPACK"
--csv users.csv
--sku "ENTERPRISEPACK"
**参数说明:**
| 参数 | 是否必填 | 描述 |
|-----------|----------|-------------|
| `--action` | 是 | 脚本类型:`audit`(审计)、`conditional-access`(条件访问)、`license`(许可证)、`users`(用户) |
| `--policy-name` | 否 | Conditional Access策略名称 |
| `--require-mfa` | 否 | 策略中要求启用MFA |
| `--include-users` | 否 | 包含的用户:`All`(全部)或特定UPN |
| `--csv` | 否 | 批量操作的CSV文件路径 |
| `--sku` | 否 | 要分配的许可证SKU |
| `--output` | 否 | 输出文件路径(默认:标准输出) |
**输出:** 包含错误处理、日志记录和最佳实践的完整PowerShell脚本。user_management.py
user_management.py
Automates user lifecycle operations and bulk provisioning.
Usage:
bash
undefined自动化用户生命周期操作和批量配置。
使用方法:
bash
undefinedProvision users from CSV
从CSV文件配置用户
python scripts/user_management.py --action provision --csv new_users.csv
python scripts/user_management.py --action provision --csv new_users.csv
Offboard user securely
安全注销用户
python scripts/user_management.py --action offboard --user john.doe@company.com
python scripts/user_management.py --action offboard --user john.doe@company.com
Generate inactive users report
生成非活跃用户报告
python scripts/user_management.py --action report-inactive --days 90
**Parameters:**
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--action` | Yes | Operation: `provision`, `offboard`, `report-inactive`, `sync` |
| `--csv` | No | CSV file for bulk operations |
| `--user` | No | Single user UPN |
| `--days` | No | Days for inactivity threshold (default: 90) |
| `--license` | No | License SKU to assign |python scripts/user_management.py --action report-inactive --days 90
**参数说明:**
| 参数 | 是否必填 | 描述 |
|-----------|----------|-------------|
| `--action` | 是 | 操作类型:`provision`(配置)、`offboard`(注销)、`report-inactive`(非活跃报告)、`sync`(同步) |
| `--csv` | 否 | 批量操作的CSV文件 |
| `--user` | 否 | 单个用户的UPN |
| `--days` | 否 | 非活跃状态阈值天数(默认:90天) |
| `--license` | 否 | 要分配的许可证SKU |tenant_setup.py
tenant_setup.py
Initial tenant configuration and service provisioning automation.
Usage:
bash
undefined自动化初始租户配置和服务部署。
使用方法:
bash
undefinedGenerate tenant setup checklist
生成租户设置清单
python scripts/tenant_setup.py --action checklist --company "Acme Inc" --users 50
python scripts/tenant_setup.py --action checklist --company "Acme Inc" --users 50
Generate DNS records configuration
生成DNS记录配置
python scripts/tenant_setup.py --action dns --domain acme.com
python scripts/tenant_setup.py --action dns --domain acme.com
Generate security baseline script
生成安全基线脚本
python scripts/tenant_setup.py --action security-baseline
---python scripts/tenant_setup.py --action security-baseline
---Workflows
工作流
Workflow 1: New Tenant Setup
工作流1:新租户设置
Step 1: Generate Setup Checklist
bash
python scripts/tenant_setup.py --action checklist --company "Company Name" --users 100Step 2: Configure DNS Records
bash
python scripts/tenant_setup.py --action dns --domain company.comStep 3: Apply Security Baseline
bash
python scripts/powershell_generator.py --action audit > initial_audit.ps1Step 4: Provision Users
bash
python scripts/user_management.py --action provision --csv employees.csv --license E3步骤1:生成设置清单
bash
python scripts/tenant_setup.py --action checklist --company "Company Name" --users 100步骤2:配置DNS记录
bash
python scripts/tenant_setup.py --action dns --domain company.com步骤3:应用安全基线
bash
python scripts/powershell_generator.py --action audit > initial_audit.ps1步骤4:配置用户
bash
python scripts/user_management.py --action provision --csv employees.csv --license E3Workflow 2: Security Hardening
工作流2:安全加固
Step 1: Run Security Audit
bash
python scripts/powershell_generator.py --action audit --output security_audit.ps1Step 2: Create MFA Policy
bash
python scripts/powershell_generator.py --action conditional-access \
--policy-name "Require MFA All Users" \
--require-mfa \
--include-users "All"Step 3: Review Results
Execute generated scripts and review CSV reports in output directory.
步骤1:运行安全审计
bash
python scripts/powershell_generator.py --action audit --output security_audit.ps1步骤2:创建MFA策略
bash
python scripts/powershell_generator.py --action conditional-access \
--policy-name "Require MFA All Users" \
--require-mfa \
--include-users "All"步骤3:查看结果
执行生成的脚本并查看输出目录中的CSV报告。
Workflow 3: User Offboarding
工作流3:用户注销
Step 1: Generate Offboarding Script
bash
python scripts/user_management.py --action offboard --user departing.user@company.comStep 2: Execute Script with -WhatIf
powershell
.\offboard_user.ps1 -WhatIfStep 3: Execute for Real
powershell
.\offboard_user.ps1 -Confirm:$false步骤1:生成注销脚本
bash
python scripts/user_management.py --action offboard --user departing.user@company.com步骤2:使用-WhatIf参数执行脚本
powershell
.\offboard_user.ps1 -WhatIf步骤3:实际执行
powershell
.\offboard_user.ps1 -Confirm:$falseBest Practices
最佳实践
Tenant Setup
租户设置
- Enable MFA before adding users
- Configure named locations for Conditional Access
- Use separate admin accounts with PIM
- Verify custom domains before bulk user creation
- Apply Microsoft Secure Score recommendations
- 添加用户前启用MFA
- 为Conditional Access配置命名位置
- 使用带PIM的独立管理员账户
- 批量创建用户前验证自定义域名
- 应用Microsoft安全评分建议
Security Operations
安全操作
- Start Conditional Access policies in report-only mode
- Use parameter before executing scripts
-WhatIf - Never hardcode credentials in scripts
- Enable audit logging for all operations
- Regular quarterly security reviews
- 先在仅报告模式下启动Conditional Access策略
- 执行脚本前使用参数
-WhatIf - 切勿在脚本中硬编码凭据
- 为所有操作启用审计日志
- 定期进行季度安全审查
PowerShell Automation
PowerShell自动化
- Prefer Microsoft Graph over legacy MSOnline modules
- Include try/catch blocks for error handling
- Implement logging for audit trails
- Use Azure Key Vault for credential management
- Test in non-production tenant first
- 优先使用Microsoft Graph而非旧版MSOnline模块
- 包含try/catch块进行错误处理
- 实现日志记录以生成审计跟踪
- 使用Azure Key Vault进行凭据管理
- 先在非生产租户中测试
Reference Guides
参考指南
When to Use Each Reference
各参考文档的适用场景
references/powershell-templates.md
- Ready-to-use script templates
- Conditional Access policy examples
- Bulk user provisioning scripts
- Security audit scripts
references/security-policies.md
- Conditional Access configuration
- MFA enforcement strategies
- DLP and retention policies
- Security baseline settings
references/troubleshooting.md
- Common error resolutions
- PowerShell module issues
- Permission troubleshooting
- DNS propagation problems
references/powershell-templates.md
- 可直接使用的脚本模板
- Conditional Access策略示例
- 批量用户配置脚本
- 安全审计脚本
references/security-policies.md
- Conditional Access配置
- MFA实施策略
- DLP和保留策略
- 安全基线设置
references/troubleshooting.md
- 常见错误解决方案
- PowerShell模块问题
- 权限故障排除
- DNS传播问题
Limitations
限制条件
| Constraint | Impact |
|---|---|
| Global Admin required | Full tenant setup needs highest privilege |
| API rate limits | Bulk operations may be throttled |
| License dependencies | E3/E5 required for advanced features |
| Hybrid scenarios | On-premises AD needs additional configuration |
| PowerShell prerequisites | Microsoft.Graph module required |
| 约束 | 影响 |
|---|---|
| 需要全局管理员权限 | 完整租户设置需要最高权限 |
| API速率限制 | 批量操作可能会被限流 |
| 许可证依赖 | 高级功能需要E3/E5许可证 |
| 混合场景 | 本地AD需要额外配置 |
| PowerShell前置要求 | 需要Microsoft.Graph模块 |
Required PowerShell Modules
所需PowerShell模块
powershell
Install-Module Microsoft.Graph -Scope CurrentUser
Install-Module ExchangeOnlineManagement -Scope CurrentUser
Install-Module MicrosoftTeams -Scope CurrentUserpowershell
Install-Module Microsoft.Graph -Scope CurrentUser
Install-Module ExchangeOnlineManagement -Scope CurrentUser
Install-Module MicrosoftTeams -Scope CurrentUserRequired Permissions
所需权限
- Global Administrator - Full tenant setup
- User Administrator - User management
- Security Administrator - Security policies
- Exchange Administrator - Mailbox management
- Global Administrator - 完整租户设置
- User Administrator - 用户管理
- Security Administrator - 安全策略管理
- Exchange Administrator - 邮箱管理