- 管理员模式打开powershell,启用tls1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- 安装PowerShellGet
Install-Module -Name PowerShellGet -Force
选Yes
- 获取AzureRM
if (Get-Module -Name AzureRM -ListAvailable) {Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +'Az modules installed at the same time is not supported.')} else {Install-Module -Name Az -AllowClobber -Scope CurrentUser}
选Yes或者Yes to All
- 更改安全策略
Set-ExecutionPolicy RemoteSigned
- 安装Az.Accounts模块
Import-Module Az.Accounts
- 登陆
Connect-AzAccount
- 安装AzureAD模块
Install-Module AzureAD
- 登陆Azure AD
connect-azuread
- 获取所有user
Get-AzureADUser
- 获取某个user
Get-AzureADUser -SearchString cdc-shared@o365.hes20.eu
- 获取某个user的某个属性
Get-AzureADUser -SearchString cdc-shared@o365.hes20.eu | select -ExpandProperty ProxyAddresses
$user = Get-AzureADUser -ObjectId test0@o365.hes20.eu$user.proxyAddresses
