AzureAD认为用户不存在时就存在

时间:2016-12-20 16:57:57

标签: azure-powershell

这是使用最新的Powershell和Azure模块。该用户已被删除。我的问题是为什么我不能重新创建它们?

PS C:\Users\Administrator> Get-MsolUser -UserPrincipalName 

"bella.daniel@demo.co.uk"
Get-MsolUser : User Not Found.  User: bella.daniel@demo.co.uk.
At line:1 char:1
+ Get-MsolUser -UserPrincipalName "bella.daniel@demo.co.uk"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Get-MsolUser], MicrosoftOnlineException
    + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.UserNotFoundException,Microsoft.Online.Admini
   stration.Automation.GetUser

PS C:\Users\Administrator> new-msoluser -DisplayName Daniel -UserPrincipalName bella.daniel@demo.co.uk -UsageLocati
on NO -BlockCredential $false -ImmutableId DANIELB620
new-msoluser : Unable to add this user because a user with the user principal name already exists.
At line:1 char:1
+ new-msoluser -DisplayName Daniel -UserPrincipalName bella.daniel@demo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [New-MsolUser], MicrosoftOnlineException
    + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.UniquenessValidationException,Microsoft.Onlin
   e.Administration.Automation.NewUser

1 个答案:

答案 0 :(得分:0)

啊......所以AAD并没有完全删除用户。 通过运行 Get-MsolUser –ReturnDeletedUsers -All | Remove-MsolUser –RemoveFromRecycleBin –Force 我能够清除它们并重新使用" UPN