Update the companyName attribute for an Azure AD user via PowerShell

13,521

Solution 1

I had the problem and had to ask Microsoft directly. Since February 2019, CompanyName is writable.

Command is

Set-AzureADUserExtension -ObjectId <UPN> -ExtensionName "CompanyName" -ExtensionValue "<VALUE>"

Check my blogpost on the matter for the whole explanation: http://www.yasab.net/azure-ad-update-companyname/

Solution 2

How does one set the companyName attribute for users in Azure AD / Office 365?

For now, customer can use Azure AD connect to sync on-prem AD user's attribute company to Azure AD, but can't set company for cloud user, the attribute company is read only.

Here a similar case about you:

This attribute company is inherited from the Display name property of the organisation but is not visible in the Graph API directly.

As a workaround, you can create users to your on-prem AD, then sync to Azure AD.

About attribute extension_0000000000000000000000000000000_company, used for mapping attribute.

Share:
13,521

Related videos on Youtube

Richard Hauer
Author by

Richard Hauer

Updated on September 18, 2022

Comments

  • Richard Hauer
    Richard Hauer over 1 year

    Background

    I have an email system (CodeTwo) that creates signatures automatically using AD attributes for users. Many of my users are synchronised between an on-prem AD and Office 365 / AAD, however newer users are cloud only, that is, they are created in the Office 365 admin portal and are not synchronised with an on-prem user.

    The problem

    I am using the companyName attribute, which is easily set through the properties dialog of the Windows Admin Tool Active Directory Users & Computers. I have setup Azure AD Connect to include this attribute in synchronisation. For my synced users, this setup works as expected - using commands like Get-CsOnleUser and Get-AzureADUser I can see the Company or CompanyName properties are set correctly. For cloud-only users, however, this value is always blank.

    I cannot find a way of setting this value - the property is either read-only, or changing the value of the attribute and using Set-CsUser or Set-AzureADUser has no effect.

    I noticed that we had some AD Extension properties, in particular one called extension_0000000000000000000000000000000_company - I can set this for the cloud users, but it doesn't seem to affect the object returned from the queries above. Similarly it is not picked up by the signature stamping system.

    The question

    How does one set the companyName attribute for users in Azure AD / Office 365? Preferably using PowerShell, but open to any options at this stage?

  • Richard Hauer
    Richard Hauer about 6 years
    Thanks Jason - I have read that post but, in my case at least, the DisplayName property of the organisation is set but is not flowing through to the companyName attribute. Further, we're not talking about the GraphAPI at all in this case. Adding the user to an on-prem AD and then syncing is not an option in this case (we are trying to get rid of the on-Prem AD, not use it more).
  • Jason Ye
    Jason Ye about 6 years
    @RichardHauer Azure AD powershell use the GraphAPI, so we can't use PowerShell to set it.
  • Richard Hauer
    Richard Hauer about 6 years
    I see. That’s disappointing.
  • octopus
    octopus almost 6 years
    Jason how about employeeid and pager field? are they read only or can they be synced to azure ad via Ad connect.