[玩转系统] New-MgUser - 在 Azure AD 中创建新用户
作者:精品下载站 日期:2024-12-14 06:28:11 浏览:12 分类:玩电脑
New-MgUser - 在 Azure AD 中创建新用户
用户管理是任何 Microsoft 365 环境中的一项基本任务,Microsoft Graph PowerShell 提供了通过 PowerShell 管理用户的 cmdlet。
PowerShell 中的 New-MgUser cmdlet 在 Microsoft Graph 中创建新用户。
要使用 New-MgUser cmdlet,必须首先使用 Connect-MGraph
cmdlet 连接到 Microsoft 365 租户。连接后,您可以使用 New-MgUser cmdlet 创建新用户。
Connect-MgGraph -Scopes User.ReadWrite.All
下面给出了创建新用户对象的语法。
New-MgUser
[-AboutMe <String>]
[-AccountEnabled]
[-Activities <IMicrosoftGraphUserActivity[]>]
[-AdditionalProperties <Hashtable>]
[-AgeGroup <String>]
[-AgreementAcceptances <IMicrosoftGraphAgreementAcceptance[]>]
[-AppRoleAssignments <IMicrosoftGraphAppRoleAssignment[]>]
[-AssignedLicenses <IMicrosoftGraphAssignedLicense[]>]
[-AssignedPlans <IMicrosoftGraphAssignedPlan[]>]
[-Authentication <IMicrosoftGraphAuthentication>]
[-AuthorizationInfo <IMicrosoftGraphAuthorizationInfo>]
[-Birthday <DateTime>]
[-BusinessPhones <String[]>]
[-Calendar <IMicrosoftGraphCalendar>]
[-CalendarGroups <IMicrosoftGraphCalendarGroup[]>]
[-CalendarView <IMicrosoftGraphEvent[]>]
[-Calendars <IMicrosoftGraphCalendar[]>]
[-Chats <IMicrosoftGraphChat[]>]
[-City <String>]
[-CompanyName <String>]
[-ConsentProvidedForMinor <String>]
[-ContactFolders <IMicrosoftGraphContactFolder[]>]
[-Contacts <IMicrosoftGraphContact[]>]
[-Country <String>]
[-CreatedDateTime <DateTime>]
[-CreatedObjects <IMicrosoftGraphDirectoryObject[]>]
[-CreationType <String>]
[-CustomSecurityAttributes <Hashtable>]
[-DeletedDateTime <DateTime>]
[-Department <String>]
[-DeviceEnrollmentLimit <Int32>]
[-DeviceManagementTroubleshootingEvents <IMicrosoftGraphDeviceManagementTroubleshootingEvent[]>]
[-DirectReports <IMicrosoftGraphDirectoryObject[]>]
[-DisplayName <String>]
[-Drive <IMicrosoftGraphDrive>]
[-Drives <IMicrosoftGraphDrive[]>]
[-EmployeeExperience <IMicrosoftGraphEmployeeExperienceUser>]
[-EmployeeHireDate <DateTime>]
[-EmployeeId <String>]
[-EmployeeLeaveDateTime <DateTime>]
[-EmployeeOrgData <IMicrosoftGraphEmployeeOrgData>]
[-EmployeeType <String>]
[-Events <IMicrosoftGraphEvent[]>]
[-Extensions <IMicrosoftGraphExtension[]>]
[-ExternalUserState <String>]
[-ExternalUserStateChangeDateTime <DateTime>]
[-FaxNumber <String>]
[-FollowedSites <IMicrosoftGraphSite[]>]
[-GivenName <String>]
[-HireDate <DateTime>]
[-Id <String>]
[-Identities <IMicrosoftGraphObjectIdentity[]>]
[-ImAddresses <String[]>]
[-InferenceClassification <IMicrosoftGraphInferenceClassification>]
[-Insights <IMicrosoftGraphOfficeGraphInsights>]
[-Interests <String[]>]
[-IsResourceAccount]
[-JobTitle <String>]
[-JoinedTeams <IMicrosoftGraphTeam[]>]
[-LastPasswordChangeDateTime <DateTime>]
[-LegalAgeGroupClassification <String>]
[-LicenseAssignmentStates <IMicrosoftGraphLicenseAssignmentState[]>]
[-LicenseDetails <IMicrosoftGraphLicenseDetails[]>]
[-Mail <String>]
[-MailFolders <IMicrosoftGraphMailFolder[]>]
[-MailNickname <String>]
[-MailboxSettings <IMicrosoftGraphMailboxSettings>]
[-ManagedAppRegistrations <IMicrosoftGraphManagedAppRegistration[]>]
[-ManagedDevices <IMicrosoftGraphManagedDevice[]>]
[-Manager <IMicrosoftGraphDirectoryObject>]
[-MemberOf <IMicrosoftGraphDirectoryObject[]>]
[-Messages <IMicrosoftGraphMessage[]>]
[-MobilePhone <String>]
[-MySite <String>]
[-Oauth2PermissionGrants <IMicrosoftGraphOAuth2PermissionGrant[]>]
[-OfficeLocation <String>]
[-OnPremisesDistinguishedName <String>]
[-OnPremisesDomainName <String>]
[-OnPremisesExtensionAttributes <IMicrosoftGraphOnPremisesExtensionAttributes>]
[-OnPremisesImmutableId <String>]
[-OnPremisesLastSyncDateTime <DateTime>]
[-OnPremisesProvisioningErrors <IMicrosoftGraphOnPremisesProvisioningError[]>]
[-OnPremisesSamAccountName <String>]
[-OnPremisesSecurityIdentifier <String>]
[-OnPremisesSyncEnabled]
[-OnPremisesUserPrincipalName <String>]
[-Onenote <IMicrosoftGraphOnenote>]
[-OnlineMeetings <IMicrosoftGraphOnlineMeeting[]>]
[-OtherMails <String[]>]
[-Outlook <IMicrosoftGraphOutlookUser>]
[-OwnedDevices <IMicrosoftGraphDirectoryObject[]>]
[-OwnedObjects <IMicrosoftGraphDirectoryObject[]>]
[-PasswordPolicies <String>]
[-PasswordProfile <IMicrosoftGraphPasswordProfile>]
[-PastProjects <String[]>]
[-People <IMicrosoftGraphPerson[]>]
[-Photo <IMicrosoftGraphProfilePhoto>]
[-Photos <IMicrosoftGraphProfilePhoto[]>]
[-Planner <IMicrosoftGraphPlannerUser>]
[-PostalCode <String>]
[-PreferredDataLocation <String>]
[-PreferredLanguage <String>]
[-PreferredName <String>]
[-Presence <IMicrosoftGraphPresence>]
[-Print <IMicrosoftGraphUserPrint>]
[-ProvisionedPlans <IMicrosoftGraphProvisionedPlan[]>]
[-ProxyAddresses <String[]>]
[-RegisteredDevices <IMicrosoftGraphDirectoryObject[]>]
[-Responsibilities <String[]>]
[-Schools <String[]>]
[-ScopedRoleMemberOf <IMicrosoftGraphScopedRoleMembership[]>]
[-SecurityIdentifier <String>]
[-ServiceProvisioningErrors <IMicrosoftGraphServiceProvisioningError[]>]
[-Settings <IMicrosoftGraphUserSettings>]
[-ShowInAddressList]
[-SignInActivity <IMicrosoftGraphSignInActivity>]
[-SignInSessionsValidFromDateTime <DateTime>]
[-Skills <String[]>]
[-State <String>]
[-StreetAddress <String>]
[-Surname <String>]
[-Teamwork <IMicrosoftGraphUserTeamwork>]
[-Todo <IMicrosoftGraphTodo>]
[-TransitiveMemberOf <IMicrosoftGraphDirectoryObject[]>]
[-UsageLocation <String>]
[-UserPrincipalName <String>]
[-UserType <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
在本文中,我们将讨论如何在 PowerShell 中使用 New-MgUser cmdlet 创建新用户。
如何在 Microsoft Graph 中创建新用户
要在 Microsoft Graph 中创建新用户,请在 PowerShell 中使用 New-MgUser cmdlet。
# password for the new user
$PasswordProfile = @{ Password = "xWwvJ]6NMw+bWH-d"}
# Add the new user
New-MgUser -DisplayName 'Luca Adkins' -PasswordProfile $PasswordProfile -AccountEnabled -MailNickname "LucaAdkins" -Mail "[email " -UserPrincipalName "[email "
$PasswordProfile
变量存储用户密码。 PowerShell 中的 New-MgUser cmdlet 可创建新用户。
New-MgUser cmdlet 的输出包括以下属性。
- DisplayName:用户的显示名称。
- Id:用户的唯一标识符。
- 邮件:用户的 SMPT 地址。
- UserPrincipalName:用户的用户主体名称。
新Mg用户常见问题解答
New-MgUser 返回错误:New-MgUser:没有足够的权限来完成操作。
使用范围为“User.ReadWrite.All”的 Connect-MgGraph cmdlet 连接到 Microsoft 365 租户。要解决权限不足的问题,请运行以下命令。
Connect-MgGraph -范围 User.ReadWrite.All
结论
希望上述有关如何在 PowerShell 中使用 New-MgUser cmdlet 在 Microsoft Graph 中创建新用户的文章对您有所帮助。
您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。
相关链接
获取 MgUser
更新-MgUser
删除-MgUser
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[影视] 黑道中人 Alto Knights(2025)剧情 犯罪 历史 电影
[古装剧] [七侠五义][全75集][WEB-MP4/76G][国语无字][1080P][焦恩俊经典]
[实用软件] 虚拟手机号 电话 验证码 注册
[电视剧] 安眠书店/你 第五季 You Season 5 (2025) 【全10集】
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[实用软件] 虚拟手机号 电话 验证码 注册
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag