lmilt
lmilt

Reputation: 1

How to change user_type of a user in Azure AD with terraform

Im using this resource : https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/user#user_type

`resource "azuread_user" "example" {
  user_principal_name = "[email protected]"
  display_name        = "J. Doe"
  mail_nickname       = "jdoe"
  password            = "SecretP@sswd99!"
}`

How to specify user_type to be Guest and not Member as its by default

I tried to put the user_type = "Guest" but its not accepted. this is the eror
with azuread_user.example,your text │ 16: user_type = "Guest" │ │ Can't configure a value for "user_type": its value will be decided automatically based on the result │ of applying this configuration.

Upvotes: 0

Views: 397

Answers (1)

kavya Saraboju
kavya Saraboju

Reputation: 10869

I tried to reproduce the same in my environment.

The user created using azuread_user is by default a member.

  • And user created through invitation is by default a guest user.

enter image description here

***User created in azure through invitation.***User type applied as guest automatically.

enter image description here

Only Global administrator or a user with User administrator role can change the created user type .

Only Global administrator can invite users as members.

Other wise the user type attribute will be applied according to what is mentioned as above .In this case the user type is applied as per way of creation.

First create the user and then try to update its property User Type, only after creating the user with default properties using globalAdministrator rights

enter image description here

Upvotes: 0

Related Questions