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

Implement Azure AD role-based access control resource #422

Closed
beachfires opened this issue Apr 5, 2021 · 8 comments
Closed

Implement Azure AD role-based access control resource #422

beachfires opened this issue Apr 5, 2021 · 8 comments

Comments

@beachfires
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I'm currently trying to manage our Azure Active Directory using terraform and have managed to move user/group/role-assignments so far. One last thing I want to be able to do using terraform is assign AD Administrative Roles. For example I want to be able to assign the Admin role "Application administrator" or "Security administrator" to a user as the Active Directory scope (https://docs.microsoft.com/en-gb/azure/active-directory/roles/custom-overview#understand-azure-ad-role-based-access-control). I do not see any way I can do this right now.

New or Affected Resource(s)

  • azuread_assigned_roles

Potential Terraform Configuration

resource "azurerm_ad_role_assignment" "example" {
  name               = "00000000-0000-0000-0000-000000000000"
  role_definition_id = azurerm_role_definition.example.role_definition_resource_id
  principal_id       = data.azurerm_client_config.example.object_id
}

References

@manicminer
Copy link
Contributor

Hi @beachfires, thanks for requesting this feature! You are correct, we currently don't have the ability to assign directory roles to principals. This capability is currently blocked on our active work to move to the Microsoft Graph API (see #323 for context).

I believe there is an existing issue requesting this feature #50 - is the same as what you had in mind?

@yann-soubeyrand
Copy link

@manicminer as I understand, #50 is to assign AD roles to AD users and this issue is to assign AD roles to Azure principals. I’m not sure I understand correctly, but we have use cases for the latter anyway. @beachfires tell me if I’m wrong and I should open another issue.

@manicminer
Copy link
Contributor

manicminer commented May 12, 2021

@yann-soubeyrand Thanks, that makes sense. The most likely implementation will be a single member-style resource that accepts a role ID and an object ID for a principal (user or service). Something like this:

resource "azuread_directory_role_member" "example_up" {
  role_id          = data.azuread_directory_role.global_admin.id
  member_object_id = azuread_user.example.object_id
}

resource "azuread_directory_role_member" "example_sp" {
  role_id          = data.azuread_directory_role.user_admin.id
  member_object_id = azuread_service_principal.example.object_id
}

That said, I'm happy to leave this issue open for clarification.

@beachfires
Copy link
Author

Yes, exactly what @manicminer described.

@manicminer manicminer added this to the v2.0.0 milestone May 27, 2021
@manicminer manicminer modified the milestones: v2.0.0, v2.1.0 Jul 21, 2021
@manicminer
Copy link
Contributor

Just noticed this is a duplicate of #50, going to close this in favor of the existing issue

@manicminer
Copy link
Contributor

Duplicate of #50

@manicminer manicminer marked this as a duplicate of #50 Sep 1, 2021
@github-actions
Copy link

github-actions bot commented Sep 2, 2021

This functionality has been released in v2.1.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Oct 3, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants