PowerShell을 사용하여 보안 그룹 관리
이 문서는 Microsoft 365 Enterprise와 Office 365 Enterprise에 모두 적용됩니다.
보안 그룹을 관리하는 Microsoft 365 관리 센터 대신 Microsoft 365용 PowerShell을 사용할 수 있습니다.
이 문서에서는 보안 그룹 나열, 만들기, 설정 변경 및 제거에 대해 설명합니다.
이 문서의 명령 블록에서 변수 값을 지정해야 하는 경우 다음 단계를 사용합니다.
- 명령 블록을 클립보드에 복사하여 메모장 또는 PowerShell ISE(통합 스크립트 환경)에 붙여넣습니다.
- 변수 값을 입력하고 "" 및 "<>" 문자를 제거합니다.
- PowerShell 창 또는 PowerShell ISE에서 명령을 실행합니다.
PowerShell을 사용하여 그룹 멤버 자격을 관리하려면 보안 그룹 멤버 자격 유지 관리를 참조하세요.
Graph 모듈용 Azure Active Directory PowerShell 사용하기
그룹 나열
이 명령을 사용하여 모든 그룹을 나열합니다.
Get-AzureADGroup
이러한 명령을 사용하여 표시 이름으로 특정 그룹의 설정을 표시합니다.
$groupName="<display name of the group>"
Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }
새 그룹 만들기
이 명령을 사용하여 새 보안 그룹을 만듭니다.
New-AzureADGroup -Description "<group purpose>" -DisplayName "<name>" -MailEnabled $false -SecurityEnabled $true -MailNickName "<email name>"
그룹의 설정 변경
이러한 명령을 사용하여 그룹의 설정을 표시합니다.
$groupName="<display name of the group>"
Get-AzureADGroup | Where { $_.DisplayName -eq $groupName } | Select *
그런 다음 Set-AzureADGroup 문서를 사용하여 설정을 변경하는 방법을 결정합니다.
보안 그룹 제거
이러한 명령을 사용하여 보안 그룹을 제거합니다.
$groupName="<display name of the group>"
Remove-AzureADGroup -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectId
보안 그룹의 소유자 관리
이러한 명령을 사용하여 보안 그룹의 현재 소유자를 표시합니다.
$groupName="<display name of the group>"
Get-AzureADGroupOwner -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectId
이러한 명령을 사용하여 보안 그룹의 현재 소유자에게 UPN(사용자 계정 이름)으로 사용자 계정을 추가합니다.
$userUPN="<UPN of the user account to add>"
$groupName="<display name of the group>"
Add-AzureADGroupOwner -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectId -RefObjectId (Get-AzureADUser | Where { $_.UserPrincipalName -eq $userUPN }).ObjectId
이러한 명령을 사용하여 표시 이름으로 사용자 계정을 보안 그룹의 현재 소유자에게 추가합니다.
$userName="<Display name of the user account to add>"
$groupName="<display name of the group>"
Add-AzureADGroupOwner -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectId -RefObjectId (Get-AzureADUser | Where { $_.DisplayName -eq $userName }).ObjectId
이러한 명령을 사용하여 UPN 의 사용자 계정을 보안 그룹의 현재 소유자에게 제거합니다.
$userUPN="<UPN of the user account to remove>"
$groupName="<display name of the group>"
Remove-AzureADGroupOwner -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectId -OwnerId (Get-AzureADUser | Where { $_.UserPrincipalName -eq $userUPN }).ObjectId
이러한 명령을 사용하여 보안 그룹의 현재 소유자에게 표시 이름으로 사용자 계정을 제거합니다.
$userName="<Display name of the user account to remove>"
$groupName="<display name of the group>"
Remove-AzureADGroupOwner -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectId -OwnerId (Get-AzureADUser | Where { $_.DisplayName -eq $userName }).ObjectId
Windows PowerShell용 Microsoft Azure Active Directory 모듈 사용하기
그룹 나열
이 명령을 사용하여 모든 그룹을 나열합니다.
Get-MsolGroup
이러한 명령을 사용하여 표시 이름으로 특정 그룹의 설정을 표시합니다.
$groupName="<display name of the group>"
Get-MsolGroup | Where { $_.DisplayName -eq $groupName }
새 그룹 만들기
이 명령을 사용하여 새 보안 그룹을 만듭니다.
New-MsolGroup -Description "<group purpose>" -DisplayName "<name>"
그룹의 설정 변경
이러한 명령을 사용하여 그룹의 설정을 표시합니다.
$groupName="<display name of the group>"
Get-MsolGroup | Where { $_.DisplayName -eq $groupName } | Select *
그런 다음 Set-MsolGroup 문서를 사용하여 설정을 변경하는 방법을 결정합니다.
보안 그룹 제거
이러한 명령을 사용하여 보안 그룹을 제거합니다.
$groupName="<display name of the group>"
Remove-MsolGroup -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $groupName }).ObjectId