PowerShell을 사용하여 보안 그룹 멤버 자격 유지 관리
이 문서는 Microsoft 365 Enterprise와 Office 365 Enterprise에 모두 적용됩니다.
Microsoft 365의 보안 그룹 멤버 자격을 유지하기 위해 Microsoft 365 관리 센터 대신 Microsoft 365용 PowerShell을 사용할 수 있습니다.
참고
Microsoft 365 관리 센터 Microsoft 365 그룹 멤버 자격을 유지하는 방법을 알아봅니다. 추가 리소스 목록은 사용자 및 그룹 관리를 참조하세요.
Graph 모듈용 Azure Active Directory PowerShell 사용하기
그룹 구성원으로 사용자 계정 추가 또는 제거
참고
Azure AD 및 MSOnline PowerShell 모듈은 2024년 3월 30일부터 더 이상 사용되지 않습니다. 자세한 내용은 사용 중단 업데이트를 참조하세요. 이 날짜 이후에는 이러한 모듈에 대한 지원이 Microsoft Graph PowerShell SDK 및 보안 수정에 대한 마이그레이션 지원으로 제한됩니다. 사용되지 않는 모듈은 2025년 3월 30일까지 계속 작동합니다.
Microsoft Entra ID(이전의 Azure AD)와 상호 작용하려면 Microsoft Graph PowerShell로 마이그레이션하는 것이 좋습니다. 일반적인 마이그레이션 질문은 마이그레이션 FAQ를 참조하세요. 참고: MSOnline 버전 1.0.x는 2024년 6월 30일 이후에 중단이 발생할 수 있습니다.
UPN으로 사용자 계정을 추가하려면 사용자 계정 UPN(사용자 계정 이름)(예: belindan@contoso.com) 및 보안 그룹 표시 이름을 입력하여 "<" 및 ">" 문자를 제거하고 PowerShell 창 또는 POWERShell ISE(통합 스크립트 환경)에서 이러한 명령을 실행합니다.
$userUPN="<UPN of the user account to add>"
$groupName="<display name of the group>"
Add-AzureADGroupMember -RefObjectId (Get-AzureADUser | Where { $_.UserPrincipalName -eq $userUPN }).ObjectID -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
표시 이름으로 사용자 계정을 추가하려면 사용자 계정 표시 이름(예: Belinda Newman)과 그룹 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$userName="<display name of the user account to add>"
$groupName="<display name of the group>"
Add-AzureADGroupMember -RefObjectId (Get-AzureADUser | Where { $_.DisplayName -eq $userName }).ObjectID -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
UPN으로 사용자 계정을 제거하려면 사용자 계정 UPN(예: belindan@contoso.com) 및 그룹 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$userUPN="<UPN of the user account to remove>"
$groupName="<display name of the group>"
Remove-AzureADGroupMember -MemberId (Get-AzureADUser | Where { $_.UserPrincipalName -eq $userUPN }).ObjectID -ObjectID (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
표시 이름으로 사용자 계정을 제거하려면 사용자 계정 표시 이름(예: Belinda Newman)과 그룹 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$userName="<display name of the user account to remove>"
$groupName="<display name of the group>"
Remove-AzureADGroupMember -MemberId (Get-AzureADUser | Where { $_.DisplayName -eq $userName }).ObjectID -ObjectID (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
그룹 구성원으로 그룹 추가 또는 제거
보안 그룹은 다른 그룹을 멤버로 포함할 수 있습니다. 그러나 Microsoft 365 그룹은 사용할 수 없습니다. 이 섹션에는 보안 그룹에 대해서만 그룹을 추가하거나 제거하는 PowerShell 명령이 포함되어 있습니다.
표시 이름으로 그룹을 추가하려면 추가할 그룹의 표시 이름과 구성원 그룹을 포함할 그룹의 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$groupMemberName="<display name of the group to add>"
$groupName="<display name of the group that will contain the member group>"
Add-AzureADGroupMember -RefObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupMemberName }).ObjectID -ObjectID (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
표시 이름으로 그룹을 제거하려면 제거할 그룹의 표시 이름과 구성원 그룹을 포함할 그룹의 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$groupMemberName="<display name of the group to add>"
$groupName="<display name of the group that will contain the member group>"
Remove-AzureADGroupMember -MemberId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupMemberName }).ObjectID -ObjectID (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
Windows PowerShell Microsoft Azure Active Directory 모듈 사용
그룹 구성원으로 사용자 계정 추가 또는 제거
UPN으로 사용자 계정을 추가하려면 사용자 계정 UPN(사용자 계정 이름)(예: belindan@contoso.com) 및 그룹 표시 이름을 입력하고 "<" 및 ">" 문자를 제거하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$userUPN="<UPN of the user account to add>"
$groupName="<display name of the group>"
Add-MsolGroupMember -GroupMemberObjectId (Get-MsolUser | Where { $_.UserPrincipalName -eq $userUPN }).ObjectID -GroupObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
표시 이름으로 사용자 계정을 추가하려면 사용자 계정 표시 이름(예: Belinda Newman)과 그룹 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$userName="<display name of the user account to add>"
$groupName="<display name of the group>"
Add-MsolGroupMember -GroupMemberObjectId (Get-MsolUser | Where { $_.DisplayName -eq $userName }).ObjectID -GroupObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
UPN으로 사용자 계정을 제거하려면 사용자 계정 UPN(예: belindan@contoso.com) 및 그룹 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$userUPN="<UPN of the user account to remove>"
$groupName="<display name of the group>"
Remove-MsolGroupMember -GroupMemberObjectId (Get-MsolUser | Where { $_.UserPrincipalName -eq $userUPN }).ObjectID -GroupObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
표시 이름으로 사용자 계정을 제거하려면 사용자 계정 표시 이름(예: Belinda Newman)과 그룹 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$userName="<display name of the user account to remove>"
$groupName="<display name of the group>"
Remove-MsolGroupMember -GroupMemberObjectId (Get-MsolUser | Where { $_.DisplayName -eq $userName }).ObjectID -GroupObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupName }).ObjectID
그룹 구성원으로 그룹 추가 또는 제거
보안 그룹은 다른 그룹을 멤버로 포함할 수 있습니다. 그러나 Microsoft 365 그룹은 사용할 수 없습니다. 이 섹션에는 보안 그룹에 대해서만 그룹을 추가하거나 제거하는 PowerShell 명령이 포함되어 있습니다.
표시 이름으로 그룹을 추가하려면 추가할 그룹의 표시 이름과 구성원 그룹을 포함할 그룹의 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$groupMemberName="<display name of the group to add>"
$groupName="<display name of the group that will contain the member group>"
Add-MsolGroupMember -GroupMemberObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupMemberName }).ObjectID -GroupObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupName }).ObjectID -GroupMemberType Group
표시 이름으로 그룹을 제거하려면 제거할 그룹의 표시 이름과 구성원 그룹을 포함할 그룹의 표시 이름을 입력하고 PowerShell 창 또는 PowerShell ISE에서 이러한 명령을 실행합니다.
$groupMemberName="<display name of the group to add>"
$groupName="<display name of the group contains the member group>"
Remove-MsolGroupMember -GroupMemberObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupMemberName }).ObjectID -GroupObjectId (Get-MsolGroup | Where { $_.DisplayName -eq $groupName }).ObjectID -GroupMemberType Group
참고 항목
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기