Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azuread_user - add onpremises_sam_account_name and onpremises_user_principal_name #222

Merged
merged 4 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions azuread/data_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
14 changes: 14 additions & 0 deletions azuread/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions website/docs/d/user.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 3 additions & 1 deletion website/docs/r/user.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down