跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
安全

user-provisioning

Complete user lifecycle management including creation, role assignment, group membership, and deprovisioning

Happy Technologies LLC · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add Happy-Technologies-LLC/happy-platform-skills --skill user-provisioning

技能说明


name: user-provisioning version: 1.0.1 description: Complete user lifecycle management including creation, role assignment, group membership, and deprovisioning author: Happy Technologies LLC tags: [admin, user-management, provisioning, roles, groups, security, onboarding, offboarding] platforms: [claude-code, claude-desktop, chatgpt, cursor, any] tools: mcp: - SN-List-SysUsers - SN-List-SysUserGroups - SN-Create-Record - SN-Update-Record - SN-Query-Table - SN-Get-Record - SN-Batch-Create - SN-Batch-Update - SN-Execute-Background-Script rest: - /api/now/table/sys_user - /api/now/table/sys_user_group - /api/now/table/sys_user_grmember - /api/now/table/sys_user_has_role - /api/now/table/sys_user_role native: - Bash - Read complexity: intermediate estimated_time: 15-45 minutes

User Provisioning

Overview

This skill provides comprehensive guidance for ServiceNow user lifecycle management:

  • Creating new user accounts with proper attributes
  • Assigning roles based on job function
  • Managing group memberships
  • Handling user deprovisioning and offboarding
  • Bulk user operations

When to use: When onboarding new employees, changing user access, or offboarding departing employees.

Who should use this: System administrators, security administrators, and HR system integrators.

Prerequisites

  • Roles: admin, user_admin, or security_admin
  • Access: sys_user, sys_user_group, sys_user_grmember, sys_user_has_role tables
  • Knowledge: Understanding of your organization's role and group structure
  • LDAP/SSO: If integrated, understand which attributes are managed externally

Key Tables

TablePurpose
sys_userUser records
sys_user_groupGroup definitions
sys_user_grmemberGroup membership associations
sys_user_has_roleDirect role assignments
sys_user_roleRole definitions
sys_group_has_roleRoles assigned to groups

Procedure

Phase 1: User Creation

Step 1.1: Gather User Information

Required fields for new user creation:

FieldDescriptionExample
user_nameUnique login IDjsmith
first_nameFirst nameJohn
last_nameLast nameSmith
emailEmail addressjohn.smith@company.com
employee_numberEmployee IDEMP-12345
departmentDepartment referenceIT Operations
managerManager referenceManager's sys_id

Step 1.2: Check for Existing User

Before creating, verify user doesn't already exist.

Using MCP:

Tool: SN-Query-Table
Parameters:
  table_name: sys_user
  query: user_name=jsmith^ORemail=john.smith@company.com
  fields: sys_id,user_name,email,active
  limit: 5

If user exists, proceed to role/group assignment instead.

Step 1.3: Create User Account

Using MCP:

Tool: SN-Create-Record
Parameters:
  table_name: sys_user
  data:
    user_name: jsmith
    first_name: John
    last_name: Smith
    email: john.smith@company.com
    employee_number: EMP-12345
    title: Software Developer
    department: [department_sys_id]
    manager: [manager_sys_id]
    location: [location_sys_id]
    company: [company_sys_id]
    phone: "+1-555-123-4567"
    mobile_phone: "+1-555-987-6543"
    active: true
    locked_out: false
    password_needs_reset: true
    notification: 2  # Email notifications enabled

Using REST API:

POST /api/now/table/sys_user
Content-Type: application/json

{
  "user_name": "jsmith",
  "first_name": "John",
  "last_name": "Smith",
  "email": "john.smith@company.com",
  "employee_number": "EMP-12345",
  "active": "true",
  "password_needs_reset": "true"
}

Step 1.4: Set Initial Password

Using MCP (Background Script):

Tool: SN-Execute-Background-Script
Parameters:
  script: |
    var user = new GlideRecord('sys_user');
    user.get('user_name', 'jsmith');

    // Generate random password
    var password = GlideSecureRandomUtil.getSecureRandomString(16);
    user.setDisplayValue('user_password', password);
    user.password_needs_reset = true;
    user.update();

    // Send welcome email (optional)
    gs.eventQueue('user.created', user, password, '');

    gs.info('User created. Initial password set. User will be prompted to reset on first login.');
  description: Set initial password for new user

Phase 2: Role Assignment

Step 2.1: Understand Role Hierarchy

Common ServiceNow roles:

RoleDescriptionTypical Users
itilITSM operationsHelp desk, technicians
adminFull administrative accessSystem admins
approver_userApproval capabilitiesManagers
catalog_adminCatalog managementCatalog owners
knowledgeKnowledge base accessKB contributors
assetAsset managementAsset managers
change_managerChange managementChange managers
problem_managerProblem managementProblem managers

Step 2.2: Query Available Roles

Find Roles:

Tool: SN-Query-Table
Parameters:
  table_name: sys_user_role
  query: active=true
  fields: sys_id,name,description,suffix
  limit: 50

Find Role by Name:

Tool: SN-Query-Table
Parameters:
  table_name: sys_user_role
  query: name=itil
  fields: sys_id,name,description
  limit: 1

Step 2.3: Assign Role to User

Direct Role Assignment:

Tool: SN-Create-Record
Parameters:
  table_name: sys_user_has_role
  data:
    user: [user_sys_id]
    role: [role_sys_id]
    state: active
    inherited: false

Assign Multiple Roles (Batch):

Tool: SN-Batch-Create
Parameters:
  records:
    - table_name: sys_user_has_role
      data:
        user: [user_sys_id]
        role: [itil_role_sys_id]
    - table_name: sys_user_has_role
      data:
        user: [user_sys_id]
        role: [knowledge_role_sys_id]
    - table_name: sys_user_has_role
      data:
        user: [u
阅读完整来源 ↗