天天看点

WIN2008 关闭AAD同步

如果是通过AAD方式同步的话,在AAD中用户是无法删除的,所以需要关闭。

一.安装AzureAD模块失败

PS C:\Users\administrator> Install-Module AzureAD

The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check

the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:15

+ Install-Module <<<<  AzureAD

    + CategoryInfo          : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

解决:安装Windows Management Framework 5.1

下载地址为https://www.microsoft.com/en-us/download/confirmation.aspx?id=54616

下载 Windows Management Framework 5.1后,安装。

二.运行Install-Module AzureAD

PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider

'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package

has the tags.

At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7405 char:21

+ ...     $null = PackageManagement\Install-PackageProvider -Name $script:N ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac

   kageProvider], Exception

    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider

解决:指定传输协议,PS中运行如下:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

三.登录

PS C:\Users\administrator> Connect-MsolService -AzureEnvironment AzureCloud

输入用户名和密码,注意后面的AzureCloud,如果不是全球版,需要换成AzureChinaCloud

四.关闭同步

PS C:\Users\administrator> Set-MsolDirSyncEnabled -EnableDirSync $false

关闭同步后再登录Azure Portal,可以看到同步已经disable了。

五.登录Azure.portal.com 就可以删除用户了

继续阅读