Azure-Samples / Azure-Samples/azure-files-samples

Get-ADObject : Cannot find an object with identity when specifying an OU in AD

Open
#77 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
261
Forks
202
Avg merge
1d 5h
Merged PRs (30d)
4

Description

Hi,

I have created a test OU called 'fslogix' in my AD DS environment. Now when I provide the name of that OU as a variable (see below) I get an error - if I don't specify an OU it creates a Computer Account in the 'Domain Controllers' OU

$rg = "VOXIGEN11"
$strgacc = "vox11fslgxstrg"
$oudn = "fslogix"
$acct = "ComputerAccount"
Join-AzStorageAccountForAuth -ResourceGroupName $rg -StorageAccountName $strgacc -DomainAccountType $acct -OrganizationalUnitDistinguishedName $oudn

Error I see is :

PS C:\azfileshybrid> Join-AzStorageAccountForAuth -ResourceGroupName $rg -StorageAccountName $strgacc -DomainAccountType
$acct -OrganizationalUnitDistinguishedName $oudn
Get-ADObject : Cannot find an object with identity: 'fslogix' under: 'DC=voxigen11,DC=vox'.
At C:\azfileshybrid\AzFilesHybrid.psm1:2433 char:15
+ ... $ou = Get-ADObject -Identity $OrganizationalUnitDistinguishedNa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (fslogix:ADObject) [Get-ADObject], ADIdentityNotFoundException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,M
icrosoft.ActiveDirectory.Management.Commands.GetADObject

Any help appreciated.

Paul Lynch

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.