Azure Portal에서 사용자 목록 다운로드

Microsoft Entra의 일부인 Microsoft Entra ID는 대량 사용자 목록 다운로드 작업을 지원합니다.

필요한 사용 권한

관리자와 관리자가 아닌 사용자는 모두 사용자 목록을 다운로드할 수 있습니다.

사용자 목록을 다운로드하려면

이 문서의 단계는 시작하는 포털에 따라 조금씩 다를 수 있습니다.

  1. Microsoft Entra 관리 센터에 로그인합니다.

  2. Microsoft Entra ID를 선택합니다.

  3. 사용자>모든 사용자>사용자 다운로드를 선택합니다. 기본적으로 모든 사용자 프로필을 내보냅니다.

  4. 사용자 다운로드 페이지에서 시작을 선택하여 사용자 프로필 속성이 나열된 CSV 파일을 받습니다. 오류가 있는 경우 대량 작업 결과 페이지에서 결과 파일을 다운로드하고 볼 수 있습니다. 해당 파일에는 각 오류에 대한 이유가 포함되어 있습니다.

    다운로드하려는 사용자 목록을 원하는 위치를 선택하는 것을 보여 주는 스크린샷.

참고 항목

다운로드 파일에는 적용된 필터의 범위에 따라 필터링된 사용자 목록이 포함됩니다.

포함되는 사용자 특성은 다음과 같습니다.

  • userPrincipalName
  • displayName
  • surname
  • mail
  • givenName
  • objectId
  • userType
  • jobTitle
  • department
  • accountEnabled
  • usageLocation
  • streetAddress
  • state
  • country
  • physicalDeliveryOfficeName
  • city
  • postalCode
  • telephoneNumber
  • mobile
  • authenticationAlternativePhoneNumber
  • authenticationEmail
  • alternateEmailAddress
  • ageGroup
  • consentProvidedForMinor
  • legalAgeGroupClassification

상태 확인

대량 작업 결과 페이지에서 보류 중인 대량 요청의 상태를 볼 수 있습니다.

대량 작업 결과 페이지에서 상태를 확인하는 것을 보여 주는 스크린샷.

오류가 발생하면 대량 작업 결과 페이지에서 결과 파일을 다운로드하여 볼 수 있습니다. 해당 파일에는 각 오류에 대한 이유가 포함되어 있습니다. 파일 제출은 제공된 템플릿과 일치하고 정확한 열 이름을 포함해야 합니다. 대량 작업 제한에 대한 자세한 내용은 대량 다운로드 서비스 제한을 참조 하세요.

대량 다운로드 서비스 제한

각 대량 작업 작업은 최대 1시간 동안 실행될 수 있습니다.

Microsoft Entra 관리 포털의 대량 작업은 시간이 초과되고 매우 큰 테넌트에서 실패할 수 있습니다. 이 제한은 크기 조정 제한으로 인해 알려진 문제입니다. Microsoft 엔지니어링 팀은 결국 이 제한을 해결할 새로운 서비스를 연구하고 있습니다.

참고 항목

가져오기, 만들기 등의 대량 작업을 수행할 때 대량 작업이 1시간 내에 완료되지 않으면 문제가 발생할 수 있습니다. 이 문제를 해결하려면 일괄 처리당 처리되는 레코드 수를 분할하는 것이 좋습니다. 예를 들어 내보내기를 시작하기 전에 결과 크기를 줄이기 위해 그룹 유형 또는 사용자 이름을 필터링하여 결과 집합을 제한할 수 있습니다. 필터를 구체화하면 기본적으로 대량 작업에서 반환되는 데이터를 제한합니다.

이 문제에 대한 또 다른 해결 방법은 PowerShell을 사용하여 Microsoft Graph API를 직접 호출하는 것입니다. 대량 다운로드 사용자 및 그룹 실패의 경우 PowerShell cmdlet 및 GET-MgGroup -All GET-MgUser -All.

다음 PowerShell 코드 예제는 다음과 관련된 대량 작업에 대한 것입니다.

사용자

모든 사용자 대량 다운로드

# Import the Microsoft Graph module 
Import-Module Microsoft.Graph 

# Authenticate to Microsoft Graph (you may need to provide your credentials) 
Connect-MgGraph -Scopes "User.Read.All" 

# Get all users using Get-MgUser 
$users = Get-MgUser -All -ConsistencyLevel eventual -Property Id, DisplayName, UserPrincipalName,UserType,OnPremisesSyncEnabled,CompanyName,CreationType 

# Specify the output CSV file path 
$outputCsvPath = "C:\\Users\\YourUsername\\Documents\\Users.csv"  

# Create a custom object to store user data 
$userData = @() 

# Loop through each user and collect relevant data 
foreach ($user in $users) { 
    $userObject = [PSCustomObject]@{ 
        Id = $user.Id 
        DisplayName = $user.DisplayName 
        UserPrincipalName = $user.UserPrincipalName 
        UserType = $user.UserType 
        OnPremisesSyncEnabled = $user.OnPremisesSyncEnabled 
        CompanyName = $user.CompanyName 
        CreationType = $user.CreationType 
    } 
    $userData += $userObject 
} 

# Export user data to a CSV file 
$userData | Export-Csv -Path $outputCsvPath -NoTypeInformation 

# Disconnect from Microsoft Graph 
Disconnect-MgGraph 

Write-Host "User data exported to $outputCsvPath" 

사용자 대량 만들기

# Import the Microsoft Graph module 
Import-Module Microsoft.Graph 

# Authenticate to Microsoft Graph (you may need to provide your credentials) 
Connect-MgGraph -Scopes "User.ReadWrite.All" 

# Specify the path to the CSV file containing user data 
$csvFilePath = "C:\\Path\\To\\Your\\Users.csv" 

# Read the CSV file (adjust the column names as needed) 
$usersData = Import-Csv -Path $csvFilePath 

# Loop through each row in the CSV and create users \
foreach ($userRow in $usersData) { 
    $userParams = @{ 
        DisplayName = $userRow.'Name [displayName] Required' 
        UserPrincipalName = $userRow.'User name [userPrincipalName] Required' 
        PasswordProfile = @{ 
            Password = $userRow.'Initial password [passwordProfile] Required' 
        } 
        AccountEnabled = $true 
        MailNickName = $userRow.mailNickName 
    } 
    try { 
        New-MgUser @userParams 
        Write-Host "User $($userRow.UserPrincipalName) created successfully." 
    } catch { 
        Write-Host "Error creating user $($userRow.UserPrincipalName): $($_.Exception.Message)" 
    } 
} 

# Disconnect from Microsoft Graph 
Disconnect-MgGraph 

Write-Host "Bulk user creation completed." 

참고 항목

CSV 파일에 필요한 열(예: DisplayNameUserPrincipalName)이 포함되어 있는지 확인합니다. 또한 CSV 파일의 실제 열 이름과 일치하도록 스크립트를 조정합니다.

사용자 대량 삭제

# Import the Microsoft Graph module 
Import-Module Microsoft.Graph 

# Authenticate to Microsoft Graph (you may need to provide your credentials) 
Connect-MgGraph -Scopes "User.ReadWrite.All" 

# Specify the path to the CSV file containing user data 
$csvFilePath = "C:\\Path\\To\\Your\\Users.csv" 

# Read the CSV file (adjust the column names as needed) 
$usersData = Import-Csv -Path $csvFilePath 

# Loop through each row in the CSV and delete users 
foreach ($userRow in $usersData) { 
    try { 
        Remove-MgUser -UserId $userRow.UserPrincipalName -Confirm:$false 
        Write-Host "User $($userRow.UserPrincipalName) deleted successfully." 
    } catch { 
        Write-Host "Error deleting user $($userRow.UserPrincipalName): $($_.Exception.Message)" 
    } 
} 

# Disconnect from Microsoft Graph 
Disconnect-MgGraph 

Write-Host "Bulk user deletion completed." 

참고 항목

CSV 파일에 필요한 열(예 UserPrincipalName: )이 포함되어 있는지 확인합니다. 또한 CSV 파일의 실제 열 이름과 일치하도록 스크립트를 조정합니다.

Groups

모든 그룹 대량 다운로드

Import-Module Microsoft.Graph.Groups 

 # Authenticate to Microsoft Graph (you may need to provide your credentials) 
 Connect-MgGraph -Scopes "Group.Read.All" 

 # Get the group members 
 $groups = Get-MgGroup -All | Select displayName, Id, groupTypes,mail 

 # Create a custom object to store group data 
$groupData = @() 

# Loop through each group and collect relevant data 
foreach ($group in $groups) { 
    if ($group.groupTypes -contains "Unified"){$groupType = "Microsoft 365"} 
    else {$groupType = "Security"} 
    if ($group.groupTypes -contains "DynamicMembership"){$membershipType = "Dynamic"} 
    else {$membershipType = "Assigned"} 
    $groupObject = [PSCustomObject]@{ 
        Id = $group.Id 
        DisplayName = $group.displayName 
        Mail = $group.mail 
        GroupType = $groupType 
        MemebershipType = $membershipType 
    }   
    $groupData += $groupObject 
} 

 # Specify the output CSV file path 
 $outputCsvPath = "C:\\Users\\cewu\\Documents\\Groups.csv" 

 $groupData| Export-Csv -Path $outputCsvPath -NoTypeInformation 
 
 Write-Host "Group members exported to $outputCsvPath" 

그룹의 구성원 대량 다운로드

Import-Module Microsoft.Graph.Groups 

 # Authenticate to Microsoft Graph (you may need to provide your credentials) 
 Connect-MgGraph -Scopes "Group.Read.All,GroupMember.Read.All" 

 # Set the group ID of the group whose members you want to download 
 $groupId = "your_group_id" 

 # Get the group members 
 $members = Get-MgGroupMember -GroupId $groupId -All | select * -ExpandProperty additionalProperties | Select-Object @( 
                'id'     
                @{  Name       = 'userPrincipalName' 
                    Expression = { $_.AdditionalProperties["userPrincipalName"] } 
                } 
                @{  Name = 'displayName' 
                Expression = { $_.AdditionalProperties["displayName"] } 
                } 
            ) 

 # Specify the output CSV file path 
 $outputCsvPath = "C:\\Users\\YourUserName\\Documents\\GroupMembers.csv" 

 $members| Export-Csv -Path $outputCsvPath -NoTypeInformation 

# Disconnect from Microsoft Graph 
Disconnect-MgGraph 

 Write-Host "Group members exported to $outputCsvPath"  

대량으로 멤버 추가

Import-Module Microsoft.Graph.Groups 

 # Authenticate to Microsoft Graph (you may need to provide your credentials) 
 Connect-MgGraph -Scopes "GroupMember.ReadWrite.All" 

# Import the CSV file 
$members = Import-Csv -Path "C:\path\to\your\file.csv" 

# Define the Group ID 
$groupId = "your-group-id" 

# Iterate over each member and add them to the group 
foreach ($member in $members) { 
    try{ 
        New-MgGroupMember -GroupId $groupId -DirectoryObjectId $member.memberObjectId 
  	 Write-Host "Added $($member.memberObjectId) to the group."  
    } 
    Catch{ 
        Write-Host "Error adding member $($member.memberObjectId):$($_.Exception.Message)" 
    } 
} 

# Disconnect from Microsoft Graph 
Disconnect-MgGraph 

대량으로 멤버 제거

Import-Module Microsoft.Graph.Groups 

 # Authenticate to Microsoft Graph (you may need to provide your credentials) 
 Connect-MgGraph -Scopes "GroupMember.ReadWrite.All" 

# Import the CSV file 
$members = Import-Csv -Path "C:\path\to\your\file.csv" 

# Define the Group ID 
$groupId = "your-group-id" 

# Iterate over each member and add them to the group 
foreach ($member in $members) { 
    try{ 
        Remove-MgGroupMemberByRef -GroupId $groupId -DirectoryObjectId $member.memberObjectId \
        Write-Host "Removed $($member.memberObjectId) from the group." 
    } 
    Catch{ 
        Write-Host "Error removing member $($member.memberObjectId):$($_.Exception.Message)" 
    } 
} 

# Disconnect from Microsoft Graph 
Disconnect-MgGraph 

장치

모든 디바이스 대량 다운로드

Import-Module Microsoft.Graph 

 # Authenticate to Microsoft Graph (you may need to provide your credentials) 
 Connect-MgGraph -Scopes "Device.Read.All" 

 # Get all devices  
 $devices = Get-MgDevice -All |select displayName,deviceId,operatingSystem,operatingSystemVersion,isManaged,isCompliant,mdmAppId,registeredOwners,TrustType 

 # Specify the output CSV file path 
 $outputCsvPath = "C:\\Users\\YourUserName\\Documents\\Devices.csv" 

 $devices| Export-Csv -Path $outputCsvPath -NoTypeInformation 

 Write-Host "Devices exported to $outputCsvPath"  

다음 단계