Amend invited user properties using MgGraph

Neal, Tom 125 Reputation points
2023-06-12T16:00:14.54+00:00

We are currently automating the process of newly invited users being created and added to our Azure AD environment, this is all being done via the New-Mginvitation command however one issue we our having is the inability to configure user properties such as company name or usage location and this appears to be a restriction of the New-Mginvitation command. Is there any method that would allow for these Properties to be set via the New-Mginvitation string? Sadly these values have to be set as part of our organisational policy as there are a vast amount of external parties that utilise our platform. It’s also slightly annoying as I believe this would have been possible with the Azure AD Module however the whole deprecation at the end of the month situation has led us down the MgGraph route.

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 46,376 Reputation points
    2023-06-13T07:27:17.9833333+00:00

    Hi @Tom Neal

    The companyName or usageLocation attribute of the invited user cannot be modified at the time of invitation, and the above attributes can only be modified after the user is invited.

    Import-Module Microsoft.Graph.Users
    
    $params = @{
    	companyName = "Microsoft"
    	usageLocation = "US"
    }
    
    $userId = 'xxxxxxxxxxxxxxxxx'
    
    Update-MgUser -UserId $userId -BodyParameter $params
    

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.