Skip to content

F/invitation user properties - #1898

Open
aayushsingh2502 wants to merge 2 commits into
mainfrom
f/invitation-user-properties
Open

F/invitation user properties#1898
aayushsingh2502 wants to merge 2 commits into
mainfrom
f/invitation-user-properties

Conversation

@aayushsingh2502

Copy link
Copy Markdown

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

This PR adds support for configuring additional guest user properties directly on the azuread_invitation resource, matching the "Properties" step shown when inviting an external (B2B) user through the Azure Portal.

The following optional arguments are added:

  • company_name
  • department
  • given_name
  • job_title
  • surname
  • usage_location

The Microsoft Graph invitation API's invitedUser container 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 a PATCH to 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 Update operation 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

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

azuread_invitation: support additional guest user properties (Department, Company name, Job title, etc.)

2 participants