F/invitation user properties - #1898
Open
aayushsingh2502 wants to merge 2 commits into
Open
Conversation
Add company_name, department, given_name, job_title, surname and usage_location arguments to the azuread_invitation resource. These are applied to the invited guest user after the invitation is created, since the invitation API's invitedUser container is read-only. The properties are updatable via a new Update operation.
- Use nullable.NoZero for CompanyName in expandInvitationUser so an empty company_name sends null (not "") to the Graph API. Sending an empty string caused a 400 Bad Request on the post-invitation PATCH for any resource that did not set company_name (e.g. TestAccInvitation_message). - Add "id" to the $select list in invitationResourceRead so the user object ID is always returned when querying the guest user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Community Note
Description
This PR adds support for configuring additional guest user properties directly on the
azuread_invitationresource, matching the "Properties" step shown when inviting an external (B2B) user through the Azure Portal.The following optional arguments are added:
company_namedepartmentgiven_namejob_titlesurnameusage_locationThe Microsoft Graph invitation API's
invitedUsercontainer is read-only and only returns the new user's object ID, so these properties cannot be sent on the invitation payload itself. Instead they are applied to the resulting guest user via aPATCHto the user object once it has replicated in Azure AD. The resource already performs a post-invitation patch to detect replication of the new guest user, and this change reuses that flow to apply the configured properties.The new properties are updatable in place: an
Updateoperation has been added that patches the existing guest user, so changing a value does not delete and re-invite the user.Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azuread_invitation- support for thecompany_name,department,given_name,job_title,surnameandusage_locationproperties [azuread_invitation: support additional guest user properties (Department, Company name, Job title, etc.) #1893]This is a (please select all that apply):
Related Issue(s)
Fixes #1893
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the provider.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Note
If this PR changes meaningfully during the course of review please update the title and description as required.