linux怎么查看本机内存大小
388
2022-09-20
Azure 解决方案:如何通过Export命令导出Azure AD用户相关属性
51CTO 博客地址:AD境内,考虑到安全性,国外的Azure AD拒绝采用Azure AD Connect的方式同步用户到中国Azure AD,所以提供的解决方案是,采用Export的方式将用户相关的属性导出到csv文件,然后在中国Azure AD连接的Local AD中做用户的导入,再与中国的Azure AD做混合部署管理。
今天跟大家分享的就是如何通过命令行做Export AAD Users的方案,具体操作如下所示:
1. 打开Windows Powershell,然后输入命令:Install-Module -Name Azure AD来安装Azure AD所需要的命令,如下所示:
2. 输入命令:Connect-AzureAD,来连接Azure AD,如下所示:
3. 将下面的脚本保存到Notepad中,命名为Export-AzADUsers,并放在C盘根目录下保存。
$Path = Split-Path -Parent "C:\scripts\*.*"$LogDate = Get-Date -f yyyyMMddhhmm$Csvfile = $Path + "\AllAzADUsers_$logDate.csv"$AzADUsers = Get-AzureADUser -All $true | Select-Object -Property *$progressCount = 0for ($i = 0; $i -le $AzADUsers.Count; $i++) { Write-Progress ` -Id 0 ` -Activity "Retrieving User " ` -Status "$progressCount of $($AzADUsers.Count)" ` -PercentComplete (($progressCount / $AzADUsers.Count) * 100) $progressCount++}$AzADUsers | Sort-Object GivenName | Select-Object `@{Label = "First name"; Expression = { $_.GivenName } },@{Label = "Last name"; Expression = { $_.Surname } },@{Label = "Display name"; Expression = { $_.DisplayName } },@{Label = "User principal name"; Expression = { $_.UserPrincipalName } },@{Label = "Street"; Expression = { $_.StreetAddress } },@{Label = "City"; Expression = { $_.City } },@{Label = "State/province"; Expression = { $_.State } },@{Label = "Zip/Postal Code"; Expression = { $_.PostalCode } },@{Label = "Country/region"; Expression = { $_.Country } },@{Label = "Job Title"; Expression = { $_.JobTitle } },@{Label = "Department"; Expression = { $_.Department } },@{Label = "Company"; Expression = { $_.CompanyName } },@{Label = "Description"; Expression = { $_.Description } },@{Label = "Office"; Expression = { $_.PhysicalDeliveryOfficeName } },@{Label = "Telephone number"; Expression = { $_.TelephoneNumber } },@{Label = "E-mail"; Expression = { $_.Mail } },@{Label = "Mobile"; Expression = { $_.Mobile } },@{Label = "User type"; Expression = { $_.UserType } },@{Label = "Dirsync"; Expression = { if (($_.DirSyncEnabled -eq 'True') ) { 'True' } Else { 'False' } } },@{Label = "Account status"; Expression = { if (($_.AccountEnabled -eq 'True') ) { 'Enabled' } Else { 'Disabled' } } } |Export-Csv -Encoding UTF8 -Path $Csvfile -NoTypeInformation #-Delimiter ";"
执行脚本,如下所示:
在相关目录下可以找到生成的csv 导出用户的文件。 谢谢大家阅读,如有相关需求讨论,欢迎线下联系。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~