본문 바로가기

Tech/[SaaS] Microsoft 365

[Microsoft 365] 특정 테넌트의 모든 계정 비밀번호 변경

Hi, There!
안녕하세요, 바오밥입니다.

 


목차

  1. 문제
  2. 솔루션

문제

문제 정의

Microsoft 365 테넌트의 모든 계정의 비밀번호를 특정 비밀번호로 변경하는 시나리오입니다.


솔루션

솔루션 안내

1. 모듈 설치 및 불러오기

Install-PackageProvider -Name NuGet -Force 
Install-Module MSOline

Get-ExecutionPolicy 
Set-ExecutionPolicy Unrestricted

Import-Module MSOline

*모듈 설치 시, 신뢰할 수 없는 리포지토리라는 문구가 출력되면 모두 예(A)를 선택

 

2. Powershell 에 Microsoft 365 테넌트 연동

Connect-MsolService
# 관리자 계정으로 로그인

3. Powershell Script 실행

$users = Get-MsolUser
$users.UserPrincipalName | ForEach-Object {
    Set-MsolUserPassword -UserPrincipalName $_ -NewPassword <비밀번호>
}

https://docs.microsoft.com/en-us/powershell/module/msonline/get-msoluser?view=azureadps-1.0 

 

Get-MsolUser (MSOnline)

The Get-MsolUser cmdlet gets an individual user or list of users. Specify the ObjectId or UserPrincipalName parameter to get a specific user.

docs.microsoft.com

https://docs.microsoft.com/ko-kr/microsoft-365/enterprise/connect-to-microsoft-365-powershell?view=o365-worldwide#connect-with-the-azure-active-directory-powershell-for-graph-module 

 

PowerShell을 사용하여 Microsoft 365에 연결 - Microsoft 365 Enterprise

Microsoft 365용 PowerShell을 사용하여 Microsoft 365 테넌트에 연결하여 명령줄에서 관리 센터 작업을 수행합니다.

docs.microsoft.com