diff --git a/azuread/data_user.go b/azuread/data_user.go index e85cb9d859..b92635c46e 100644 --- a/azuread/data_user.go +++ b/azuread/data_user.go @@ -57,6 +57,16 @@ func dataUser() *schema.Resource { Computed: true, }, + "onpremises_sam_account_name": { + Type: schema.TypeString, + Computed: true, + }, + + "onpremises_user_principal_name": { + Type: schema.TypeString, + Computed: true, + }, + "usage_location": { Type: schema.TypeString, Computed: true, @@ -106,5 +116,8 @@ func dataSourceUserRead(d *schema.ResourceData, meta interface{}) error { d.Set("mail_nickname", user.MailNickname) d.Set("usage_location", user.UsageLocation) + d.Set("onpremises_sam_account_name", user.AdditionalProperties["onPremisesSamAccountName"]) + d.Set("onpremises_user_principal_name", user.AdditionalProperties["onPremisesUserPrincipalName"]) + return nil } diff --git a/azuread/resource_user.go b/azuread/resource_user.go index 6d712eb02f..5b133da3ce 100644 --- a/azuread/resource_user.go +++ b/azuread/resource_user.go @@ -70,6 +70,16 @@ func resourceUser() *schema.Resource { Computed: true, }, + "onpremises_sam_account_name": { + Type: schema.TypeString, + Computed: true, + }, + + "onpremises_user_principal_name": { + Type: schema.TypeString, + Computed: true, + }, + "object_id": { Type: schema.TypeString, Computed: true, @@ -160,6 +170,10 @@ func resourceUserRead(d *schema.ResourceData, meta interface{}) error { d.Set("account_enabled", user.AccountEnabled) d.Set("object_id", user.ObjectID) d.Set("usage_location", user.UsageLocation) + + d.Set("onpremises_sam_account_name", user.AdditionalProperties["onPremisesSamAccountName"]) + d.Set("onpremises_user_principal_name", user.AdditionalProperties["onPremisesUserPrincipalName"]) + return nil } diff --git a/website/docs/d/user.html.markdown b/website/docs/d/user.html.markdown index d5b40833aa..e837582e29 100644 --- a/website/docs/d/user.html.markdown +++ b/website/docs/d/user.html.markdown @@ -43,4 +43,7 @@ The following attributes are exported: * `display_name` - The Display Name of the Azure AD User. * `mail` - The primary email address of the Azure AD User. * `mail_nickname` - The email alias of the Azure AD User. +* `mail_nickname` - The email alias of the Azure AD User. +* `onpremises_sam_account_name` - The on premise sam account name of the Azure AD User. +* `onpremises_user_principal_name` - The on premise user principal name of the Azure AD User. * `usage_location` - The usage location of the Azure AD User. diff --git a/website/docs/r/user.html.markdown b/website/docs/r/user.html.markdown index 09b06f37d6..c7e378de5d 100644 --- a/website/docs/r/user.html.markdown +++ b/website/docs/r/user.html.markdown @@ -40,9 +40,11 @@ The following arguments are supported: The following attributes are exported: -* `object_id` - The Object ID of the Azure AD User. * `id` - The Object ID of the Azure AD User. * `mail` - The primary email address of the Azure AD User. +* `onpremises_sam_account_name` - The on premise sam account name of the Azure AD User. +* `onpremises_user_principal_name` - The on premise user principal name of the Azure AD User. +* `object_id` - The Object ID of the Azure AD User. ## Import