User

Manages a User within Azure Active Directory.

NOTE: If you’re authenticating using a Service Principal then it must have permissions to Directory.ReadWrite.All within the Windows Azure Active Directory API.

Example Usage

using Pulumi;
using AzureAD = Pulumi.AzureAD;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new AzureAD.User("example", new AzureAD.UserArgs
        {
            DisplayName = "J. Doe",
            MailNickname = "jdoe",
            Password = "SecretP@sswd99!",
            UserPrincipalName = "jdoe@hashicorp.com",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-azuread/sdk/v4/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := azuread.NewUser(ctx, "example", &azuread.UserArgs{
			DisplayName:       pulumi.String("J. Doe"),
			MailNickname:      pulumi.String("jdoe"),
			Password:          pulumi.String("SecretP@sswd99!"),
			UserPrincipalName: pulumi.String("jdoe@hashicorp.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_azuread as azuread

example = azuread.User("example",
    display_name="J. Doe",
    mail_nickname="jdoe",
    password="SecretP@sswd99!",
    user_principal_name="jdoe@hashicorp.com")
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const example = new azuread.User("example", {
    displayName: "J. Doe",
    mailNickname: "jdoe",
    password: "SecretP@sswd99!",
    userPrincipalName: "jdoe@hashicorp.com",
});

Create a User Resource

new User(name: string, args: UserArgs, opts?: CustomResourceOptions);
@overload
def User(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         account_enabled: Optional[bool] = None,
         city: Optional[str] = None,
         company_name: Optional[str] = None,
         country: Optional[str] = None,
         department: Optional[str] = None,
         display_name: Optional[str] = None,
         force_password_change: Optional[bool] = None,
         given_name: Optional[str] = None,
         immutable_id: Optional[str] = None,
         job_title: Optional[str] = None,
         mail_nickname: Optional[str] = None,
         mobile: Optional[str] = None,
         password: Optional[str] = None,
         physical_delivery_office_name: Optional[str] = None,
         postal_code: Optional[str] = None,
         state: Optional[str] = None,
         street_address: Optional[str] = None,
         surname: Optional[str] = None,
         usage_location: Optional[str] = None,
         user_principal_name: Optional[str] = None)
@overload
def User(resource_name: str,
         args: UserArgs,
         opts: Optional[ResourceOptions] = None)
func NewUser(ctx *Context, name string, args UserArgs, opts ...ResourceOption) (*User, error)
public User(string name, UserArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args UserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args UserArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args UserArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args UserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

User Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The User resource accepts the following input properties:

DisplayName string
The name to display in the address book for the user.
Password string
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
UserPrincipalName string
The User Principal Name of the User.
AccountEnabled bool
true if the account should be enabled, otherwise false. Defaults to true.
City string
The city in which the user is located.
CompanyName string
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
Country string
The country/region in which the user is located; for example, “US” or “UK”.
Department string
The name for the department in which the user works.
ForcePasswordChange bool
true if the User is forced to change the password during the next sign-in. Defaults to false.
GivenName string
The given name (first name) of the user.
ImmutableId string
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
JobTitle string
The user’s job title.
MailNickname string
The mail alias for the user. Defaults to the user name part of the User Principal Name.
Mobile string
The primary cellular telephone number for the user.
PhysicalDeliveryOfficeName string
The office location in the user’s place of business.
PostalCode string
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
State string
The state or province in the user’s address.
StreetAddress string
The street address of the user’s place of business.
Surname string
The user’s surname (family name or last name).
UsageLocation string
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.
DisplayName string
The name to display in the address book for the user.
Password string
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
UserPrincipalName string
The User Principal Name of the User.
AccountEnabled bool
true if the account should be enabled, otherwise false. Defaults to true.
City string
The city in which the user is located.
CompanyName string
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
Country string
The country/region in which the user is located; for example, “US” or “UK”.
Department string
The name for the department in which the user works.
ForcePasswordChange bool
true if the User is forced to change the password during the next sign-in. Defaults to false.
GivenName string
The given name (first name) of the user.
ImmutableId string
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
JobTitle string
The user’s job title.
MailNickname string
The mail alias for the user. Defaults to the user name part of the User Principal Name.
Mobile string
The primary cellular telephone number for the user.
PhysicalDeliveryOfficeName string
The office location in the user’s place of business.
PostalCode string
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
State string
The state or province in the user’s address.
StreetAddress string
The street address of the user’s place of business.
Surname string
The user’s surname (family name or last name).
UsageLocation string
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.
displayName string
The name to display in the address book for the user.
password string
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
userPrincipalName string
The User Principal Name of the User.
accountEnabled boolean
true if the account should be enabled, otherwise false. Defaults to true.
city string
The city in which the user is located.
companyName string
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
country string
The country/region in which the user is located; for example, “US” or “UK”.
department string
The name for the department in which the user works.
forcePasswordChange boolean
true if the User is forced to change the password during the next sign-in. Defaults to false.
givenName string
The given name (first name) of the user.
immutableId string
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
jobTitle string
The user’s job title.
mailNickname string
The mail alias for the user. Defaults to the user name part of the User Principal Name.
mobile string
The primary cellular telephone number for the user.
physicalDeliveryOfficeName string
The office location in the user’s place of business.
postalCode string
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
state string
The state or province in the user’s address.
streetAddress string
The street address of the user’s place of business.
surname string
The user’s surname (family name or last name).
usageLocation string
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.
display_name str
The name to display in the address book for the user.
password str
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
user_principal_name str
The User Principal Name of the User.
account_enabled bool
true if the account should be enabled, otherwise false. Defaults to true.
city str
The city in which the user is located.
company_name str
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
country str
The country/region in which the user is located; for example, “US” or “UK”.
department str
The name for the department in which the user works.
force_password_change bool
true if the User is forced to change the password during the next sign-in. Defaults to false.
given_name str
The given name (first name) of the user.
immutable_id str
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
job_title str
The user’s job title.
mail_nickname str
The mail alias for the user. Defaults to the user name part of the User Principal Name.
mobile str
The primary cellular telephone number for the user.
physical_delivery_office_name str
The office location in the user’s place of business.
postal_code str
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
state str
The state or province in the user’s address.
street_address str
The street address of the user’s place of business.
surname str
The user’s surname (family name or last name).
usage_location str
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.

Outputs

All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Mail string
The primary email address of the User.
ObjectId string
The Object ID of the User.
OnpremisesSamAccountName string
The on-premise SAM account name of the User.
OnpremisesUserPrincipalName string
The on-premise user principal name of the User.
Id string
The provider-assigned unique ID for this managed resource.
Mail string
The primary email address of the User.
ObjectId string
The Object ID of the User.
OnpremisesSamAccountName string
The on-premise SAM account name of the User.
OnpremisesUserPrincipalName string
The on-premise user principal name of the User.
id string
The provider-assigned unique ID for this managed resource.
mail string
The primary email address of the User.
objectId string
The Object ID of the User.
onpremisesSamAccountName string
The on-premise SAM account name of the User.
onpremisesUserPrincipalName string
The on-premise user principal name of the User.
id str
The provider-assigned unique ID for this managed resource.
mail str
The primary email address of the User.
object_id str
The Object ID of the User.
onpremises_sam_account_name str
The on-premise SAM account name of the User.
onpremises_user_principal_name str
The on-premise user principal name of the User.

Look up an Existing User Resource

Get an existing User resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: UserState, opts?: CustomResourceOptions): User
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_enabled: Optional[bool] = None,
        city: Optional[str] = None,
        company_name: Optional[str] = None,
        country: Optional[str] = None,
        department: Optional[str] = None,
        display_name: Optional[str] = None,
        force_password_change: Optional[bool] = None,
        given_name: Optional[str] = None,
        immutable_id: Optional[str] = None,
        job_title: Optional[str] = None,
        mail: Optional[str] = None,
        mail_nickname: Optional[str] = None,
        mobile: Optional[str] = None,
        object_id: Optional[str] = None,
        onpremises_sam_account_name: Optional[str] = None,
        onpremises_user_principal_name: Optional[str] = None,
        password: Optional[str] = None,
        physical_delivery_office_name: Optional[str] = None,
        postal_code: Optional[str] = None,
        state: Optional[str] = None,
        street_address: Optional[str] = None,
        surname: Optional[str] = None,
        usage_location: Optional[str] = None,
        user_principal_name: Optional[str] = None) -> User
func GetUser(ctx *Context, name string, id IDInput, state *UserState, opts ...ResourceOption) (*User, error)
public static User Get(string name, Input<string> id, UserState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

AccountEnabled bool
true if the account should be enabled, otherwise false. Defaults to true.
City string
The city in which the user is located.
CompanyName string
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
Country string
The country/region in which the user is located; for example, “US” or “UK”.
Department string
The name for the department in which the user works.
DisplayName string
The name to display in the address book for the user.
ForcePasswordChange bool
true if the User is forced to change the password during the next sign-in. Defaults to false.
GivenName string
The given name (first name) of the user.
ImmutableId string
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
JobTitle string
The user’s job title.
Mail string
The primary email address of the User.
MailNickname string
The mail alias for the user. Defaults to the user name part of the User Principal Name.
Mobile string
The primary cellular telephone number for the user.
ObjectId string
The Object ID of the User.
OnpremisesSamAccountName string
The on-premise SAM account name of the User.
OnpremisesUserPrincipalName string
The on-premise user principal name of the User.
Password string
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
PhysicalDeliveryOfficeName string
The office location in the user’s place of business.
PostalCode string
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
State string
The state or province in the user’s address.
StreetAddress string
The street address of the user’s place of business.
Surname string
The user’s surname (family name or last name).
UsageLocation string
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.
UserPrincipalName string
The User Principal Name of the User.
AccountEnabled bool
true if the account should be enabled, otherwise false. Defaults to true.
City string
The city in which the user is located.
CompanyName string
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
Country string
The country/region in which the user is located; for example, “US” or “UK”.
Department string
The name for the department in which the user works.
DisplayName string
The name to display in the address book for the user.
ForcePasswordChange bool
true if the User is forced to change the password during the next sign-in. Defaults to false.
GivenName string
The given name (first name) of the user.
ImmutableId string
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
JobTitle string
The user’s job title.
Mail string
The primary email address of the User.
MailNickname string
The mail alias for the user. Defaults to the user name part of the User Principal Name.
Mobile string
The primary cellular telephone number for the user.
ObjectId string
The Object ID of the User.
OnpremisesSamAccountName string
The on-premise SAM account name of the User.
OnpremisesUserPrincipalName string
The on-premise user principal name of the User.
Password string
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
PhysicalDeliveryOfficeName string
The office location in the user’s place of business.
PostalCode string
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
State string
The state or province in the user’s address.
StreetAddress string
The street address of the user’s place of business.
Surname string
The user’s surname (family name or last name).
UsageLocation string
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.
UserPrincipalName string
The User Principal Name of the User.
accountEnabled boolean
true if the account should be enabled, otherwise false. Defaults to true.
city string
The city in which the user is located.
companyName string
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
country string
The country/region in which the user is located; for example, “US” or “UK”.
department string
The name for the department in which the user works.
displayName string
The name to display in the address book for the user.
forcePasswordChange boolean
true if the User is forced to change the password during the next sign-in. Defaults to false.
givenName string
The given name (first name) of the user.
immutableId string
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
jobTitle string
The user’s job title.
mail string
The primary email address of the User.
mailNickname string
The mail alias for the user. Defaults to the user name part of the User Principal Name.
mobile string
The primary cellular telephone number for the user.
objectId string
The Object ID of the User.
onpremisesSamAccountName string
The on-premise SAM account name of the User.
onpremisesUserPrincipalName string
The on-premise user principal name of the User.
password string
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
physicalDeliveryOfficeName string
The office location in the user’s place of business.
postalCode string
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
state string
The state or province in the user’s address.
streetAddress string
The street address of the user’s place of business.
surname string
The user’s surname (family name or last name).
usageLocation string
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.
userPrincipalName string
The User Principal Name of the User.
account_enabled bool
true if the account should be enabled, otherwise false. Defaults to true.
city str
The city in which the user is located.
company_name str
The company name which the user is associated. This property can be useful for describing the company that an external user comes from.
country str
The country/region in which the user is located; for example, “US” or “UK”.
department str
The name for the department in which the user works.
display_name str
The name to display in the address book for the user.
force_password_change bool
true if the User is forced to change the password during the next sign-in. Defaults to false.
given_name str
The given name (first name) of the user.
immutable_id str
The value used to associate an on-premise Active Directory user account with their Azure AD user object. This must be specified if you are using a federated domain for the user’s userPrincipalName (UPN) property when creating a new user account.
job_title str
The user’s job title.
mail str
The primary email address of the User.
mail_nickname str
The mail alias for the user. Defaults to the user name part of the User Principal Name.
mobile str
The primary cellular telephone number for the user.
object_id str
The Object ID of the User.
onpremises_sam_account_name str
The on-premise SAM account name of the User.
onpremises_user_principal_name str
The on-premise user principal name of the User.
password str
The password for the User. The password must satisfy minimum requirements as specified by the password policy. The maximum length is 256 characters.
physical_delivery_office_name str
The office location in the user’s place of business.
postal_code str
The postal code for the user’s postal address. The postal code is specific to the user’s country/region. In the United States of America, this attribute contains the ZIP code.
state str
The state or province in the user’s address.
street_address str
The street address of the user’s place of business.
surname str
The user’s surname (family name or last name).
usage_location str
The usage location of the User. Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. The usage location is a two letter country code (ISO standard 3166). Examples include: NO, JP, and GB. Cannot be reset to null once set.
user_principal_name str
The User Principal Name of the User.

Import

Azure Active Directory Users can be imported using the object id, e.g.

 $ pulumi import azuread:index/user:User my_user 00000000-0000-0000-0000-000000000000

Package Details

Repository
https://github.com/pulumi/pulumi-azuread
License
Apache-2.0
Notes
This Pulumi package is based on the azuread Terraform Provider.